Class VStringToFixedWidthCastingImpl
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
NumPy's casts from StringDType to the fixed-width string classes (string_to_fixed_width_resolve_descriptors):
same_kind, and only to a SIZED destination — there is no way to know the width the strings need.
public sealed class VStringToFixedWidthCastingImpl : CastingImpl
- Inheritance
-
VStringToFixedWidthCastingImpl
- Inherited Members
Methods
get_strided_loop(ArrayMethodContext, bool, long[], out NDArrayMethodFlags)
The cast's strided loop (Get(CastingImpl, ArrayMethodContext, out NDArrayMethodFlags)): NumPy's stringdtype/casts.cpp loop of the
pair, the allocators of both sides locked per call.
public override NDInnerLoopFunc get_strided_loop(ArrayMethodContext context, bool aligned, long[] strides, out NDArrayMethodFlags flags)
Parameters
contextArrayMethodContextThe resolved descriptors and the
StringDTypesides' allocators (NumSharp.ArrayMethodContext.Allocators).alignedboolUnused: the loop reads and writes unaligned cells and elements.
strideslong[]Unused: the loop takes the strides of each call.
flagsNDArrayMethodFlagsReceives the method's flags.
Returns
- NDInnerLoopFunc
The loop: [0] the source run, [1] the destination run, byte strides.
Exceptions
- ArgumentException
A
StringDTypeside without its allocator in the context.- NotSupportedException
The other class has no storage (datetime64 / timedelta64 before Stage C).
resolve_descriptors(DType[], DType[], out long)
Resolves the loop descriptors: the destination must be given (a sized U / S).
public override NPY_CASTING resolve_descriptors(DType[] givenDescrs, DType[] loopDescrs, out long viewOffset)
Parameters
givenDescrsDType[]The source descriptor and the destination descriptor.
loopDescrsDType[]Receives the loop descriptors.
viewOffsetlongAlways NoView.
Returns
- NPY_CASTING
same_kind.
Exceptions
- TypeError
No destination descriptor: NumPy's
Casting from StringDType to a fixed-width dtype with an unspecified size is not currently supported, specify an explicit size for the output dtype instead.(astype('U')reports it ascannot cast dtype StringDType() to <class 'numpy.dtypes.StrDType'>., the wrapper of CastDescrToDType(DType, DTypeMeta)).