Table of Contents

Class LegacyBuiltinDTypeMeta

Namespace
NumSharp
Assembly
NumSharp.dll

The DType class of a storage-backed NumSharp dtype — the 15 element types (plus the vestigial String), wrapped the way NumPy's dtypemeta_wrap_legacy_descriptor wraps its builtin descriptors into numpy.dtypes.*DType classes. Data-driven: the registry constructs one per NPTypeCode with its NumPy type number, kind, char, size, alignment and aliases; the behaviour slots are the builtin ones — the singleton is the default descriptor, and CommonDType(DTypeMeta) is NumPy's default_builtin_common_dtype over NumSharp's frozen promotion table (NumSharp.np._nptypemap_arr_arr), so every existing promote_types answer is reproduced bit-for-bit.

public sealed class LegacyBuiltinDTypeMeta : DTypeMeta
Inheritance
LegacyBuiltinDTypeMeta
Inherited Members

Methods

CommonDType(DTypeMeta)

NumPy's default_builtin_common_dtype: the NEP 50 Python-scalar rules first (a weak float adopts a float/complex class, a weak int adopts any numeric class, a weak complex lifts a real float to complex), then defer to the class with the larger type number, then the frozen promotion table.

public override DTypeMeta CommonDType(DTypeMeta other)

Parameters

other DTypeMeta

Returns

DTypeMeta

DefaultDescr()

The singleton — a non-parametric class has exactly one canonical descriptor.

public override DType DefaultDescr()

Returns

DType

IsKnownScalarType(Type)

is_known_scalar_type: whether a C# scalar of type belongs to this class.

public override bool IsKnownScalarType(Type type)

Parameters

type Type

Returns

bool