Table of Contents

Class DirectILKernelGenerator

Namespace
NumSharp.Backends.Kernels
Assembly
NumSharp.dll

Binary operations (same-type) - contiguous kernels and generic helpers.

public static class DirectILKernelGenerator
Inheritance
DirectILKernelGenerator
Inherited Members

Fields

VectorBits

Detected vector width at startup: 512, 256, 128, or 0 (no SIMD).

public static readonly int VectorBits

Field Value

int

VectorBytes

Number of bytes per vector register.

public static readonly int VectorBytes

Field Value

int

Properties

Enabled

Whether IL generation is enabled. Can be disabled for debugging.

public static bool Enabled { get; set; }

Property Value

bool

Name

Provider name for diagnostics.

public static string Name { get; }

Property Value

string

Methods

Clip(NPTypeCode, ClipMode, ClipBoundsKind, void*, void*, long, void*, void*)

Run a clip operation. Picks (and on first call, IL-generates) the appropriate DynamicMethod for the (dtype, mode, kind) tuple and invokes it with the supplied pointers.

public static void Clip(NPTypeCode dtype, DirectILKernelGenerator.ClipMode mode, DirectILKernelGenerator.ClipBoundsKind kind, void* src, void* dst, long size, void* lo, void* hi)

Parameters

dtype NPTypeCode
mode DirectILKernelGenerator.ClipMode
kind DirectILKernelGenerator.ClipBoundsKind
src void*
dst void*
size long
lo void*
hi void*

FrexpHelper(decimal*, decimal*, int*, long)

Scalar frexp over a contiguous Decimal buffer (a NumSharp extension; NumPy has no decimal dtype). Computed through the double bridge, so the mantissa carries double precision — consistent with every other decimal transcendental in the engine.

public static void FrexpHelper(decimal* src, decimal* mant, int* exp, long n)

Parameters

src decimal*

Source Decimal values (contiguous).

mant decimal*

Receives the Decimal mantissas.

exp int*

Receives one int32 exponent per element.

n long

Element count.

FrexpHelper(double*, double*, int*, long)

SIMD frexp over a contiguous double buffer: reads src[i] and writes the mantissa to mant[i] and the int32 exponent to exp[i]. Out of place so the two outputs share one C-contiguous layout regardless of the source's layout. The all-normal chunk is vectorized (integer field manipulation); any chunk with a zero/subnormal/inf/ NaN lane falls to the scalar core so the fast path stays branch-free.

public static void FrexpHelper(double* src, double* mant, int* exp, long n)

Parameters

src double*

Source values (contiguous). May alias mant only if identical.

mant double*

Receives the mantissas.

exp int*

Receives one int32 exponent per element.

n long

Element count.

FrexpHelper(Half*, Half*, int*, long)

Scalar frexp over a contiguous Half buffer: widens each value to float, decomposes it with FrexpStepF(float, out int) and narrows the mantissa back to Half — NumPy's exact HALF_frexp shape. No vector path (the BCL has no Half arithmetic).

public static void FrexpHelper(Half* src, Half* mant, int* exp, long n)

Parameters

src Half*

Source Half values (contiguous).

mant Half*

Receives the Half mantissas.

exp int*

Receives one int32 exponent per element.

n long

Element count.

FrexpHelper(float*, float*, int*, long)

SIMD frexp over a contiguous float buffer — the FrexpHelper(double*, double*, int*, long) algorithm at single precision (exponents are computed as int32 lanes and stored directly).

public static void FrexpHelper(float* src, float* mant, int* exp, long n)

Parameters

src float*

Source values (contiguous).

mant float*

Receives the mantissas.

exp int*

Receives one int32 exponent per element.

n long

Element count.

GetAdjacentDiffKernel(NPTypeCode)

Get or generate the adjacent-difference (subtract) stencil kernel for dt. Returns null for Boolean (np.diff differences booleans with not_equal, not subtract) and whenever IL generation is disabled or the emitter rejects the dtype — the caller then falls back to the generic view-subtract path.

public static DirectILKernelGenerator.AdjacentDiffKernel GetAdjacentDiffKernel(NPTypeCode dt)

Parameters

dt NPTypeCode

Returns

DirectILKernelGenerator.AdjacentDiffKernel

GetArgwhereCountKernel(Type)

IL-emitted count of non-zero elements. Returns null only when Enabled is false — every supported dtype has a kernel (SIMD where Vector{T} exists, scalar IL via op_Inequality otherwise).

public static ArgwhereCountKernel GetArgwhereCountKernel(Type elementType)

Parameters

elementType Type

Returns

ArgwhereCountKernel

GetArgwhereExpandKernel()

IL-emitted coord expand (singleton — same kernel handles any ndim).

public static ArgwhereExpandKernel GetArgwhereExpandKernel()

Returns

ArgwhereExpandKernel

GetArgwhereFlatKernel(Type)

IL-emitted bit-scan that writes flat indices of non-zero elements into a pre-sized buffer.

public static ArgwhereFlatKernel GetArgwhereFlatKernel(Type elementType)

Parameters

elementType Type

Returns

ArgwhereFlatKernel

GetBinaryScalarDelegate(BinaryScalarKernelKey)

Get or generate an IL-based binary scalar delegate. Returns a Func<TLhs, TRhs, TResult> delegate.

public static Delegate GetBinaryScalarDelegate(BinaryScalarKernelKey key)

Parameters

key BinaryScalarKernelKey

Returns

Delegate

GetChooseFlatKernel(int, int)

IL-emitted flat choose kernel, cached per (element width, mode). Returns null only when Enabled is false.

public static ChooseFlatKernel GetChooseFlatKernel(int elemBytes, int mode)

Parameters

elemBytes int
mode int

Returns

ChooseFlatKernel

GetChooseStridedKernel(int, int)

IL-emitted strided choose kernel, cached per (element width, mode). Returns null only when Enabled is false.

public static ChooseStridedKernel GetChooseStridedKernel(int elemBytes, int mode)

Parameters

elemBytes int
mode int

Returns

ChooseStridedKernel

GetComparisonKernel(ComparisonKernelKey)

Get or generate a comparison kernel for the specified key.

public static ComparisonKernel GetComparisonKernel(ComparisonKernelKey key)

Parameters

key ComparisonKernelKey

Returns

ComparisonKernel

GetComparisonScalarDelegate(ComparisonScalarKernelKey)

Get or generate a comparison scalar delegate. Returns a Func<TLhs, TRhs, bool> delegate.

public static Delegate GetComparisonScalarDelegate(ComparisonScalarKernelKey key)

Parameters

key ComparisonScalarKernelKey

Returns

Delegate

GetCopyKernel(CopyKernelKey)

public static CopyKernel GetCopyKernel(CopyKernelKey key)

Parameters

key CopyKernelKey

Returns

CopyKernel

GetCumulativeKernel(CumulativeKernelKey)

Get or generate a cumulative (scan) kernel. Returns a delegate that computes running accumulation over all elements.

public static CumulativeKernel GetCumulativeKernel(CumulativeKernelKey key)

Parameters

key CumulativeKernelKey

Returns

CumulativeKernel

GetDiagWriteKernel(int)

IL-emitted diagonal-write kernel for a given copy-width (copyKind — the CopyKindFor(long) of the dtype itemsize; always 1/2/4/8/16 for real dtypes, so the store is a typed MOV rather than a per-element cpblk). Returns null when Enabled is false or emission fails, so callers can fall back to the SetData path.

public static DiagWriteKernel GetDiagWriteKernel(int copyKind)

Parameters

copyKind int

Returns

DiagWriteKernel

GetDivModKernel(NPTypeCode)

Get or generate the fused divmod kernel for dt. Returns null when IL generation is disabled or the dtype has no Divmod* helper (Boolean — never reaches here, promoted to int8; Complex — divmod is unsupported), so the caller falls back to composing floor_divide + remainder.

public static DirectILKernelGenerator.DivModKernel GetDivModKernel(NPTypeCode dt)

Parameters

dt NPTypeCode

Returns

DirectILKernelGenerator.DivModKernel

GetElementCopyKernel(int, int)

The ElementCopyKernel that moves copyBytes bytes per element and NUL-fills zeroBytes more, generated on first use and cached.

public static ElementCopyKernel GetElementCopyKernel(int copyBytes, int zeroBytes)

Parameters

copyBytes int

The bytes copied from each source element (at least 1).

zeroBytes int

The NUL bytes written after them (0 when the destination is not wider).

Returns

ElementCopyKernel

The kernel, or null when IL generation is disabled or failed (the caller takes its general route).

Exceptions

ArgumentOutOfRangeException

copyBytes is not positive, or zeroBytes is negative.

GetFilterAxisKernel(long)

IL-emitted kernel cached by innerSize. Pass the actual innerSize you'll use at call time; the function buckets {1,2,4,8,16} into typed-copy variants and anything else into the bulk-cpblk variant. Returns null only when Enabled is false.

public static FilterAxisKernel GetFilterAxisKernel(long innerSize)

Parameters

innerSize long

Returns

FilterAxisKernel

GetGemvKernel(NPTypeCode)

Get the matrix·vector (gemv) kernel for dt, or null when out of scope (only Single / Double — the dtypes NumPy routes through cblas gemv), IL/SIMD unavailable, or Vector256 not hardware accelerated. A null return routes the caller back to the general GEMM.

public static DirectILKernelGenerator.GemvKernel GetGemvKernel(NPTypeCode dt)

Parameters

dt NPTypeCode

Returns

DirectILKernelGenerator.GemvKernel

GetGramKernel(NPTypeCode)

Get the symmetric-Gram kernel for dt, or null when the dtype is outside scope (only Single / Double are served — cov's real result dtypes), IL/SIMD is unavailable, or Vector256 is not hardware accelerated. A null return routes the caller back to np.dot.

public static DirectILKernelGenerator.GramKernel GetGramKernel(NPTypeCode dt)

Parameters

dt NPTypeCode

Returns

DirectILKernelGenerator.GramKernel

GetHistogramCountKernel(NPTypeCode)

Returns the cached fused count kernel for compute dtype B (Half/Single/Double).

public static DirectILKernelGenerator.HistogramCountKernel GetHistogramCountKernel(NPTypeCode binDtype)

Parameters

binDtype NPTypeCode

The compute dtype B.

Returns

DirectILKernelGenerator.HistogramCountKernel

The cached DirectILKernelGenerator.HistogramCountKernel.

Exceptions

NotSupportedException

The dtype is not a supported float compute width.

GetHistogramIndicesKernel(NPTypeCode)

Returns the cached fused bin-index kernel for the given compute dtype B.

public static DirectILKernelGenerator.HistogramIndicesKernel GetHistogramIndicesKernel(NPTypeCode binDtype)

Parameters

binDtype NPTypeCode

The bin/compute dtype — one of Half, Single or Double. Any other value throws, because np.histogram resolves the bin dtype to exactly these three float widths before reaching the kernel.

Returns

DirectILKernelGenerator.HistogramIndicesKernel

The cached DirectILKernelGenerator.HistogramIndicesKernel for binDtype.

Exceptions

NotSupportedException

The dtype is not one of the three float compute widths.

GetHistogramRangeCountKernel(NPTypeCode)

Returns the cached fused count kernel for float16 / float32 data counted over a range: the DirectILKernelGenerator.HistogramCountKernel contract, with NumPy's float64 quotient (see the file header).

public static DirectILKernelGenerator.HistogramCountKernel GetHistogramRangeCountKernel(NPTypeCode binDtype)

Parameters

binDtype NPTypeCode

The data's and the edges' dtype: Half or Single (float64 data's quotient is float64 either way: use GetHistogramCountKernel(NPTypeCode)).

Returns

DirectILKernelGenerator.HistogramCountKernel

The cached kernel. It throws IndexError for a kept sample whose index passes the edges.

Exceptions

NotSupportedException

Another dtype.

GetHistogramRangeWeightedKernel(NPTypeCode)

Returns the cached fused weighted-scatter kernel for float16 / float32 data counted over a range: the DirectILKernelGenerator.HistogramWeightedKernel contract (one block, float64 totals), with NumPy's float64 quotient.

public static DirectILKernelGenerator.HistogramWeightedKernel GetHistogramRangeWeightedKernel(NPTypeCode binDtype)

Parameters

binDtype NPTypeCode

Half or Single.

Returns

DirectILKernelGenerator.HistogramWeightedKernel

The cached kernel. It throws IndexError for a kept sample whose index passes the edges.

Exceptions

NotSupportedException

Another dtype.

GetHistogramSearchCountKernel(NPTypeCode)

Returns the cached fused non-uniform search+count kernel for the given compare dtype.

public static DirectILKernelGenerator.HistogramSearchCountKernel GetHistogramSearchCountKernel(NPTypeCode compareDtype)

Parameters

compareDtype NPTypeCode

The dtype both samples and edges are cast to (their common type).

Returns

DirectILKernelGenerator.HistogramSearchCountKernel

The cached kernel, or null when the dtype has no ordering (Complex — caller composes instead).

GetHistogramSearchIndexKernel(NPTypeCode)

Returns the cached fused search-index kernel for the given compare dtype (null for Complex).

public static DirectILKernelGenerator.HistogramSearchIndexKernel GetHistogramSearchIndexKernel(NPTypeCode compareDtype)

Parameters

compareDtype NPTypeCode

The dtype samples and edges are cast to (their common type).

Returns

DirectILKernelGenerator.HistogramSearchIndexKernel

The cached kernel, or null when the dtype has no ordering.

GetHistogramWeightedKernel(NPTypeCode)

Returns the cached fused weighted-scatter kernel for compute dtype B (Half/Single/Double).

public static DirectILKernelGenerator.HistogramWeightedKernel GetHistogramWeightedKernel(NPTypeCode binDtype)

Parameters

binDtype NPTypeCode

The compute dtype B.

Returns

DirectILKernelGenerator.HistogramWeightedKernel

The cached DirectILKernelGenerator.HistogramWeightedKernel.

Exceptions

NotSupportedException

The dtype is not a supported float compute width.

GetIndicesKernel()

IL-emitted indices fill kernel (singleton — same kernel handles any ndim). Returns null only when Enabled is false.

public static IndicesKernel GetIndicesKernel()

Returns

IndicesKernel

GetMaskGatherKernel(int)

The mask gather kernel for one slab width: copyKind is the FixedCopyKindFor(long) of the slab (its byte count, baked in), or 0 for a slab wider than NumSharp.Backends.Kernels.DirectILKernelGenerator.MaxFixedCopyBytes (copied with the runtime count).

public static MaskGatherKernel GetMaskGatherKernel(int copyKind)

Parameters

copyKind int

The copy kind.

Returns

MaskGatherKernel

The kernel, or null when runtime IL generation is unavailable (Enabled false, or the emission failed: the caller keeps its general route).

GetMixedTypeKernel(MixedTypeKernelKey)

Get or generate a mixed-type kernel for the specified key.

public static MixedTypeKernel GetMixedTypeKernel(MixedTypeKernelKey key)

Parameters

key MixedTypeKernelKey

Returns

MixedTypeKernel

GetNonZeroPerDimKernel()

IL-emitted per-dim coord expander (singleton — same kernel handles any ndim). Returns null only when Enabled is false.

public static NonZeroPerDimKernel GetNonZeroPerDimKernel()

Returns

NonZeroPerDimKernel

GetPiecewiseScalarKernel(NPTypeCode, int)

Get or generate a fused piecewise scalar kernel for (dtype, n conditions). Returns null if IL generation is disabled or the dtype is not SIMD-eligible for this kernel (the caller then uses the composition).

public static PiecewiseScalarKernel GetPiecewiseScalarKernel(NPTypeCode dtype, int n)

Parameters

dtype NPTypeCode
n int

Returns

PiecewiseScalarKernel

GetPlaceKernel(int)

IL-emitted place kernel, generated once per copy-width (copyKind — the CopyKindFor(long) of the dtype itemsize; always 1/2/4/8/16 for real dtypes, so the masked write is a typed MOV rather than a per-element cpblk). Returns null only when Enabled is false.

public static PlaceKernel GetPlaceKernel(int copyKind)

Parameters

copyKind int

Returns

PlaceKernel

GetPredicateContiguousKernel(UnaryOp, NPTypeCode)

Dedicated SIMD contiguous kernel for the float-classification predicates (IsNan / IsInf / IsFinite) over Single / Double input — the port of NumPy's vectorized loops_unary_fp_le.dispatch.c.src loops (npyv_pack_isnan/isinf/isfinite).

The general unary route cannot vectorize these: its SIMD gate (CanUseUnarySimd(UnaryKernelKey)) requires input dtype == output dtype and a predicate is inherently float→bool, so IsNan/IsInf/IsFinite fell to a per-element scalar walk (measured 40.6 µs vs NumPy's 4.1 µs on 100K float32 isnan). Lane logic per vector, all in the float domain so no reinterpret casts are needed: isnan: NOT Equals(v, v) — NaN is the only self-unequal value isinf: Equals(Abs(v), +inf) — Abs(NaN) is NaN, NaN == inf is false isfinite: LessThan(Abs(v), +inf) — NaN < inf is false, inf < inf is false then the comparison kernels' mask→bool store (ExtractMostSignificantBits + BMI2 PDEP → one sized store per vector, per-lane fallback without BMI2).

Returns null when the (op, dtype) pair is outside this kernel's scope — integer/Half/Complex inputs keep the existing scalar routes (NumPy's own HALF/CFLOAT predicate loops are scalar too), and callers fall back to GetUnaryKernel(UnaryKernelKey).

public static UnaryKernel? GetPredicateContiguousKernel(UnaryOp op, NPTypeCode inputType)

Parameters

op UnaryOp
inputType NPTypeCode

Returns

UnaryKernel

GetPredicateStridedKernel(UnaryOp, NPTypeCode)

Fused strided kernel for IsNan/IsInf/IsFinite over a 1-D strided (stepped / reversed / offset) Single/Double source writing a fresh contiguous bool result — NumPy's simd_unary_KIND_TYPE_NCONTIG_CONTIG shape: each vector is assembled from lanes strided scalar loads (CreateElements(int, Type), the npyv_loadn equivalent NumPy prefers over hardware gather for these cheap lane ops), the predicate mask applied, and the bools stored via the PDEP pack. Replaces the scalar gather-to-tile route, which paid ~1 ns/element on the gather alone (70 µs vs NumPy's 4.9 µs on a 50K stride-2 isnan). Same (op, dtype) gates as GetPredicateContiguousKernel(UnaryOp, NPTypeCode).

public static StridedUnaryKernel? GetPredicateStridedKernel(UnaryOp op, NPTypeCode inputType)

Parameters

op UnaryOp
inputType NPTypeCode

Returns

StridedUnaryKernel

GetPutAlongAxisScatterKernel(int)

The IL scatter kernel for np.put_along_axis, cached per element width (elemBytes ∈ {1,2,4,8,16}). Returns null only when Enabled is false or IL generation fails.

public static PutAlongAxisScatterKernel GetPutAlongAxisScatterKernel(int elemBytes)

Parameters

elemBytes int

Returns

PutAlongAxisScatterKernel

GetPutAlongAxisValidateKernel()

The IL index-validation kernel for np.put_along_axis (dtype-agnostic, generated once). Returns null only when Enabled is false or IL generation fails.

public static PutAlongAxisValidateKernel GetPutAlongAxisValidateKernel()

Returns

PutAlongAxisValidateKernel

GetPutFlatKernel(int, bool)

The flat scatter kernel for one element width and index width; null under the same conditions as GetTakeFlatKernel(int, bool, bool).

public static PutFlatKernel GetPutFlatKernel(int copyKind, bool idx32)

Parameters

copyKind int
idx32 bool

Returns

PutFlatKernel

GetPutKernel(int)

IL-emitted put kernel, generated once per copy-width (copyKind — the CopyKindFor(long) of the dtype itemsize; always 1/2/4/8/16 for real dtypes, so the scatter copy is a typed MOV rather than a per-element cpblk). Handles any mode. Returns null only when Enabled is false.

public static PutKernel GetPutKernel(int copyKind)

Parameters

copyKind int

Returns

PutKernel

GetPutKernel(int, bool)

As GetPutKernel(int), with the index width selectable: idx32 generates a kernel that reads the indices argument as int32 values (the delegate still types the pointer long* — the caller reinterprets its int*), so an int32 index array is scattered in place instead of widened to an int64 copy first.

public static PutKernel GetPutKernel(int copyKind, bool idx32)

Parameters

copyKind int
idx32 bool

Returns

PutKernel

GetPutMaskKernel(int)

IL-emitted putmask kernel, generated once per copy-width (copyKind — the CopyKindFor(long) of the dtype itemsize; always 1/2/4/8/16 for real dtypes, so the masked write is a typed MOV rather than a per-element cpblk). Returns null only when Enabled is false.

public static PutMaskKernel GetPutMaskKernel(int copyKind)

Parameters

copyKind int

Returns

PutMaskKernel

GetRavelMultiIndexKernel()

IL-emitted multi→flat folder (singleton — same kernel handles any ndim, both orders, and arbitrary per-axis mode tuples). Returns null only when Enabled is false.

public static RavelMultiIndexKernel GetRavelMultiIndexKernel()

Returns

RavelMultiIndexKernel

GetRepeatBroadcastKernel(int)

Returns the cached IL-emitted broadcast-repeat kernel for the given slab size. First call for a size triggers IL generation, later calls hit a dictionary lookup.

public static DirectILKernelGenerator.RepeatBroadcastKernel GetRepeatBroadcastKernel(int chunkBytes)

Parameters

chunkBytes int

Returns

DirectILKernelGenerator.RepeatBroadcastKernel

GetRepeatPerJKernel(int)

Returns the cached IL-emitted per-j repeat kernel for the given slab size.

public static DirectILKernelGenerator.RepeatPerJKernel GetRepeatPerJKernel(int chunkBytes)

Parameters

chunkBytes int

Returns

DirectILKernelGenerator.RepeatPerJKernel

GetReversedUnaryKernel(UnaryKernelKey)

Get or generate the reversed-run unary kernel of key: the StridedUnaryKernel signature for a REVERSED source (a[::-1], byte stride −elemSize), which loads each vector with one contiguous load and a lane reversal (InnerLoop.Reversed.cs) where the strided kernel assembles it from lane-count scalar loads.

public static StridedUnaryKernel GetReversedUnaryKernel(UnaryKernelKey key)

Parameters

key UnaryKernelKey

A same-width key (InputType == OutputType) whose op has a vector body, on a dtype CanReverseLanes(NPTypeCode) approves; the caller checks both.

Returns

StridedUnaryKernel

The kernel. Its srcByteStride argument is ignored: the source MUST be reversed.

Exceptions

InvalidOperationException

IL generation is disabled.

NotSupportedException

The op has no vector or scalar emission for the dtype.

GetSearchSortedKernel(NPTypeCode, bool, bool, bool)

Get or generate a searchsorted kernel.

public static DirectILKernelGenerator.SearchSortedKernel GetSearchSortedKernel(NPTypeCode type, bool leftSide, bool hasSorter, bool contiguousA)

Parameters

type NPTypeCode

Element dtype of a (and contiguous v, after caller normalizes).

leftSide bool

true = side='left', false = side='right'.

hasSorter bool

true = sorter param non-null (kernel emits sort_idx indirection).

contiguousA bool

true = a is contiguous (arrStrideBytes == elemSize). Lets JIT use scaled-index addressing instead of imul, which closes the gap to NumPy on the random-key hot path. When false, arrStrideBytes is honored as a runtime parameter.

Returns

DirectILKernelGenerator.SearchSortedKernel

GetSelectKernel(NPTypeCode, int, bool)

Get or generate a fused select kernel for (dtype, n conditions, defScalar). Returns null if IL generation is disabled or the dtype is not SIMD-eligible for this kernel (the caller then uses the composition).

public static SelectFusedKernel GetSelectKernel(NPTypeCode dtype, int n, bool defScalar)

Parameters

dtype NPTypeCode
n int
defScalar bool

Returns

SelectFusedKernel

GetShiftArrayKernel<T>(bool)

Get or generate a shift kernel for element-wise shift amounts.

public static DirectILKernelGenerator.ShiftArrayKernel<T>? GetShiftArrayKernel<T>(bool isLeftShift) where T : unmanaged

Parameters

isLeftShift bool

True for left shift, false for right shift

Returns

DirectILKernelGenerator.ShiftArrayKernel<T>

Kernel delegate or null if not supported

Type Parameters

T

Integer element type

GetShiftScalarKernel<T>(bool)

Get or generate a SIMD-optimized shift kernel for uniform shift amount.

public static DirectILKernelGenerator.ShiftScalarKernel<T>? GetShiftScalarKernel<T>(bool isLeftShift) where T : unmanaged

Parameters

isLeftShift bool

True for left shift, false for right shift

Returns

DirectILKernelGenerator.ShiftScalarKernel<T>

Kernel delegate or null if not supported

Type Parameters

T

Integer element type

GetStridedUnaryKernel(UnaryKernelKey)

Get or generate a fused strided-SIMD unary kernel for the given key. Gating (same-width SIMD-capable op, supported dtype) is the caller's responsibility.

public static StridedUnaryKernel GetStridedUnaryKernel(UnaryKernelKey key)

Parameters

key UnaryKernelKey

Returns

StridedUnaryKernel

GetTakeAlongAxisKernel(int)

IL-emitted take_along_axis gather kernel, cached per element width (elemBytes ∈ {1,2,4,8,16}). Returns null only when Enabled is false.

public static TakeAlongAxisKernel GetTakeAlongAxisKernel(int elemBytes)

Parameters

elemBytes int

Returns

TakeAlongAxisKernel

GetTakeFlatKernel(int, bool, bool)

The flat gather kernel for one element width (copyKind: the FixedCopyKindFor(long) of the per-index slab, 1 to NumSharp.Backends.Kernels.DirectILKernelGenerator.MaxFixedCopyBytes bytes) and index width. null when runtime IL generation is unavailable or the slab is wider than a constant copy (copyKind 0 — the general TakeKernel serves those with a runtime cpblk).

public static TakeFlatKernel GetTakeFlatKernel(int copyKind, bool idx32, bool prefetch)

Parameters

copyKind int
idx32 bool
prefetch bool

Returns

TakeFlatKernel

GetTakeKernel(int, bool)

IL-emitted take kernel, generated once per (copy-width, prefetch) pair. copyKind is the CopyKindFor(long) or FixedCopyKindFor(long) of the per-index slab size (1/2/4/8/16 for a typed MOV copy, any other positive width for a constant-size cpblk, 0 for a runtime-sized one; the slab is ADDRESSED with the runtime innerSize either way); prefetch emits the software-prefetch inner body (a large-source win, a small-source pessimization — the caller gates it on the gathered region exceeding cache). One kernel handles any ndim, both axis=None and axis=k. Returns null only when Enabled is false.

public static TakeKernel GetTakeKernel(int copyKind, bool prefetch)

Parameters

copyKind int
prefetch bool

Returns

TakeKernel

GetTakeKernel(int, bool, bool)

As GetTakeKernel(int, bool), with the index width selectable: idx32 generates a kernel that reads the indices argument as int32 values (the pointer is still typed long* by the delegate — the caller reinterprets its int*), so an int32 index array is gathered in place instead of being widened to a temporary int64 copy first.

public static TakeKernel GetTakeKernel(int copyKind, bool prefetch, bool idx32)

Parameters

copyKind int
prefetch bool
idx32 bool

Returns

TakeKernel

GetTakeLeadingKernel(int)

The IL gather writing NumPy's fancy-index buffer order (indexed axis first) in one pass, compiled once per copy width: copyKind 1/2/4/8/16 copies each slab with typed MOVs in a 4x-unrolled loop; 0 copies runtime-sized slabs with cpblk (large slabs, where the loop overhead is moot).

public static TakeLeadingKernel GetTakeLeadingKernel(int copyKind)

Parameters

copyKind int

The CopyKindFor(long) of the slab size in bytes.

Returns

TakeLeadingKernel

The kernel, or null when IL generation is switched off (Enabled false) or the emission failed — the caller then falls back to np.take over a moved view, which builds the same buffer after a failed emission but needs an IL kernel of its own (with Enabled false it raises NotSupportedException).

GetTraceAccumTypeCode(NPTypeCode)

Maps src NPTypeCode → (result NPTypeCode, supported). Convenience for callers that already have the type-code.

public static (NPTypeCode, bool) GetTraceAccumTypeCode(NPTypeCode src)

Parameters

src NPTypeCode

Returns

(NPTypeCode, bool)

GetTraceKernel(Type)

IL-emitted singleton per srcType. Returns null when the dtype has no kernel (no triples are unsupported in the current implementation; the field exists for graceful future expansion).

public static TraceKernel GetTraceKernel(Type srcType)

Parameters

srcType Type

Returns

TraceKernel

GetTypedElementReductionKernel<TResult>(ElementReductionKernelKey)

Get or generate a typed element-wise reduction kernel. Returns a delegate that reduces all elements to a single value of type TResult.

public static TypedElementReductionKernel<TResult> GetTypedElementReductionKernel<TResult>(ElementReductionKernelKey key) where TResult : unmanaged

Parameters

key ElementReductionKernelKey

Returns

TypedElementReductionKernel<TResult>

Type Parameters

TResult

GetUnaryKernel(UnaryKernelKey)

Get or generate a unary kernel for the specified key.

public static UnaryKernel GetUnaryKernel(UnaryKernelKey key)

Parameters

key UnaryKernelKey

Returns

UnaryKernel

GetUnaryScalarDelegate(UnaryScalarKernelKey)

Get or generate an IL-based unary scalar delegate. Returns a Func<TInput, TOutput> delegate.

public static Delegate GetUnaryScalarDelegate(UnaryScalarKernelKey key)

Parameters

key UnaryScalarKernelKey

Returns

Delegate

GetUnravelIndexKernel()

IL-emitted unravel kernel (singleton — same kernel handles any ndim and both C / F order via the runtime idxStart / idxStep args). Returns null only when Enabled is false.

public static UnravelIndexKernel GetUnravelIndexKernel()

Returns

UnravelIndexKernel

GetUnravelIndexMagicKernel()

IL-emitted reciprocal unravel kernel (singleton — any ndim, both orders). Returns null only when Enabled is false or the emission fails (the caller then has no kernel at all, as with GetUnravelIndexKernel()).

public static UnravelIndexMagicKernel GetUnravelIndexMagicKernel()

Returns

UnravelIndexMagicKernel

Remarks

Why it exists: the hardware 64-bit divide costs ~15-40 cycles and RyuJIT emits one for the remainder and another for the quotient of the same operands, so the divmod kernel ran two divides per peeled dimension — NumPy's own speed (its C compiler fuses them into one, but it peels every dimension). A multiply-high, a subtract, two shifts and a multiply-subtract do the same work in a few cycles, independent elements overlapping in the pipeline.

GetWeightedSumIterKernel(WeightedSumKernelKey)

Returns the cached IL-emitted weighted-sum kernel for the given dtype, or null if the dtype isn't supported (Bool/Char/Half/Complex/Decimal). The kernel signature matches NDInnerLoopFunc; pass it to NDIter.ForEach over the 4-operand [a, w, num_out, scl_out] iterator.

public static NDInnerLoopFunc? GetWeightedSumIterKernel(DirectILKernelGenerator.WeightedSumKernelKey key)

Parameters

key DirectILKernelGenerator.WeightedSumKernelKey

Returns

NDInnerLoopFunc

GetWhereBytesKernel(int)

The WhereBytesKernel for elements of width bytes, generated on first use and cached.

public static WhereBytesKernel GetWhereBytesKernel(int width)

Parameters

width int

The element width in bytes (at least 1).

Returns

WhereBytesKernel

The kernel, or null when IL generation is disabled (Enabled) or failed — the caller then takes its general route.

Exceptions

ArgumentOutOfRangeException

width is not positive.

GetWhereBytesStepKernel(int)

The WhereBytesStepKernel for elements of width bytes, generated on first use and cached: the select of GetWhereBytesKernel(int) for inputs that are not all contiguous — a broadcast one-element branch or condition, a strided or reversed 1-D view.

public static WhereBytesStepKernel GetWhereBytesStepKernel(int width)

Parameters

width int

The element width in bytes (at least 1).

Returns

WhereBytesStepKernel

The kernel, or null when IL generation is disabled (Enabled) or failed — the caller then takes its general route.

Exceptions

ArgumentOutOfRangeException

width is not positive.

GetWhereKernel<T>()

Get or generate an IL-based where kernel for the specified type. Returns null if IL generation is disabled or fails.

public static WhereKernel<T>? GetWhereKernel<T>() where T : unmanaged

Returns

WhereKernel<T>

Type Parameters

T

GetWhereScalarXKernel<T>()

public static WhereScalarXKernel<T> GetWhereScalarXKernel<T>() where T : unmanaged

Returns

WhereScalarXKernel<T>

Type Parameters

T

GetWhereScalarXYKernel<T>()

public static WhereScalarXYKernel<T> GetWhereScalarXYKernel<T>() where T : unmanaged

Returns

WhereScalarXYKernel<T>

Type Parameters

T

GetWhereScalarYKernel<T>()

public static WhereScalarYKernel<T> GetWhereScalarYKernel<T>() where T : unmanaged

Returns

WhereScalarYKernel<T>

Type Parameters

T

LdexpHelper(decimal*, int*, decimal*, long)

Element-wise ldexp for Decimal over an int32-exponent buffer (double bridge).

public static void LdexpHelper(decimal* x, int* exp, decimal* result, long n)

Parameters

x decimal*

Decimal mantissa/base values.

exp int*

Per-element exponents (int32).

result decimal*

Receives (decimal)(x[i] * 2^exp[i]).

n long

Element count.

Exceptions

OverflowException

A scaled value overflows the decimal range (double product ±inf).

LdexpHelper(decimal*, long*, decimal*, long)

Element-wise ldexp for Decimal through the double bridge (a NumSharp extension).

public static void LdexpHelper(decimal* x, long* exp, decimal* result, long n)

Parameters

x decimal*

Decimal mantissa/base values.

exp long*

Per-element exponents (int64, clamped to int range before scaling).

result decimal*

Receives (decimal)(x[i] * 2^exp[i]).

n long

Element count.

Exceptions

OverflowException

A scaled value overflows the decimal range (e.g. a huge exponent drives the double product to ±inf, which does not convert back to decimal) — the same bridge limit shared by every decimal transcendental in the engine.

LdexpHelper(double*, int*, double*, long)

Element-wise ldexp over contiguous double + int32-exponent buffers (no clamp needed).

public static void LdexpHelper(double* x, int* exp, double* result, long n)

Parameters

x double*

Mantissa/base values.

exp int*

Per-element exponents (int32, always in the C-int range).

result double*

Receives x[i] * 2^exp[i].

n long

Element count.

LdexpHelper(double*, long*, double*, long)

Element-wise ldexp over contiguous double + int64-exponent buffers into a double result.

public static void LdexpHelper(double* x, long* exp, double* result, long n)

Parameters

x double*

Mantissa/base values.

exp long*

Per-element exponents (int64, clamped to int range before scaling).

result double*

Receives x[i] * 2^exp[i].

n long

Element count.

LdexpHelper(Half*, int*, Half*, long)

Element-wise ldexp for Half over an int32-exponent buffer (widen-compute-narrow).

public static void LdexpHelper(Half* x, int* exp, Half* result, long n)

Parameters

x Half*

Half mantissa/base values.

exp int*

Per-element exponents (int32).

result Half*

Receives (Half)(x[i] * 2^exp[i]).

n long

Element count.

LdexpHelper(Half*, long*, Half*, long)

Element-wise ldexp for Half: widen to float, scale, narrow back (NumPy's HALF_ldexp).

public static void LdexpHelper(Half* x, long* exp, Half* result, long n)

Parameters

x Half*

Half mantissa/base values.

exp long*

Per-element exponents (int64, clamped to int range before scaling).

result Half*

Receives (Half)(x[i] * 2^exp[i]).

n long

Element count.

LdexpHelper(float*, int*, float*, long)

Element-wise ldexp over contiguous float + int32-exponent buffers (no clamp needed).

public static void LdexpHelper(float* x, int* exp, float* result, long n)

Parameters

x float*

Mantissa/base values.

exp int*

Per-element exponents (int32).

result float*

Receives x[i] * 2^exp[i].

n long

Element count.

LdexpHelper(float*, long*, float*, long)

Element-wise ldexp over contiguous float + int64-exponent buffers into a float result.

public static void LdexpHelper(float* x, long* exp, float* result, long n)

Parameters

x float*

Mantissa/base values.

exp long*

Per-element exponents (int64, clamped to int range before scaling).

result float*

Receives x[i] * 2^exp[i].

n long

Element count.

LdexpScalarExp(decimal*, int, decimal*, long)

Scalar-exponent fast path for Decimal (double bridge).

public static void LdexpScalarExp(decimal* x, int e, decimal* result, long n)

Parameters

x decimal*

Decimal mantissa/base values.

e int

The single exponent, already clamped to int range.

result decimal*

Receives (decimal)(x[i] * 2^e).

n long

Element count.

Exceptions

OverflowException

A scaled value overflows the decimal range (double product ±inf).

LdexpScalarExp(double*, int, double*, long)

Scalar-exponent fast path for double: scale a whole buffer by ONE (already-clamped) exponent without materializing a per-element exponent array — the common np.ldexp(array, k) shape.

public static void LdexpScalarExp(double* x, int e, double* result, long n)

Parameters

x double*

Mantissa/base values.

e int

The single exponent, already clamped to int range.

result double*

Receives x[i] * 2^e.

n long

Element count.

LdexpScalarExp(Half*, int, Half*, long)

Scalar-exponent fast path for Half (widen-compute-narrow).

public static void LdexpScalarExp(Half* x, int e, Half* result, long n)

Parameters

x Half*

Half mantissa/base values.

e int

The single exponent, already clamped to int range.

result Half*

Receives (Half)(x[i] * 2^e).

n long

Element count.

LdexpScalarExp(float*, int, float*, long)

Scalar-exponent fast path for float (see LdexpScalarExp(double*, int, double*, long)).

public static void LdexpScalarExp(float* x, int e, float* result, long n)

Parameters

x float*

Mantissa/base values.

e int

The single exponent, already clamped to int range.

result float*

Receives x[i] * 2^e.

n long

Element count.

ModfHelper(double*, double*, double*, long)

Out-of-place SIMD Modf for contiguous double arrays: reads input once and writes fractional/integral to their own buffers (NumPy's 3-touch pattern). See the float overload for the aliasing and special-value contract.

public static void ModfHelper(double* input, double* frac, double* integral, long size)

Parameters

input double*

Source array (read-only unless it aliases an output).

frac double*

Destination for the fractional parts.

integral double*

Destination for the integral parts.

size long

Number of elements.

ModfHelper(double*, double*, long)

In-place SIMD Modf wrapper for contiguous double arrays (see the float overload). Forwards to the out-of-place kernel with input==frac.

public static void ModfHelper(double* data, double* integral, long size)

Parameters

data double*

Input array (holds the fractional parts on return).

integral double*

Output array for the integral parts.

size long

Number of elements.

ModfHelper(Half*, Half*, Half*, long)

Out-of-place Half modf: reads input once, writes fractional/integral to their own buffers (see the float overload; NumPy's HALF_modf is scalar so this is a scalar loop).

public static void ModfHelper(Half* input, Half* frac, Half* integral, long size)

Parameters

input Half*

Source array (read-only unless it aliases an output).

frac Half*

Destination for the fractional parts.

integral Half*

Destination for the integral parts.

size long

Number of elements.

ModfHelper(Half*, Half*, long)

Modf over a contiguous Half array (scalar loop; see ModfScalar(Half, out Half, out Half)). Byte-exact with NumPy's HALF_modf. Writes fractional parts back into data.

public static void ModfHelper(Half* data, Half* integral, long size)

Parameters

data Half*

Input array (holds the fractional parts on return).

integral Half*

Output array for the integral parts.

size long

Number of elements.

ModfHelper(float*, float*, long)

In-place SIMD Modf wrapper for contiguous float arrays: data holds the input on entry and the fractional parts on return. Kept for callers that mutate the input copy in place; forwards to the out-of-place kernel with input==frac (which is a safe per-element alias).

public static void ModfHelper(float* data, float* integral, long size)

Parameters

data float*

Input array (holds the fractional parts on return).

integral float*

Output array for the integral parts.

size long

Number of elements.

ModfHelper(float*, float*, float*, long)

Out-of-place SIMD Modf for contiguous float arrays: reads input ONCE and writes the fractional and integral parts to their own buffers — NumPy's 3-touch pattern (1 read, 2 writes), avoiding the extra input-copy + write-back pass an in-place kernel needs when the caller supplies output arrays. Any two of the three pointers may alias per-element (input==frac gives the in-place case; a provided out that equals the input is handled the same way). Handles the special values (NaN, ±inf, signed zero) per C standard modf.

public static void ModfHelper(float* input, float* frac, float* integral, long size)

Parameters

input float*

Source array (read-only unless it aliases an output).

frac float*

Destination for the fractional parts.

integral float*

Destination for the integral parts.

size long

Number of elements.

NanToNum(NPTypeCode, void*, void*, long, void*, void*, void*)

Run a nan_to_num pass. Picks (and on first call IL-generates) the kernel for dtype (Half/Single/Double) and invokes it.

public static void NanToNum(NPTypeCode dtype, void* src, void* dst, long size, void* nan, void* posinf, void* neginf)

Parameters

dtype NPTypeCode
src void*
dst void*
size long
nan void*
posinf void*
neginf void*

PiecewiseScalarKernelSupportsDtype(NPTypeCode)

True when the fused piecewise scalar kernel supports dtype — the 1/2/4/8-byte numeric dtypes (shared with the select kernel). Bool/Char/Half/Decimal/ Complex stay on the composition.

public static bool PiecewiseScalarKernelSupportsDtype(NPTypeCode dtype)

Parameters

dtype NPTypeCode

Returns

bool

Quantile(NPTypeCode, NPTypeCode, NPTypeCode, NPTypeCode, QuantileMethod, void*, void*, long, int, int*, int, int*, double*, double*, int, void*, long, bool, int*, long*, double*, bool, int*, int)

Run the cached quantile kernel for the given dtypes. First call for a tuple emits and caches the DynamicMethod; later calls jump straight into the specialized native code.

public static void Quantile(NPTypeCode srcType, NPTypeCode outType, NPTypeCode lerpType, NPTypeCode qType, QuantileMethod method, void* srcBase, void* scratchBase, long outer, int n, int* kSorted, int nKs, int* cellIndex, double* cellWeight, double* q, int nQs, void* dstBase, long dstOuterStride, bool ignoreNaN = false, int* rowKScratch = null, long* rowRaw = null, double* rowWeight = null, bool medianMean = false, int* kExact = null, int nKExact = 0)

Parameters

srcType NPTypeCode

The data's dtype D.

outType NPTypeCode

The buffer's dtype: lerpType, or the caller's out dtype when it receives the lerp.

lerpType NPTypeCode

The lerp's dtype M (the data's dtype for a selection method).

qType NPTypeCode

q's precision: Half, Single or Double.

method QuantileMethod

The method (after the engine's remaps).

srcBase void*

The staged data.

scratchBase void*

A scratch line.

outer long

The number of lines.

n int

The line's length (at least 1).

kSorted int*

The plain path's ascending needed partition indexes (the tie-blind select's list).

nKs int

How many.

cellIndex int*

The plain path's per-quantile neighbours (partition-ready).

cellWeight double*

The plain path's per-quantile weights.

q double*

The quantiles.

nQs int

How many.

dstBase void*

The result buffer.

dstOuterStride long

The distance between two quantiles' blocks (0 for a scalar q).

ignoreNaN bool

The nan forms.

rowKScratch int*

The nan path's partition indexes (2 per quantile).

rowRaw long*

The nan path's neighbours (2 per quantile).

rowWeight double*

The nan path's weights (2 per quantile).

medianMean bool

Reduce even-size slices with NumPy's mean-of-middle np.median rule ((a+b)/2) instead of the quantile _lerp at q=0.5 — the two differ by up to 1 ULP. Set only by np.median/np.nanmedian; baked into the cached kernel via NumSharp.Backends.Kernels.DirectILKernelGenerator.QuantileKey.MedianMean.

kExact int*

NumPy's own partition list for float data (see DirectILKernelGenerator.QuantileKernel); null with nKExact 0 for other data.

nKExact int

How many positions kExact holds.

Exceptions

ValueError

The nan path: a line whose plan holds an index the partition refuses (NumPy's kth(=k) out of bounds (m), m the line's NaN-free length) — only with a float16 / float32 q.

SelectKernelSupportsDtype(NPTypeCode)

True when the fused select kernel supports dtype — the 1/2/4/8-byte numeric dtypes. Everything else stays on the copyto composition.

public static bool SelectKernelSupportsDtype(NPTypeCode dtype)

Parameters

dtype NPTypeCode

Returns

bool

TryGetAxisReductionKernel(AxisReductionKernelKey)

Try to get an axis reduction kernel. Supports all reduction operations and all types including type promotion. Uses SIMD for capable types, scalar loop for others.

public static AxisReductionKernel? TryGetAxisReductionKernel(AxisReductionKernelKey key)

Parameters

key AxisReductionKernelKey

Returns

AxisReductionKernel

TryGetBooleanAxisReductionKernel(AxisReductionKernelKey)

Try to get a boolean axis reduction kernel (All / Any). Returns null for non-SIMD-capable dtypes (Half, Complex, Decimal, Char) so the caller can fall back to the NDAxisIter scalar path.

public static AxisReductionKernel? TryGetBooleanAxisReductionKernel(AxisReductionKernelKey key)

Parameters

key AxisReductionKernelKey

Returns

AxisReductionKernel

TryGetCastKernel(NPTypeCode, NPTypeCode)

Get or generate a contig cast kernel for the given pair. Returns null for unsupported pairs (Boolean/Char/Half/Complex/Decimal involved).

public static DirectILKernelGenerator.CastKernel TryGetCastKernel(NPTypeCode srcType, NPTypeCode dstType)

Parameters

srcType NPTypeCode
dstType NPTypeCode

Returns

DirectILKernelGenerator.CastKernel

TryGetCopyKernel(CopyKernelKey)

public static CopyKernel? TryGetCopyKernel(CopyKernelKey key)

Parameters

key CopyKernelKey

Returns

CopyKernel

TryGetCumulativeAxisKernel(CumulativeAxisKernelKey)

Try to get or generate a cumulative axis kernel.

public static CumulativeAxisKernel? TryGetCumulativeAxisKernel(CumulativeAxisKernelKey key)

Parameters

key CumulativeAxisKernelKey

Returns

CumulativeAxisKernel

TryGetCumulativeKernel(CumulativeKernelKey)

Try to get or generate a cumulative kernel.

public static CumulativeKernel? TryGetCumulativeKernel(CumulativeKernelKey key)

Parameters

key CumulativeKernelKey

Returns

CumulativeKernel

TryGetInnerCastKernel(NPTypeCode, NPTypeCode)

Get or emit the scalar inner-loop cast kernel for the pair. Non-null for every dtype pair (all 225 Converts.To{Dst}({Src}) methods exist); returns null only if IL generation is disabled or a method unexpectedly fails to resolve.

public static DirectILKernelGenerator.InnerCastLoop TryGetInnerCastKernel(NPTypeCode srcType, NPTypeCode dstType)

Parameters

srcType NPTypeCode
dstType NPTypeCode

Returns

DirectILKernelGenerator.InnerCastLoop

TryGetMaskedAssignKernel(int)

The masked-assign kernel for elements of elementSize bytes, emitted on first use.

public static MaskedAssignKernel TryGetMaskedAssignKernel(int elementSize)

Parameters

elementSize int

The element width in bytes: 1, 2, 4, 8 or 16 (the widths of the 15 dtypes).

Returns

MaskedAssignKernel

The kernel, or null when IL generation is off (Enabled), the host has no dynamic code, the width is not one of the five, or the emission failed. A null result means "run MaskedAssignFallback(int, byte*, byte*, byte*, long*, long*, long*, long*, int)", which computes the same bits through the same run stage.

TryGetMaskedCastKernel(NPTypeCode, NPTypeCode)

Get or generate a masked-cast kernel for the given (src, dst) pair. Returns null for unsupported pairs (Boolean/Char/Half/Complex/Decimal involved).

public static DirectILKernelGenerator.MaskedCastKernel TryGetMaskedCastKernel(NPTypeCode srcType, NPTypeCode dstType)

Parameters

srcType NPTypeCode
dstType NPTypeCode

Returns

DirectILKernelGenerator.MaskedCastKernel

TryGetNanAxisReductionKernel(AxisReductionKernelKey)

Try to get a NaN-aware axis reduction kernel. SIMD kernels exist only for float/double; Half and Complex route to scalar fallback paths (Default.Reduction.Nan.cs ExecuteNanAxisReductionScalar / np.nanmean.cs / np.nanvar.cs / np.nanstd.cs) which handle them directly.

public static AxisReductionKernel? TryGetNanAxisReductionKernel(AxisReductionKernelKey key)

Parameters

key AxisReductionKernelKey

Returns

AxisReductionKernel

TryGetStridedCastKernel(NPTypeCode, NPTypeCode)

Get or generate a strided/broadcast cast kernel for the given pair. Returns null for unsupported pairs.

public static DirectILKernelGenerator.StridedCastKernel TryGetStridedCastKernel(NPTypeCode srcType, NPTypeCode dstType)

Parameters

srcType NPTypeCode
dstType NPTypeCode

Returns

DirectILKernelGenerator.StridedCastKernel

TryGetTypedElementReductionKernel<TResult>(ElementReductionKernelKey)

Try to get or generate an element reduction kernel.

public static TypedElementReductionKernel<TResult>? TryGetTypedElementReductionKernel<TResult>(ElementReductionKernelKey key) where TResult : unmanaged

Parameters

key ElementReductionKernelKey

Returns

TypedElementReductionKernel<TResult>

Type Parameters

TResult

WhereExecute<T>(bool*, T*, T*, T*, long)

Execute where operation using IL-generated kernel or fallback to static helper.

public static void WhereExecute<T>(bool* cond, T* x, T* y, T* result, long count) where T : unmanaged

Parameters

cond bool*
x T*
y T*
result T*
count long

Type Parameters

T