代码拉取完成,页面将自动刷新
package stat
import "gitee.com/quant1x/gox/num"
func (self NDArray[T]) Logic(f func(idx int, v any) bool) []bool {
d := make([]bool, self.Len())
for i, v := range self {
d[i] = f(i, v)
}
return d
}
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]) V1Gt(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 := num.Gt(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Gt(x any) Series {
values := self.Values().([]T)
bs := Gt(values, x)
return NDArray[bool](bs)
}
func (self NDArray[T]) Gte(x any) Series {
values := self.Values().([]T)
bs := Gte(values, x)
return NDArray[bool](bs)
}
func (self NDArray[T]) Lt(x any) Series {
values := self.Values().([]T)
bs := Lt(values, x)
return NDArray[bool](bs)
}
func (self NDArray[T]) Lte(x any) Series {
values := self.Values().([]T)
bs := Lte(values, x)
return NDArray[bool](bs)
}
func (self NDArray[T]) And(x any) Series {
values := self.Values().([]T)
bs := And(values, x)
return NDArray[bool](bs)
}
func (self NDArray[T]) V1And(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)
case []bool:
b = sx
default:
panic(Throw(x))
}
a := ToBool(self)
s := V1And(a, b)
return NDArray[bool](s)
}
func (self NDArray[T]) Or(x any) Series {
values := self.Values().([]T)
bs := Or(values, x)
return NDArray[bool](bs)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。