Table of Contents

Enum NPY_SCALARKIND

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's NPY_SCALARKIND enum (numpy/_core/include/numpy/ndarraytypes.h, NumPy 2.4.2): the kind of a scalar for the LEGACY value-based casting of NumPy 1.x, the answer of PyArray_ScalarKind that PyArray_CanCoerceScalar reads. The same members, order and values as the header.

public enum NPY_SCALARKIND

Fields

NPY_NOSCALAR = -1

Not a scalar (an array of one or more dimensions): PyArray_CanCoerceScalar then requires a safe cast.

NPY_BOOL_SCALAR = 0

A bool scalar.

NPY_INTPOS_SCALAR = 1

A non-negative integer: every unsigned integer scalar, and a signed one whose sign bit is clear. It may be coerced to signed and unsigned integer types.

NPY_INTNEG_SCALAR = 2

A negative signed integer, which may not be coerced to an unsigned integer type.

NPY_FLOAT_SCALAR = 3

A floating-point scalar.

NPY_COMPLEX_SCALAR = 4

A complex scalar.

NPY_OBJECT_SCALAR = 5

An object scalar, also NumPy's default kind for every other builtin type: it coerces only by a safe cast.

Remarks

NumPy 2 keeps it in its C API for compatibility only: NEP 50 promotion never asks for a scalar's kind, and neither does NumSharp, whose promotion is the NEP 50 tables (result_type(params DType[])). It is mirrored so code ported from NumPy's C API compiles; nothing in NumSharp reads it. NumPy's NPY_NSCALARKINDS define is NPY_OBJECT_SCALAR + 1.