Table of Contents

Enum NPY_TYPES

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's NPY_TYPES type-number enum (numpy/_core/include/numpy/ndarraytypes.h) — the C-API identity behind every descriptor's num / type_num. Byte-identical to NumPy's header: the members and their integer values are exactly NumPy's, so (int)NPY_TYPES.NPY_CDOUBLE is 15 on every platform, and a.dtype.type_num equals np.dtype(...).num on the host it runs on.

public enum NPY_TYPES

Fields

NPY_BOOL = 0

Boolean (bool / NumSharp Boolean).

NPY_BYTE = 1

Signed 8-bit (C signed char; NumSharp SByte / int8).

NPY_UBYTE = 2

Unsigned 8-bit (C unsigned char; NumSharp Byte / uint8).

NPY_SHORT = 3

Signed 16-bit (C short; NumSharp Int16).

NPY_USHORT = 4

Unsigned 16-bit (C unsigned short; NumSharp UInt16).

NPY_INT = 5

C int — always 32-bit; NumPy's intc. NumSharp's Int32 lane owner on LP64; on LLP64 (where int32 is NPY_LONG) the lane-sharing IntDType class of np.intc.

NPY_UINT = 6

C unsigned int — NumPy's uintc. NumSharp's UInt32 lane owner on LP64; on LLP64 the lane-sharing UIntDType class of np.uintc.

NPY_LONG = 7

C long — 64-bit on LP64, 32-bit on LLP64. NumSharp's Int64 maps here on LP64; its Int32 maps here on LLP64.

NPY_ULONG = 8

C unsigned long. NumSharp's UInt64 maps here on LP64; its UInt32 on LLP64.

NPY_LONGLONG = 9

C long long — always 64-bit. NumSharp's Int64 lane owner on LLP64; on LP64 (where int64 is NPY_LONG) the lane-sharing LongLongDType class of np.longlong.

NPY_ULONGLONG = 10

C unsigned long long. NumSharp's UInt64 lane owner on LLP64; on LP64 the lane-sharing ULongLongDType class of np.ulonglong.

NPY_FLOAT = 11

float32 (NumSharp Single) — platform-independent.

NPY_DOUBLE = 12

float64 (NumSharp Double) — platform-independent.

NPY_LONGDOUBLE = 13

C long double: the lane-sharing LongDoubleDType class of np.longdouble, stored in the float64 lane — 8 bytes on every host, as on NumPy's win-amd64 build (Linux NumPy's is the 16-byte x87 extended type).

NPY_CFLOAT = 14

complex64 — unsupported in NumSharp (single complex width is complex128); no descriptor reports this num.

NPY_CDOUBLE = 15

complex128 (NumSharp Complex) — platform-independent.

NPY_CLONGDOUBLE = 16

C long double complex: the lane-sharing CLongDoubleDType class of np.clongdouble, stored in the complex128 lane (16 bytes, as on NumPy's win-amd64 build).

NPY_OBJECT = 17

Python object array — unsupported in NumSharp.

NPY_STRING = 18

Fixed-width byte string (|S, np.bytes_) — Bytes, stored in the String lane.

NPY_UNICODE = 19

Fixed-width Unicode (<U, np.str_) — Str, the canonical class of the String lane.

NPY_VOID = 20

Structured / void (V) — unsupported in NumSharp.

NPY_DATETIME = 21

datetime64 (M8) — descriptor-level only until Stage C (no storage lane yet).

NPY_TIMEDELTA = 22

timedelta64 (m8) — descriptor-level only until Stage C.

NPY_HALF = 23

float16 (NumSharp Half) — appended out of precision order (23), platform-independent.

NPY_CHAR = 24

NumPy's deprecated byte-char (raises if used). NOT NumSharp's char dtype — that is NUMSHARP_CHAR.

NPY_NTYPES_LEGACY = 24

Sentinel: the count of legacy dtypes (shares value 24 with NPY_CHAR).

NPY_NOTYPE = 25

Sentinel: "no type" (a deliberately high, stable value so appending dtypes does not move it).

NPY_USERDEF = 256

The first user-defined type number — everything at or above is a registered user dtype (NumSharp's Decimal/Char live here).

NPY_NTYPES_ABI_COMPATIBLE = 21

Sentinel: the count of types excluding the 1.6 additions (shares value 21 with NPY_DATETIME).

NPY_VSTRING = 2056

NEP 55 variable-width StringDType — the first non-legacy-layout dtype (VStringDTypeMeta).

NUMSHARP_DECIMAL = 256

NumSharp-only decimal dtype (NumSharp Decimal) — the first user slot (aliases NPY_USERDEF = 256).

NUMSHARP_CHAR = 257

NumSharp-only char dtype (NumSharp Char; promotes as uint16) — user slot 257.

Remarks

Identity, not the computational switch. NPTypeCode remains NumSharp's storage/kernel discriminator (the value every backend switch and IL generator dispatches on); this enum is the NumPy-facing identity that rides ALONGSIDE it, the exact split NumPy draws between its C type_num and the descriptor it keys. It is a pure mirror — see type_num for the accessor and From(NPY_TYPES) for the PyArray_DescrFromType reverse.

C long is platform-dependent, and so is the descriptor a fixed-width spelling resolves to (verified against numpy 2.4.2): on LP64 (Linux/macOS) np.dtype('int32') is NPY_INT (5) and np.dtype('int64') is NPY_LONG (7); on LLP64 (Windows / any 32-bit process, where C long is 32-bit) np.dtype('int32') is NPY_LONG (7) and np.dtype('int64') is NPY_LONGLONG (9). This enum carries ALL of those members regardless of platform (it is the whole C enum); it is DTypeRegistry that maps NumSharp's single Int32/Int64 onto the platform-correct member — the same CLongIs32Bit switch the LongDType/LongLongDType aliases already use.

The C type of a width that does not own its storage lane is a class of its own, as in NumPy: on LLP64 NPY_INT / NPY_UINT (np.intc / np.uintc; int32 is the C long there), on LP64 NPY_LONGLONG / NPY_ULONGLONG (np.longlong / np.ulonglong; int64 is the C long there), and NPY_LONGDOUBLE / NPY_CLONGDOUBLE everywhere (np.longdouble / np.clongdouble, 8 and 16 bytes as on NumPy's win-amd64 build — Linux NumPy's long double is the 16-byte x87 extended type). Each is a lane-sharing class (CInt and its siblings): it stores in the canonical class's lane and reports its own type number, character and scalar type.

Members NumSharp has no dtype for are still present (for byte-identity and for From(NPY_TYPES) to reject them precisely): NPY_CFLOAT (complex64 — unsupported), NPY_OBJECT, NPY_VOID. NPY_CHAR (24) is NumPy's deprecated byte-char and is NOT NumSharp's char dtype (which is a NumSharp extension at NUMSHARP_CHAR in the user range).