gitee.com/quant1x/num@v0.3.2/type_dtype.go (about)

     1  package num
     2  
     3  import (
     4  	"gitee.com/quant1x/num/x64"
     5  )
     6  
     7  type DType = float64
     8  
     9  // NaN DType
    10  func NaN() DType {
    11  	return Float64NaN()
    12  }
    13  
    14  // DTypeIsNaN 判断DType是否NaN
    15  func DTypeIsNaN(d DType) bool {
    16  	return Float64IsNaN(d)
    17  }
    18  
    19  // Slice2DType 切片转DType
    20  func Slice2DType(v any) []DType {
    21  	return SliceToFloat64(v)
    22  }
    23  
    24  // Any2DType any转DType
    25  func Any2DType(v any) DType {
    26  	return AnyToFloat64(v)
    27  }
    28  
    29  // DType2Int DType切片转int32切片
    30  func DType2Int(d []DType) []int32 {
    31  	return x64.ToInt32(d)
    32  }