Documentation
¶
Overview ¶
Package dtype defines data types that can be supported by a platform.
Index ¶
- Constants
- func IsAlgebra(d DataType) bool
- func IsFloat(d DataType) bool
- func IsInteger(d DataType) bool
- func IsNonAlgebra(d DataType) bool
- func IsSigned(d DataType) bool
- func IsUnsigned(d DataType) bool
- func Sizeof(dt DataType) int
- func ToSlice[T any](data []byte) []T
- type AlgebraType
- type Bfloat16T
- type DataType
- type Float
- type GoDataType
- type IntegerType
- type NonAlgebraType
- type Signed
- type Unsigned
Constants ¶
const ( BoolSize = 1 Int32Size = 4 Int64Size = 8 Uint32Size = 4 Uint64Size = 8 Bfloat16Size = 2 Float32Size = 4 Float64Size = 8 )
Sizes of data type (in bytes).
Variables ¶
This section is empty.
Functions ¶
func IsNonAlgebra ¶
IsNonAlgebra returns true if the data type is a non algebra data type.
func IsUnsigned ¶
IsUnsigned returns true if the data type is a unsigned integer.
Types ¶
type AlgebraType ¶
type AlgebraType interface { Float | IntegerType | Bfloat16T }
AlgebraType are types on which common algebra operations between integers and floats are supported.
type Bfloat16T ¶
type Bfloat16T uint16
Bfloat16T is a shortened (16-bit) version of the 32-bit IEEE 754 single-precision floating-point format (binary32). This implementation only supports conversion to/from other formats, but no arithmetic.
Based on the implementation in https://github.com/gomlx/gopjrt, which is in turn derived from https://github.com/x448/float16.
func BFloat16FromFloat32 ¶
BFloat16FromFloat32 converts a float32 to a BFloat16.
func BFloat16FromFloat64 ¶
BFloat16FromFloat64 converts a float32 to a BFloat16.
type DataType ¶
type DataType uint32
DataType is the type of an atomic value or type of the data stored in an array.
type GoDataType ¶
type GoDataType interface { AlgebraType | NonAlgebraType }
GoDataType that can be stored in an array.
type IntegerType ¶
IntegerType are types on which integer algebra operations are supported.
type NonAlgebraType ¶
type NonAlgebraType interface { ~bool }
NonAlgebraType are types on which common algebra operations are NOT supported.