NumPyDType
Usage
use NumPyDType;
or
import NumPyDType;
- enum DType { UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, Float64, Complex64, Complex128, Bool, BigInt, Strings, UNDEF }
In chapel the types int and real default to int(64) and real(64). We also need other types like float32, int32, etc
- enum constant UInt8
- enum constant UInt16
- enum constant UInt32
- enum constant UInt64
- enum constant Int8
- enum constant Int16
- enum constant Int32
- enum constant Int64
- enum constant Float32
- enum constant Float64
- enum constant Complex64
- enum constant Complex128
- enum constant Bool
- enum constant BigInt
- enum constant Strings
- enum constant UNDEF
- proc whichDtype(type etype) param : DType
Take a chapel type and return the matching DType
- Arguments:
etype – chapel type
- Returns:
DType
- proc dtypeSize(dt: DType) : int
Returns the size in bytes of a DType
- Arguments:
dt :
DType– (pythonic) DType- Returns:
(int)
- proc typeSize(type t) : int
- proc str2dtype(dstr: string) : DType
Turns a dtype string in pythonland into a DType
- Arguments:
dstr :
string– pythonic dtype to be converted- Returns:
DType
- proc dtype2str(dt: DType) : string
Turns a DType into a dtype string in pythonland
- Arguments:
dtype :
DType– DType to convert to string- Returns:
(string)
- proc type2str(type t) : string
- proc type2fmt(type t) : string
- proc bool2str(b: bool) : string
- proc bool2str(b: ?t) : t where t != bool
- proc commonDType(a: DType, b: DType) : DType
Return the dtype that can store the result of an operation between two dtypes for the following operations:
+,-,*,**,//,%,&,|,^,<<,>>follows Numpy’s rules for type promotion (of which the array-api promotion rules are a subset)
- proc divDType(a: DType, b: DType) : DType
Return the dtype that can store the result of a division operation between two dtypes (following Numpy’s rules for type promotion)