代码拉取完成,页面将自动刷新
package stat
import (
"gitee.com/quant1x/vek"
"gitee.com/quant1x/vek/vek32"
)
// ArgMin Returns the indices of the minimum values along an axis.
//
// 返回轴上最小值的索引
func ArgMin[T Number](x []T) int {
ret := unaryOperations2[T, int](x, vek32.ArgMin, vek.ArgMin, __arg_min_go[T])
return ret
}
func ArgMin2[T BaseType](x []T) int {
var d int
switch vs := any(x).(type) {
case []float32:
d = ArgMin(vs)
case []float64:
d = ArgMin(vs)
case []int:
d = ArgMin(vs)
case []int8:
d = ArgMin(vs)
case []int16:
d = ArgMin(vs)
case []int32:
d = ArgMin(vs)
case []int64:
d = ArgMin(vs)
case []uint:
d = ArgMin(vs)
case []uint8:
d = ArgMin(vs)
case []uint16:
d = ArgMin(vs)
case []uint32:
d = ArgMin(vs)
case []uint64:
d = ArgMin(vs)
case []uintptr:
d = ArgMin(vs)
case []string:
d = __arg_min_go(vs)
case []bool:
d = __arg_min_go_bool(vs)
default:
// 其它类型原样返回
panic(Throw(any(x)))
}
return d
}
func __arg_min_go[T Ordered](x []T) int {
min := x[0]
idx := 0
for i, v := range x[1:] {
if v < min {
min = v
idx = 1 + i
}
}
return idx
}
func __arg_min_go_bool(x []bool) int {
min := BoolToInt(x[0])
idx := 0
for i, v := range x[1:] {
if BoolToInt(v) < min {
min = BoolToInt(v)
idx = 1 + i
}
}
return idx
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。