Class NPTypeCodeExtensions
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
public static class NPTypeCodeExtensions
- Inheritance
-
NPTypeCodeExtensions
- Inherited Members
Methods
AsType(NPTypeCode)
Convert NPTypeCode into its Type
public static Type AsType(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
CompareTo(NPTypeCode, NPTypeCode)
public static int CompareTo(this NPTypeCode left, NPTypeCode right)
Parameters
leftNPTypeCoderightNPTypeCode
Returns
GetAccumulatingType(NPTypeCode)
Gets the dtype that is used as accumulation in case when statistics are computed like sum(NDArray)
public static NPTypeCode GetAccumulatingType(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
- NPTypeCode
dtype in case when statistics are computed like sum(NDArray)
GetComputingType(NPTypeCode)
Gets the dtype that is used as return type in case when statistics are computed with high decimal precision like sin(NDArray, NPTypeCode?)
public static NPTypeCode GetComputingType(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
- NPTypeCode
dtype in case when statistics are computed like mean(NDArray)
GetDefaultValue(NPTypeCode)
Gets the default value of typeCode.
public static object GetDefaultValue(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
GetOneValue(NPTypeCode)
Gets the multiplicative identity (1) for a type. Used for reduction identity in Product operations.
public static object GetOneValue(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
GetTypeCode(Type)
Extracts NPTypeCode from given Type.
public static NPTypeCode GetTypeCode(this Type type)
Parameters
typeType
Returns
Remarks
In case there was no successful cast to NPTypeCode, return will be Empty
GetTypeCode<T>()
Extracts NPTypeCode from given T.
public static NPTypeCode GetTypeCode<T>()
Returns
Type Parameters
T
Remarks
In case there was no successful cast to NPTypeCode, return will be Empty
IsFloatingPoint(NPTypeCode)
Is typeCode a floating point type (float, double, or decimal)?
public static bool IsFloatingPoint(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
IsInteger(NPTypeCode)
Is typeCode an integer type (signed or unsigned)?
public static bool IsInteger(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
Remarks
Excludes Boolean and Char.
IsNumerical(NPTypeCode)
public static bool IsNumerical(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
IsRealNumber(NPTypeCode)
Is typeCode a float, double, complex or decimal?
public static bool IsRealNumber(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
IsSigned(NPTypeCode)
Is typeCode a float, double, complex or decimal?
public static bool IsSigned(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
IsSimdCapable(NPTypeCode)
Is typeCode capable of SIMD operations?
public static bool IsSimdCapable(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
Remarks
Returns true if the type can use SIMD when hardware support is available. Does not check if SIMD hardware is actually available. Boolean, Char, and Decimal cannot use SIMD.
IsUnsigned(NPTypeCode)
Is typeCode a uint, byte, ulong and so on.
public static bool IsUnsigned(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
IsValidNPType(Type)
Checks if given Type has a match in NPTypeCode.
public static bool IsValidNPType(this Type type)
Parameters
typeType
Returns
SizeOf(NPTypeCode)
Gets the size of given typeCode
public static int SizeOf(this NPTypeCode typeCode)
Parameters
typeCodeNPTypeCode
Returns
Remarks
The size is computed by SizeOf<T>()