代码拉取完成,页面将自动刷新
package stat
import (
"gitee.com/quant1x/vek"
"gitee.com/quant1x/vek/vek32"
)
// Mean 求均值
func Mean[T Number](x []T) T {
return unaryOperations1[T](x, vek32.Mean, vek.Mean, __mean_go[T])
}
func __mean_go[T Number](x []T) T {
return __sum(x) / T(len(x))
}
func Mean2[T BaseType](x []T) T {
var d any
switch vs := any(x).(type) {
case []float32:
d = Mean(vs)
case []float64:
d = Mean(vs)
case []int:
d = Mean(vs)
case []int8:
d = Mean(vs)
case []int16:
d = Mean(vs)
case []int32:
d = Mean(vs)
case []int64:
d = Mean(vs)
case []uint:
d = Mean(vs)
case []uint8:
d = Mean(vs)
case []uint16:
d = Mean(vs)
case []uint32:
d = Mean(vs)
case []uint64:
d = Mean(vs)
case []uintptr:
d = Mean(vs)
//case []string:
// d = __max_go(vs)
default:
// 其它类型原样返回
panic(Throw(any(x)))
}
return d.(T)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。