.. default-domain:: chpl .. module:: NumPyDType NumPyDType ========== **Usage** .. code-block:: chapel use NumPyDType; or .. code-block:: chapel import NumPyDType; .. enum:: 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 .. enumconstant:: enum constant UInt8 .. enumconstant:: enum constant UInt16 .. enumconstant:: enum constant UInt32 .. enumconstant:: enum constant UInt64 .. enumconstant:: enum constant Int8 .. enumconstant:: enum constant Int16 .. enumconstant:: enum constant Int32 .. enumconstant:: enum constant Int64 .. enumconstant:: enum constant Float32 .. enumconstant:: enum constant Float64 .. enumconstant:: enum constant Complex64 .. enumconstant:: enum constant Complex128 .. enumconstant:: enum constant Bool .. enumconstant:: enum constant BigInt .. enumconstant:: enum constant Strings .. enumconstant:: enum constant UNDEF .. function:: proc whichDtype(type etype) param: DType Take a chapel type and return the matching DType :arg etype: chapel type :returns: DType .. function:: proc dtypeSize(dt: DType): int Returns the size in bytes of a DType :arg dt: (pythonic) DType :type dt: DType :returns: (int) .. function:: proc str2dtype(dstr: string): DType Turns a dtype string in pythonland into a DType :arg dstr: pythonic dtype to be converted :type dstr: string :returns: DType .. function:: proc dtype2str(dt: DType): string Turns a DType into a dtype string in pythonland :arg dtype: DType to convert to string :type dtype: DType :returns: (string) .. function:: proc type2str(type t): string .. function:: proc type2fmt(type t): string .. function:: proc bool2str(b: bool): string .. function:: proc bool2str(b: ?t): t where t != bool .. function:: 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) .. function:: 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) .. enum:: enum DTK { Integer, Float, Complex, Bool, Other } .. enumconstant:: enum constant Integer .. enumconstant:: enum constant Float .. enumconstant:: enum constant Complex .. enumconstant:: enum constant Bool .. enumconstant:: enum constant Other