Table of Contents

Enum NPTypeCode

Namespace
NumSharp
Assembly
NumSharp.dll

Represents all available types in numpy.

public enum NPTypeCode
Extension Methods

Fields

Empty = 0

A null reference.

Boolean = 3

A simple type representing Boolean values of true or false.

Char = 4

An integral type representing unsigned 16-bit integers with values between 0 and 65535. The set of possible values for the Char type corresponds to the Unicode character set.

SByte = 5

An integral type representing signed 8-bit integers with values between -128 and 127.

Byte = 6

An integral type representing unsigned 8-bit integers with values between 0 and 255.

Int16 = 7

An integral type representing signed 16-bit integers with values between -32768 and 32767.

UInt16 = 8

An integral type representing unsigned 16-bit integers with values between 0 and 65535.

Int32 = 9

An integral type representing signed 32-bit integers with values between -2147483648 and 2147483647.

UInt32 = 10

An integral type representing unsigned 32-bit integers with values between 0 and 4294967295.

Int64 = 11

An integral type representing signed 64-bit integers with values between -9223372036854775808 and 9223372036854775807.

UInt64 = 12

An integral type representing unsigned 64-bit integers with values between 0 and 18446744073709551615.

Single = 13

A floating point type representing values ranging from approximately 1.5 x 10 -45 to 3.4 x 10 38 with a precision of 7 digits.

Float = 13

An alias of Single (the same value, 13), not a type of its own: code that switches on NPTypeCode cannot tell the two apart. .NET does not specify which name ToString() returns for a shared value; on .NET 10 both print "Single".

Double = 14

A floating point type representing values ranging from approximately 5.0 x 10 -324 to 1.7 x 10 308 with a precision of 15-16 digits.

Decimal = 15

A simple type representing values ranging from 1.0 x 10 -28 to approximately 7.9 x 10 28 with 28-29 significant digits.

Half = 16

A 16-bit floating point type (IEEE 754 half-precision).

String = 18

A sealed class type representing Unicode character strings.

Complex = 128

A complex number type with two 64-bit floating point components (real and imaginary).

Remarks

The int values of the enum are a copy of TypeCode excluding types not available in numpy.

Two values are NumSharp's own: Half takes 16, which is DateTime (so GetTypeCode(Type) returns Empty for DateTime), and Complex takes 128. The values are not NumPy's type numbers, though a few coincide: a descriptor reports its type number through type_num (NPY_TYPES).

NumPy's other dtypes are listed after Complex, commented out, in two groups: the ones that need a storage lane of their own, each with the value it would take and what has to change before it is uncommented, and the NumPy classes that store in one of the lanes above, which stay commented.