1 Star 4 Fork 11

王布衣 / pandas

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
builtin.go 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-03-08 08:43 . !83#I6L2WO支持ARM框架
package stat
import (
//gc "github.com/huandu/go-clone"
"gitee.com/quant1x/vek"
"math"
"reflect"
"strings"
)
var (
// Nil2Float64 nil指针转换float64
Nil2Float64 = float64(0)
// Nil2Float32 nil指针转换float32
Nil2Float32 = float32(0)
DTypeNaN = DType(0)
)
var (
// IgnoreParseExceptions 忽略解析异常
IgnoreParseExceptions bool = true
Avx2Enabled = false // AVX2加速开关
)
// 初始化 avx2
// 可以参考另一个实现库 gonum.org/v1/gonum/stat
func init() {
// 开启加速选项
SetAvx2Enabled(true)
Nil2Float64 = math.NaN()
// 这个转换是对的, NaN对float32也有效
Nil2Float32 = float32(Nil2Float64)
DTypeNaN = DType(Nil2Float64)
}
// SetAvx2Enabled 设定AVX2加速开关
func SetAvx2Enabled(enabled bool) {
vek.SetAcceleration(enabled)
Avx2Enabled = enabled
}
// GetAvx2Enabled 获取avx2加速状态
func GetAvx2Enabled() bool {
return Avx2Enabled
}
// 从指针/地址提取值
// Extract value from pointer
func extraceValueFromPointer(v any) (any, bool) {
vv := reflect.ValueOf(v)
if vv.Kind() == reflect.Pointer {
if vv.IsNil() {
return nil, true
}
ve := vv.Elem()
return ve.Interface(), true
}
return v, false
//kind := reflect.ValueOf(v).Kind()
//return nil, reflect.Pointer == kind
}
// IsEmpty Code to test if string is empty
func IsEmpty(s string) bool {
if strings.TrimSpace(s) == "" {
return true
} else {
return false
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/pandas.git
git@gitee.com:quant1x/pandas.git
quant1x
pandas
pandas
v0.8.4

搜索帮助

344bd9b3 5694891 D2dac590 5694891