代码拉取完成,页面将自动刷新
package stat
import "github.com/viterin/vek"
func (self NDArray[T]) ArgMax() int {
return ArgMax2(self)
}
func (self NDArray[T]) ArgMin() int {
return ArgMin2(self)
}
func (self NDArray[T]) Add(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := Add(a, b)
return NDArray[DType](s)
}
func (self NDArray[T]) Sub(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := Sub(a, b)
return NDArray[DType](s)
}
func (self NDArray[T]) Mul(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := Mul(a, b)
return NDArray[DType](s)
}
func (self NDArray[T]) Div(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := Div(a, b)
return NDArray[DType](s)
}
func (self NDArray[T]) Eq(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := Equal(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Gt(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := vek.Gt(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Gte(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := vek.Gte(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Lt(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := vek.Lt(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Lte(x any) Series {
length := self.Len()
var b []DType
switch sx := x.(type) {
case Series:
b = sx.DTypes()
case int:
b = Repeat[DType](DType(sx), length)
case DType:
b = Repeat[DType](sx, length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = Align[DType](sx, DTypeNaN, length)
default:
panic(Throw(x))
}
a := self.DTypes()
s := vek.Lte(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) And(x any) Series {
length := self.Len()
var b []bool
switch sx := x.(type) {
case Series:
b = ToBool(sx)
case int:
b = Repeat[bool](integer2Bool(sx), length)
case DType:
b = Repeat[bool](integer2Bool(sx), length)
//case int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, uintptr, float32, float64:
// b = Repeat[DType](DType(sx), length)
case []DType:
b = __NumberToBool_S(sx)
default:
panic(Throw(x))
}
a := ToBool(self)
s := vek.And(a, b)
return NDArray[bool](s)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。