Class NDExpr
Abstract expression node. Subclasses describe computations over NDIter operands; Compile() produces an NDInnerLoopFunc.
public abstract class NDExpr
- Inheritance
-
NDExpr
- Derived
- Inherited Members
Properties
SupportsSimd
True if this node and its entire sub-tree have a SIMD emit path. Structural and type-independent — prefer SupportsSimdAt(NPTypeCode) for the compile decision, since some ops only vectorize at certain element types/runtimes.
public abstract bool SupportsSimd { get; }
Property Value
Methods
ACos(NDExpr)
public static NDExpr ACos(NDExpr x)
Parameters
xNDExpr
Returns
ASin(NDExpr)
public static NDExpr ASin(NDExpr x)
Parameters
xNDExpr
Returns
ATan(NDExpr)
public static NDExpr ATan(NDExpr x)
Parameters
xNDExpr
Returns
ATan2(NDExpr, NDExpr)
public static NDExpr ATan2(NDExpr y, NDExpr x)
Parameters
Returns
Abs(NDExpr)
public static NDExpr Abs(NDExpr x)
Parameters
xNDExpr
Returns
Acosh(NDExpr)
public static NDExpr Acosh(NDExpr x)
Parameters
xNDExpr
Returns
Add(NDExpr, NDExpr)
public static NDExpr Add(NDExpr a, NDExpr b)
Parameters
Returns
All(NDExpr)
One-pass fused np.all: True iff every element of the expression is truthy
(nonzero). Result is bool and the identity is True, so All of an EMPTY
input is True (vacuous truth) — unlike Min(NDExpr), which raises on a
zero-size input.
public static NDExpr All(NDExpr x)
Parameters
xNDExpr
Returns
All(NDExpr, bool)
One-pass fused np.all(x, axis=None, keepdims=True) — the whole-array universal test kept as shape (1,…,1) (bool).
public static NDExpr All(NDExpr x, bool keepdims)
Parameters
Returns
All(NDExpr, int, bool)
One-pass fused np.all along axis (bool result; identity True).
public static NDExpr All(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Angle(NDExpr)
Phase angle in radians (np.angle) — the counterclockwise angle from the positive real axis in
(-pi, pi]. A COMPLEX child yields atan2(imag, real) as float64; a REAL
child yields atan2(0, x) — 0 for x ≥ 0, pi for x < 0, NaN for
NaN — at NumPy's per-dtype float tier (bool/int32+/f64→f64, int8/uint8/f16→f16,
int16/uint16/char/f32→f32). Radians only: the fused primitive has no deg= — a
caller wanting degrees composes Angle(x) * (180/pi). Uses the host atan2, so it
is bit-exact vs NumPy only within the host-pinned evaluate tier (win-amd64 shares MSVC
ucrtbase). Scalar-only in the fused kernel.
public static NDExpr Angle(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the element-wise phase angle of
xin radians.
Any(NDExpr)
One-pass fused np.any: True iff any element of the expression is truthy
(nonzero). Result is bool and the identity is False, so Any of an EMPTY
input is False — unlike Max(NDExpr), which raises on a zero-size input.
NaN is truthy (nan != 0), so Any([nan]) is True, matching NumPy.
public static NDExpr Any(NDExpr x)
Parameters
xNDExpr
Returns
Any(NDExpr, bool)
One-pass fused np.any(x, axis=None, keepdims=True) — the whole-array presence test kept as shape (1,…,1) (bool).
public static NDExpr Any(NDExpr x, bool keepdims)
Parameters
Returns
Any(NDExpr, int, bool)
One-pass fused np.any along axis (bool result; identity False).
public static NDExpr Any(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
AppendSignature(StringBuilder)
Stable structural signature. Used to derive a cache key when the user doesn't supply one.
public abstract void AppendSignature(StringBuilder sb)
Parameters
ArgMax(NDExpr)
One-pass fused np.argmax: the int64 index of the maximum element of the
expression (flattened). Ties break to the FIRST occurrence and a NaN is treated as the
largest value (so the first NaN's index wins), matching NumPy over the C-order materialized
child. A zero-size input raises (no identity), like Max(NDExpr).
public static NDExpr ArgMax(NDExpr x)
Parameters
xNDExpr
Returns
ArgMax(NDExpr, bool)
One-pass fused np.argmax(x, axis=None, keepdims=True) — the flat int64 index of the maximum kept as shape (1,…,1) (first-tie / first-NaN wins).
public static NDExpr ArgMax(NDExpr x, bool keepdims)
Parameters
Returns
ArgMax(NDExpr, int, bool)
One-pass fused np.argmax along axis (int64 indices; first-tie / first-NaN wins).
public static NDExpr ArgMax(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
ArgMin(NDExpr)
One-pass fused np.argmin: the int64 index of the minimum element of the
expression (flattened) — the ArgMax(NDExpr) twin (first-tie / first-NaN wins).
public static NDExpr ArgMin(NDExpr x)
Parameters
xNDExpr
Returns
ArgMin(NDExpr, bool)
One-pass fused np.argmin(x, axis=None, keepdims=True) — the flat int64 index of the minimum kept as shape (1,…,1) (first-tie / first-NaN wins).
public static NDExpr ArgMin(NDExpr x, bool keepdims)
Parameters
Returns
ArgMin(NDExpr, int, bool)
One-pass fused np.argmin along axis (int64 indices; first-tie / first-NaN wins).
public static NDExpr ArgMin(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Arr(NDArray)
Embed an NDArray directly as an expression leaf. np.evaluate binds every distinct array (by reference) to one iterator operand.
public static NDExpr Arr(NDArray array)
Parameters
arrayNDArray
Returns
Asinh(NDExpr)
public static NDExpr Asinh(NDExpr x)
Parameters
xNDExpr
Returns
Atanh(NDExpr)
public static NDExpr Atanh(NDExpr x)
Parameters
xNDExpr
Returns
Average(NDExpr, NDExpr)
One-pass fused np.average: the weighted mean Σ(values·weights) / Σ(weights) of
two expression trees (flattened). The two trees BROADCAST together like any fused binary, and
the result matches np.average(V, weights=W) on same-shape operands. The result dtype is
float/complex (NumPy's rule, keyed on the VALUES dtype: an integer/bool values tree
promotes to result_type(values, weights, float64), else result_type(values,
weights)) — so an integer average is always at least float64, and the product/sums run at
that dtype (no integer wrap). A NaN in either tree PROPAGATES to NaN. Weights that sum to zero
(an empty input included) raise DivideByZeroException "Weights sum to zero, can't
be normalized", exactly as average(NDArray, NDAxis?, NDArray, bool, bool) does. A
float16 or decimal result dtype is rejected with a directed NotSupportedException
(a bit-exact reduction there needs a pairwise sum kernel that dtype lacks).
public static NDExpr Average(NDExpr values, NDExpr weights)
Parameters
valuesNDExprThe value expression to average.
weightsNDExprThe weight expression; each value is weighted by the aligned weight, and the sum is normalized by the total weight.
Returns
- NDExpr
The fused weighted-average node (root-only, like every reduction).
Average(NDExpr, NDExpr, bool)
One-pass fused np.average(values, weights=weights, axis=None, keepdims=True) — the whole-array weighted mean kept as shape (1,…,1).
public static NDExpr Average(NDExpr values, NDExpr weights, bool keepdims)
Parameters
valuesNDExprThe value expression to average.
weightsNDExprThe weight expression aligned with
values.keepdimsboolKept for API shape; a flat weighted average kept as size-1 everywhere.
Returns
- NDExpr
The fused weighted-average node reducing the whole array, result kept as shape (1,…,1).
Average(NDExpr, NDExpr, int, bool)
One-pass fused np.average along axis: Σ(values·weights) /
Σ(weights) reduced over a single axis (the Average(NDExpr, NDExpr) twin — same
result dtype, NaN propagation, and zero-weight DivideByZeroException). Both sums
reduce along axis; keepdims re-inserts it as size 1.
public static NDExpr Average(NDExpr values, NDExpr weights, int axis, bool keepdims = false)
Parameters
valuesNDExprThe value expression to average.
weightsNDExprThe weight expression aligned with
values.axisintThe axis to reduce (negative counts from the end).
keepdimsboolWhen true, the reduced axis is kept as a size-1 dimension.
Returns
- NDExpr
The fused weighted-average node reducing along
axis.
Between(NDExpr, NDExpr, NDExpr)
Inclusive range test: true where lo <= x <= hi.
public static NDExpr Between(NDExpr x, NDExpr lo, NDExpr hi)
Parameters
Returns
- NDExpr
A fused logical-and of the two comparisons.
BitwiseAnd(NDExpr, NDExpr)
public static NDExpr BitwiseAnd(NDExpr a, NDExpr b)
Parameters
Returns
BitwiseCount(NDExpr)
Population count of the absolute value — the number of set bits in |x| (np.bitwise_count).
INTEGER/BOOL ONLY: every integer/bool/char dtype maps to a uint8 result, while
float/float16/complex/decimal have NO loop and throw at typing. It CONSUMES the input dtype
(a wide value is counted at its own width, never truncated to the uint8 output first) and a
signed negative counts the magnitude (bitwise_count(-1) == 1, not 8). Scalar-only in
the fused kernel.
public static NDExpr BitwiseCount(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the per-element set-bit count of
|x|as uint8.
BitwiseNot(NDExpr)
public static NDExpr BitwiseNot(NDExpr x)
Parameters
xNDExpr
Returns
BitwiseOr(NDExpr, NDExpr)
public static NDExpr BitwiseOr(NDExpr a, NDExpr b)
Parameters
Returns
BitwiseXor(NDExpr, NDExpr)
public static NDExpr BitwiseXor(NDExpr a, NDExpr b)
Parameters
Returns
Bucketize(NDExpr, params NDExpr[])
Bucket index (np.digitize, right-open, ascending edges): the count of edges
that x meets or exceeds, in [0, edges.Length]. Sums INTEGER
Where(x>=e, 1, 0) values — a bool sum would be logical OR, not a count.
public static NDExpr Bucketize(NDExpr x, params NDExpr[] edges)
Parameters
Returns
- NDExpr
A fused integer-accumulating node.
Exceptions
- ArgumentNullException
xis null, oredgesholds a null.
Call(Delegate, params NDExpr[])
Invoke any delegate. Method-group arguments need a typed Func overload; use a cast or the typed overloads below.
public static NDExpr Call(Delegate func, params NDExpr[] args)
Parameters
Returns
Call(MethodInfo, params NDExpr[])
Invoke a static method (no target).
public static NDExpr Call(MethodInfo method, params NDExpr[] args)
Parameters
methodMethodInfoargsNDExpr[]
Returns
Call(MethodInfo, object, params NDExpr[])
Invoke an instance method on a target object.
public static NDExpr Call(MethodInfo method, object target, params NDExpr[] args)
Parameters
methodMethodInfotargetobjectargsNDExpr[]
Returns
Call<TR>(Func<TR>)
public static NDExpr Call<TR>(Func<TR> func)
Parameters
funcFunc<TR>
Returns
Type Parameters
TR
Call<T1, TR>(Func<T1, TR>, NDExpr)
public static NDExpr Call<T1, TR>(Func<T1, TR> func, NDExpr a1)
Parameters
Returns
Type Parameters
T1TR
Call<T1, T2, TR>(Func<T1, T2, TR>, NDExpr, NDExpr)
public static NDExpr Call<T1, T2, TR>(Func<T1, T2, TR> func, NDExpr a1, NDExpr a2)
Parameters
Returns
Type Parameters
T1T2TR
Call<T1, T2, T3, TR>(Func<T1, T2, T3, TR>, NDExpr, NDExpr, NDExpr)
public static NDExpr Call<T1, T2, T3, TR>(Func<T1, T2, T3, TR> func, NDExpr a1, NDExpr a2, NDExpr a3)
Parameters
Returns
Type Parameters
T1T2T3TR
Call<T1, T2, T3, T4, TR>(Func<T1, T2, T3, T4, TR>, NDExpr, NDExpr, NDExpr, NDExpr)
public static NDExpr Call<T1, T2, T3, T4, TR>(Func<T1, T2, T3, T4, TR> func, NDExpr a1, NDExpr a2, NDExpr a3, NDExpr a4)
Parameters
Returns
Type Parameters
T1T2T3T4TR
Cast(NDExpr, DType)
Convert to dtype (np.ndarray.astype with the default casting='unsafe') —
the fused analog of expr.astype(dtype). Computes x at its own dtype,
then converts each element to dtype with the SAME per-element conversion the
engine's own casts use, so the RESULT dtype is exactly dtype regardless of the
child. Every conversion is allowed (float→int TRUNCATES toward zero, over/underflow WRAPS, a
complex→real cast drops the imaginary part), matching NumPy's default-unsafe astype. Cast is the
building block for Round(decimals) (which must cast a float round back to an integer dtype).
public static NDExpr Cast(NDExpr x, DType dtype)
Parameters
xNDExprThe operand to convert.
dtypeDTypeThe target dtype: any of the 15 NumSharp types, or a text descriptor (
S/Uof a width, or StringDType with its NA object).
Returns
- NDExpr
An expression node evaluating
xconverted todtype.
Remarks
One overload takes every dtype spelling through DType's conversions: an
NPTypeCode (NDExpr.Cast(x, NPTypeCode.Single)), a Type
(NDExpr.Cast(x, typeof(float))), a dtype string ("float32", "U5", "S3") or a
DType itself (np.dtypes.StringDType()). A TEXT target is a whole descriptor — the class
(S, U, StringDType) and the width or NA object — which the storage lane
String alone does not carry, so NPTypeCode.String is refused by the conversion
itself (NotSupportedException) and a text cast names its descriptor.
A cast whose operand or target is TEXT never enters the fused kernel: it is NumPy's own
x.astype(dtype) run as a stage (docs/plans/evaluate-text.md) — a number formatted as text
(int64 → <U21, a narrower width cuts it), text parsed into a number (NumPy's int(str) /
float(str), its errors included) or text recast between classes and widths.
Scalar-only in the fused kernel for now: a tree containing a numeric Cast runs scalar
end-to-end (the SIMD-widening cast lanes are Phase 5). Parity envelope: bit-exact vs
NumPy's astype for IN-RANGE, non-NaN conversions; the C-undefined edges (NaN/±inf/
out-of-range → integer, complex→real) inherit the engine's own documented cast behaviour
(host-dependent, the astype_full class), not a distinct guarantee.
Exceptions
- ArgumentNullException
xordtypeis null.- NotSupportedException
The dtype was spelled as String, a storage lane without a text class or width (raised by the conversion to DType).
Cbrt(NDExpr)
public static NDExpr Cbrt(NDExpr x)
Parameters
xNDExpr
Returns
Ceil(NDExpr)
public static NDExpr Ceil(NDExpr x)
Parameters
xNDExpr
Returns
Clamp(NDExpr, NDExpr, NDExpr)
public static NDExpr Clamp(NDExpr x, NDExpr lo, NDExpr hi)
Parameters
Returns
ClampMax(NDExpr, NDExpr)
Upper clamp: min(x, hi). NaN in x propagates.
public static NDExpr ClampMax(NDExpr x, NDExpr hi)
Parameters
Returns
- NDExpr
A fused np.minimum node.
ClampMin(NDExpr, NDExpr)
Lower clamp: max(x, lo). NaN in x propagates (np.maximum semantics).
public static NDExpr ClampMin(NDExpr x, NDExpr lo)
Parameters
Returns
- NDExpr
A fused np.maximum node.
Clip(NDExpr, NDExpr, NDExpr)
Clip (limit) the values of x to a range (np.clip). Either bound may be
null (NumPy's None): a one-sided clip lowers to the NaN-propagating
Max(NDExpr, NDExpr)/Min(NDExpr, NDExpr) (np.clip(x, lo, None) ≡ np.maximum(x, lo),
np.clip(x, None, hi) ≡ np.minimum(x, hi)), and a two-sided clip to the exact general clip ufunc
_NPY_MIN(_NPY_MAX(x, lo), hi): two min/max nodes flagged as clip halves, which equal
Clamp(NDExpr, NDExpr, NDExpr) (Min(Max(x, lo), hi)) for every dtype but complex128, where clip's selection is
strict (a tie takes the bound) and tests only the running value for NaN. Result dtype is
result_type(x, lo, hi).
public static NDExpr Clip(NDExpr x, NDExpr lo, NDExpr hi)
Parameters
xNDExprThe values to clip.
loNDExprLower bound, or
nullfor no lower bound.hiNDExprUpper bound, or
nullfor no upper bound.
Returns
- NDExpr
An expression node clipping
xto[lo, hi].
Remarks
Bit-exact with NumPy 2.4.2 for one-sided clips and for two-sided clips with ARRAY bounds. A
two-sided clip with SCALAR (0-d) bounds differs from NumPy ONLY in the pathological
signed-zero-exactly-at-a-finite-bound corner (e.g. clip(-0.0, -inf, +0.0)): NumPy's
const-scalar fast path returns -0.0 while the general min(max) path — which NumSharp
always takes — returns +0.0; NaN-sign-of-bound corners are float-NaN differences the
oracle tokenizes.
Exceptions
- ArgumentNullException
xis null.- ArgumentException
Both bounds are null (NumPy "One of max or min must be given").
Cmp(NDExpr, NDExpr)
Three-way comparator: -1 if a < b, 0 if equal, +1 if a > b (the classic sort comparator).
public static NDExpr Cmp(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused node yielding -1/0/1.
Coalesce(NDExpr, NDExpr)
First finite: a where it is finite (neither NaN nor ±inf), else
b — a robustness fallback stronger than a NaN-only replace.
public static NDExpr Coalesce(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused select on
isfinite(a).
Compile()
Compile this tree ahead of its first evaluation (NumSharp extension; numexpr's
NumExpr(expr) object). The tree must reference its arrays directly
(Arr(NDArray) / implicit conversion): binding, the NumPy typing pass and the
kernel JIT (~1 ms for a new tree shape) run here, and every
Evaluate(NDArray) afterwards does only the per-call
work — the iteration shape, the result allocation and the iterator (~0.4 µs at n = 8).
np.evaluate(expr) reaches the same cached program implicitly — on this root's
second call, or on any root of the same structure through the global structural cache;
the handle makes the compile step explicit and hoistable. A 0-d array leaf is compiled
as a hoisted parameter (read per evaluation, never streamed).
A positional tree (Input(int) leaves) compiles with
Compile(params NPTypeCode[]), which pins its operand dtypes.
public CompiledExpression Compile()
Returns
- CompiledExpression
The handle over this root's program and its input list.
Exceptions
- InvalidOperationException
The tree has no array leaves.
Compile(params NPTypeCode[])
Compile a positional tree (Input(int) leaves) for one operand dtype signature —
inputTypes[i] is the dtype Input(i) will be evaluated against. The handle's
Evaluate(NDArray[], NDArray) requires exactly that signature
(a different one is a TypeError, never a silent recompile), so a hot loop
pays no per-call typing. Every operand streams through the iterator (a 0-d operand is a
stride-0 stream, not a hoisted parameter — the handle knows dtypes, not shapes).
Not the Tier-3C Compile(NPTypeCode[], NPTypeCode, string?),
which emits a raw inner-loop kernel computed entirely at ONE output dtype; this one types
every node with NumPy's result_type, exactly as np.evaluate does.
public CompiledExpression Compile(params NPTypeCode[] inputTypes)
Parameters
inputTypesNPTypeCode[]The dtype of each positional operand.
Returns
- CompiledExpression
The handle over the program compiled for that signature.
Exceptions
- ArgumentNullException
inputTypesis null.- ArgumentException
The signature is empty or names a non-storage dtype, or the tree embeds arrays (mixed binding styles).
- NotSupportedException
A reduction sits below the root, or nests another.
Compile(NPTypeCode[], NPTypeCode, string?)
Compile the tree to an NDInnerLoopFunc.
public NDInnerLoopFunc Compile(NPTypeCode[] inputTypes, NPTypeCode outputType, string? cacheKey)
Parameters
inputTypesNPTypeCode[]outputTypeNPTypeCodecacheKeystring
Returns
CompileNumPy(NPTypeCode[], out NPTypeCode, string?)
Compile the tree with NumPy 2.x result_type semantics: every node
computes at its own NEP50-resolved dtype, conversions happen at
node edges, and the kernel reads each operand at its NATIVE dtype
(no iterator-side casting needed). resolvedType
receives the tree's result dtype — the output operand's dtype.
SIMD engages iff the whole tree resolves to one SIMD-capable dtype.
public NDInnerLoopFunc CompileNumPy(NPTypeCode[] inputTypes, out NPTypeCode resolvedType, string? cacheKey = null)
Parameters
inputTypesNPTypeCode[]resolvedTypeNPTypeCodecacheKeystring
Returns
Conj(NDExpr)
NumPy alias of Conjugate(NDExpr) (np.conj). Identical node, cost and dtype.
public static NDExpr Conj(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the element-wise complex conjugate of
x.
Conjugate(NDExpr)
Complex conjugate (np.conjugate). For Complex it flips the sign of the imaginary part; for
every REAL float/int dtype it is the identity (dtype preserved) — with ONE NumPy quirk: a
bool child promotes to int8 (probed 2.4.2: np.conjugate(bool_).dtype ==
int8), it does not stay bool. Scalar-only in the fused kernel (the complex path has no
SIMD lane), so a tree containing it runs scalar end-to-end.
public static NDExpr Conjugate(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the element-wise complex conjugate of
x.
Const(bool)
public static NDExpr Const(bool value)
Parameters
valuebool
Returns
Const(char)
public static NDExpr Const(char value)
Parameters
valuechar
Returns
Const(decimal)
public static NDExpr Const(decimal value)
Parameters
valuedecimal
Returns
Const(double)
A literal. NEP50 kind follows the CLR type (see NumSharp.Backends.Iteration.NDExprLiteralKind): the
numeric primitives, bool and Complex are WEAK Python literals that adopt the
dtype of the array they meet (i4 + 2 → i4, f2 + 2.5 → f2, u8 + 2^64-1 → u8);
Half, decimal and char are STRONG and promote like a 0-d array of their dtype.
public static NDExpr Const(double value)
Parameters
valuedouble
Returns
Const(Half)
public static NDExpr Const(Half value)
Parameters
valueHalf
Returns
Const(int)
public static NDExpr Const(int value)
Parameters
valueint
Returns
Const(long)
public static NDExpr Const(long value)
Parameters
valuelong
Returns
Const(Complex)
public static NDExpr Const(Complex value)
Parameters
valueComplex
Returns
Const(float)
public static NDExpr Const(float value)
Parameters
valuefloat
Returns
Const(uint)
public static NDExpr Const(uint value)
Parameters
valueuint
Returns
Const(ulong)
public static NDExpr Const(ulong value)
Parameters
valueulong
Returns
CopySign(NDExpr, NDExpr)
Magnitude of a with the sign of b (np.copysign) — an
EXACT sign-bit copy, so CopySign(3, -0.0) is -3 and the sign of ±0/±NaN is
honoured bit-for-bit. Float-only ufunc: bool/int operands PROMOTE to their tier float
(bool/i8/u8→f16, i16/u16→f32, i32+→f64, chosen per input like arctan2), and a complex
operand has no loop (throws at typing time).
public static NDExpr CopySign(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the copysign.
Cos(NDExpr)
public static NDExpr Cos(NDExpr x)
Parameters
xNDExpr
Returns
Cosh(NDExpr)
public static NDExpr Cosh(NDExpr x)
Parameters
xNDExpr
Returns
Count(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.count(a, sub, start=0, end=None) as an expression node: for each element, the number
of non-overlapping occurrences of sub inside a[start:end]; an int64 result.
public static NDExpr Count(NDExpr a, NDExpr sub, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe searched strings.
subNDExprThe substrings (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, an int64 stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr).
Exceptions
- ArgumentNullException
aorsubis null.
CountNonzero(NDExpr)
One-pass fused np.count_nonzero: the int64 count of truthy (nonzero) elements. Composed
as Sum(x != 0) — a sum over the bool nonzero-test — so the result is int64 (NumPy's
intp) at every child dtype, and an empty input counts to 0.
public static NDExpr CountNonzero(NDExpr x)
Parameters
xNDExpr
Returns
CountNonzero(NDExpr, bool)
One-pass fused np.count_nonzero(x, axis=None, keepdims=True) — the whole-array nonzero count kept as shape (1,…,1) (int64).
public static NDExpr CountNonzero(NDExpr x, bool keepdims)
Parameters
Returns
CountNonzero(NDExpr, int, bool)
One-pass fused np.count_nonzero along axis (int64 count).
public static NDExpr CountNonzero(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Deg2Rad(NDExpr)
public static NDExpr Deg2Rad(NDExpr x)
Parameters
xNDExpr
Returns
Divide(NDExpr, NDExpr)
public static NDExpr Divide(NDExpr a, NDExpr b)
Parameters
Returns
Elu(NDExpr, NDExpr)
Exponential linear unit: x where x > 0, else alpha*(exp(x)-1). Spelled
with Exp(NDExpr)-then-minus-one rather than expm1 ON PURPOSE — expm1 has no
SIMD kernel, so an expm1 node forces the WHOLE tree onto the per-element scalar path;
Exp(NDExpr) vectorizes (float32), so this whole activation SIMD-izes. The cost is a bounded
precision loss on the negative branch near x = 0 (exp(x)-1 cancels where the output
is already ≈ x, so the ABSOLUTE error stays ~ulp) — the standard NN tradeoff.
public static NDExpr Elu(NDExpr x, NDExpr alpha)
Parameters
Returns
- NDExpr
A fused, vectorizable select over Exp(NDExpr).
EmitScalar(ILGenerator, NDExprCompileContext)
Emit scalar code. On exit, the evaluation stack must have exactly
one value of dtype ctx.OutputType.
public abstract void EmitScalar(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorctxNDExprCompileContext
EmitVector(ILGenerator, NDExprCompileContext)
Emit vector code. On exit, the evaluation stack must have exactly
one Vector{W}<T> of element type ctx.OutputType.
Called only when SupportsSimd is true and all input
types equal the output type.
public abstract void EmitVector(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorctxNDExprCompileContext
EndsWith(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.endswith(a, suffix, start=0, end=None) as an expression node: True where
a[start:end] ends with suffix; a bool result.
public static NDExpr EndsWith(NDExpr a, NDExpr suffix, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe strings.
suffixNDExprThe suffixes, of
a's class (see Find(NDExpr, NDExpr, NDExpr, NDExpr)'ssub).startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, a bool stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr) (a StringDType NA that is neither NaN-like nor a
string raises ValueError).
Exceptions
- ArgumentNullException
aorsuffixis null.
Equal(NDExpr, NDExpr)
public static NDExpr Equal(NDExpr a, NDExpr b)
Parameters
Returns
Exp(NDExpr)
public static NDExpr Exp(NDExpr x)
Parameters
xNDExpr
Returns
Exp2(NDExpr)
public static NDExpr Exp2(NDExpr x)
Parameters
xNDExpr
Returns
Expm1(NDExpr)
public static NDExpr Expm1(NDExpr x)
Parameters
xNDExpr
Returns
FMax(NDExpr, NDExpr)
NaN-IGNORING element-wise maximum (np.fmax): when exactly one operand is NaN the OTHER (the number) is returned — the opposite of Maximum(NDExpr, NDExpr)/Max(NDExpr, NDExpr), which propagate NaN. Dtype-preserving (plain result_type promotion, like maximum). Scalar-only in the fused kernel (no SIMD lane), so a tree containing it runs scalar end-to-end.
public static NDExpr FMax(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the NaN-ignoring maximum.
FMin(NDExpr, NDExpr)
NaN-IGNORING element-wise minimum (np.fmin): the non-NaN operand wins. See FMax(NDExpr, NDExpr).
public static NDExpr FMin(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the NaN-ignoring minimum.
Fabs(NDExpr)
Float-only absolute value (np.fabs). Differs from Abs(NDExpr) in two dtype-level ways:
it PROMOTES bool/int to the tier float (bool/int8/uint8→float16, int16/uint16→float32,
int32+→float64; floats/decimal preserved) — so Fabs(int) is always a float where
Abs(int) preserves int — and it has NO COMPLEX loop (a complex child throws at typing
with NumPy's coercion TypeError). The operation itself is Abs(NDExpr)'s (clear the IEEE
sign bit), applied AFTER the int→float promotion, so Fabs(int.MinValue) is the exact
float magnitude, never the wrapped integer abs.
public static NDExpr Fabs(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the float-valued absolute value of
x.
Find(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.find(a, sub, start=0, end=None) as an expression node: for each element, the lowest
index where sub occurs inside a[start:end], or -1; an int64 result. Indices are
characters (code points for U / StringDType).
public static NDExpr Find(NDExpr a, NDExpr sub, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe searched strings (an
S,UorStringDTypeleaf, or a C#string).subNDExprThe substrings, of
a's class (a C#stringisstr, so anSaneeds a 0-dSarray).startNDExprThe range start in slice notation (negative counts from the end): an integer literal, array or sub-expression; null is NumPy's default
0.endNDExprThe range end in slice notation; null is NumPy's
None(the whole string).
Returns
- NDExpr
The node; evaluating it runs the engine's own
findfirst (a stage), after evaluating any computedstart/endas NumPy's unfused sequence would (into a temporary).
Remarks
Raised at evaluation, as NumPy raises them: TypeError when no loop takes the operand classes
(an S array with a str substring, a number as a) or when two
StringDType operands carry different NA objects; ArgumentException for a
start / end that cannot reach int64 by a same_kind cast (a float);
IncorrectShapeException when the four operands do not broadcast; ValueError for
a StringDType NA whose NA object is not a string.
Exceptions
- ArgumentNullException
aorsubis null.
Floor(NDExpr)
public static NDExpr Floor(NDExpr x)
Parameters
xNDExpr
Returns
FloorDivide(NDExpr, NDExpr)
public static NDExpr FloorDivide(NDExpr a, NDExpr b)
Parameters
Returns
Fmod(NDExpr, NDExpr)
C-style floating remainder (np.fmod): the result takes the sign of the DIVIDEND
(a), unlike Mod(NDExpr, NDExpr) which is floored and takes the divisor's
sign — so Fmod(-7,3) == -1 where Mod(-7,3) == 2. Promotion follows Mod:
integer stays integer, a bool pair falls to the int8 loop; there is NO complex loop, so a
complex operand throws a no-loop NotSupportedException at typing time.
public static NDExpr Fmod(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the truncated remainder.
Gcd(NDExpr, NDExpr)
Greatest common divisor of |a| and |b| (np.gcd). INTEGER-ONLY: valid only when the two
operands promote to a real integer dtype (a bool paired with an integer is fine, but a
bool/bool pair, any float/complex/decimal, and the uint64+signed pair — which promotes to
float64 — all have NO loop and throw a "did not contain a loop" NotSupportedException
at typing time). The result can be NEGATIVE where the magnitude wraps the signed range
(Gcd(int8 -128, -128) == -128); Gcd(0,0) == 0. Scalar-only in the fused kernel.
public static NDExpr Gcd(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the GCD.
Gelu(NDExpr)
GELU, the tanh approximation: 0.5·x·(1 + tanh(√(2/π)·(x + 0.044715·x³))) (the form
used by GPT/BERT; the exact erf form waits for an Erf node — capabilities §7).
public static NDExpr Gelu(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused tanh-approximation GELU node.
Greater(NDExpr, NDExpr)
public static NDExpr Greater(NDExpr a, NDExpr b)
Parameters
Returns
GreaterEqual(NDExpr, NDExpr)
public static NDExpr GreaterEqual(NDExpr a, NDExpr b)
Parameters
Returns
HardSigmoid(NDExpr)
Hard sigmoid (PyTorch/Keras piecewise-linear approx): clip(x/6 + 0.5, 0, 1).
public static NDExpr HardSigmoid(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused clamp of the affine map.
Heaviside(NDExpr, NDExpr)
The Heaviside step function (np.heaviside): 0 if x<0,
h0 if x==0, 1 if x>0, and
the positive canonical NaN if x is NaN. NOT commutative — x
selects the branch and h0 is ONLY the exact-zero fill (its bits, NaN sign
included, pass through). Same float-tier promotion as CopySign(NDExpr, NDExpr); complex has no
loop. Bit-exact with NumPy at every supported dtype.
public static NDExpr Heaviside(NDExpr x, NDExpr h0)
Parameters
xNDExprThe value whose sign selects the step branch.
h0NDExprThe fill returned where
xis exactly zero.
Returns
- NDExpr
An expression node computing the Heaviside step.
Hypot(NDExpr, NDExpr)
sqrt(a2 + b2) without spurious overflow/underflow (np.hypot). Same float-tier
promotion as CopySign(NDExpr, NDExpr) (complex has no loop). Bit-exact with NumPy at every float
dtype: the node runs np.hypot's own kernel, UCRT's faithfully rounded sqrt(aa + bb) with
its power-of-two rescale (parity QA-25), so float64 matches NumPy byte for byte too.
public static NDExpr Hypot(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the hypotenuse.
If(NDExpr, NDExpr, NDExpr)
Inlined ternary: a where cond is nonzero, else
b (== cond ? a : b, per element). An alias of
Where(NDExpr, NDExpr, NDExpr) spelled as an if — the readable name for the most common selector.
public static NDExpr If(NDExpr cond, NDExpr a, NDExpr b)
Parameters
condNDExprSelector; any nonzero value is "true" (NumPy nonzero-test at the condition's own dtype).
aNDExprValue chosen where
condis true.bNDExprValue chosen where
condis false.
Returns
- NDExpr
A fused select node; its dtype is
result_type(a, b).
IfNot(NDExpr, NDExpr, NDExpr)
Negated ternary: a where cond is FALSE, else
b. Swaps the arms rather than negating the condition, so it costs no
extra node over If(NDExpr, NDExpr, NDExpr).
public static NDExpr IfNot(NDExpr cond, NDExpr a, NDExpr b)
Parameters
condNDExprSelector; nonzero is "true".
aNDExprValue chosen where
condis false.bNDExprValue chosen where
condis true.
Returns
- NDExpr
A fused select node equivalent to
If(!cond, a, b).
Imag(NDExpr)
Imaginary part (np.imag) — the complex→real component extractor. A COMPLEX child yields its
imaginary lane as float64; every REAL child yields zero with its dtype PRESERVED
(the imaginary part of a real number is zero, so Imag(int32) is int32 zeros) — and the
child's VALUE is not read on that path (the result does not depend on it), matching np.imag's
zeros_like. Scalar-only in the fused kernel.
public static NDExpr Imag(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the element-wise imaginary part of
x.
Implies(NDExpr, NDExpr)
Material implication a ⇒ b == !a | b (false only where a is true and b is false).
public static NDExpr Implies(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused bool node.
Index(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.index(a, sub, start=0, end=None) as an expression node: Find(NDExpr, NDExpr, NDExpr, NDExpr), but an
element without a match raises ValueError (substring not found) for the whole evaluation.
public static NDExpr Index(NDExpr a, NDExpr sub, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe searched strings.
subNDExprThe substrings (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, an int64 stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr) and ValueError when any element has no match.
Exceptions
- ArgumentNullException
aorsubis null.
Input(int)
Reference the i-th operand of the iterator (0-based input index).
public static NDExpr Input(int index)
Parameters
indexint
Returns
IsAlnum(NDExpr)
NumPy's np.strings.isalnum(x) as an expression node: True where every character is alphanumeric
and there is at least one.
public static NDExpr IsAlnum(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsAlpha(NDExpr)
NumPy's np.strings.isalpha(x) as an expression node: True where every character is alphabetic and
there is at least one (CPython 3.12's Unicode tables for U / StringDType, ASCII for S).
public static NDExpr IsAlpha(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x(see StrLen(NDExpr)).
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string (NumPy's texts).
Exceptions
- ArgumentNullException
xis null.
IsClose(NDExpr, NDExpr, NDExpr, NDExpr)
Approximate equality, the np.isclose relation with equal_nan=False:
|a-b| <= atol + rtol·|b| for finite operands, and exact equality otherwise (so
inf is close to inf, NaN is close to nothing). Asymmetric in b, like NumPy.
public static NDExpr IsClose(NDExpr a, NDExpr b, NDExpr rtol, NDExpr atol)
Parameters
aNDExprFirst value.
bNDExprReference value (the rtol scale).
rtolNDExprRelative tolerance.
atolNDExprAbsolute tolerance.
Returns
- NDExpr
A fused bool node.
IsDecimal(NDExpr)
NumPy's np.strings.isdecimal(x) as an expression node: True where every character is a decimal
character and there is at least one. U and StringDType only.
public static NDExpr IsDecimal(NDExpr x)
Parameters
xNDExprThe strings (a
UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for an S or non-text x (NumPy has no
bytes loop: ufunc 'isdecimal' did not contain a loop ... BytesDType); ValueError for a
StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsDigit(NDExpr)
NumPy's np.strings.isdigit(x) as an expression node: True where every character is a digit and
there is at least one.
public static NDExpr IsDigit(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsFinite(NDExpr)
public static NDExpr IsFinite(NDExpr x)
Parameters
xNDExpr
Returns
IsInf(NDExpr)
public static NDExpr IsInf(NDExpr x)
Parameters
xNDExpr
Returns
IsInteger(NDExpr)
Integral value: floor(x) == x (NaN is never equal → false; ±inf → false, since floor(inf) is inf and inf==inf, so document: ±inf reads as integral — matches np.floor(x)==x).
public static NDExpr IsInteger(NDExpr x)
Parameters
xNDExprValue tested.
Returns
- NDExpr
A fused bool node.
IsLower(NDExpr)
NumPy's np.strings.islower(x) as an expression node: True where every cased character is
lowercase and there is at least one cased character.
public static NDExpr IsLower(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsNaN(NDExpr)
public static NDExpr IsNaN(NDExpr x)
Parameters
xNDExpr
Returns
IsNegInf(NDExpr)
Test for negative infinity (np.isneginf) — result is bool, True only where x == -inf.
See IsPosInf(NDExpr) for the integer/bool (all-False) and complex (ambiguity TypeError)
behavior. Scalar-only in the fused kernel.
public static NDExpr IsNegInf(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node evaluating True where
xis negative infinity.
IsNegative(NDExpr)
Strictly negative: x < 0.
public static NDExpr IsNegative(NDExpr x)
Parameters
xNDExprValue tested.
Returns
- NDExpr
A fused bool node.
IsNumeric(NDExpr)
NumPy's np.strings.isnumeric(x) as an expression node: True where every character is numeric and
there is at least one. U and StringDType only.
public static NDExpr IsNumeric(NDExpr x)
Parameters
xNDExprThe strings (a
UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for an S or non-text x (no bytes loop);
ValueError for a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsPosInf(NDExpr)
Test for positive infinity (np.isposinf) — result is bool, True only where x == +inf.
Integer/bool inputs are all-False (no infinity). A COMPLEX child throws at typing with NumPy's
ambiguity TypeError ("…not supported for complex128 values because it would be ambiguous.") —
a DIFFERENT message from the ufunc no-loop family, because isposinf is a FUNCTION, not a ufunc.
Scalar-only in the fused kernel.
public static NDExpr IsPosInf(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node evaluating True where
xis positive infinity.
IsPositive(NDExpr)
Strictly positive: x > 0.
public static NDExpr IsPositive(NDExpr x)
Parameters
xNDExprValue tested.
Returns
- NDExpr
A fused bool node.
IsSpace(NDExpr)
NumPy's np.strings.isspace(x) as an expression node: True where every character is whitespace and
there is at least one.
public static NDExpr IsSpace(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsTitle(NDExpr)
NumPy's np.strings.istitle(x) as an expression node: True where the string is titlecased
(uppercase characters only after uncased ones, lowercase only after cased ones) and has a cased character.
public static NDExpr IsTitle(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
IsUpper(NDExpr)
NumPy's np.strings.isupper(x) as an expression node: True where every cased character is
uppercase and there is at least one cased character.
public static NDExpr IsUpper(NDExpr x)
Parameters
xNDExprThe strings (an
S,UorStringDTypeleaf, or a C#string).
Returns
- NDExpr
The node, a bool stage over
x.
Remarks
At evaluation: TypeError for a non-text x; ValueError for
a StringDType NA that is not NaN-like or a string.
Exceptions
- ArgumentNullException
xis null.
Lcm(NDExpr, NDExpr)
Lowest common multiple of |a| and |b| (np.lcm): 0 if either is 0, else |a|/gcd*|b|
(divide-before-multiply, so the product WRAPS the dtype on overflow, matching NumPy).
Same INTEGER-ONLY loop coverage / no-loop errors as Gcd(NDExpr, NDExpr).
public static NDExpr Lcm(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the LCM.
LeakyRelu(NDExpr, NDExpr)
Leaky ReLU: x where x > 0, else slope*x.
public static NDExpr LeakyRelu(NDExpr x, NDExpr slope)
Parameters
Returns
- NDExpr
A fused select.
LeftShift(NDExpr, NDExpr)
Bit shift left (np.left_shift). Integer loops only: a bool pair falls to the int8 loop, an
integer pair keeps its promoted integer dtype, and float/complex — plus the uint64+signed
pair (which promotes to float64) — have NO loop and throw a "not supported for the input
types" NotSupportedException at typing time. A shift count outside
[0, bitwidth) follows NumPy's overflow rule at the result width. Scalar-only.
public static NDExpr LeftShift(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the left shift.
Lerp(NDExpr, NDExpr, NDExpr)
Linear interpolation a + (b-a)·t — pure arithmetic (fused, no branch); the natural companion to the selectors.
public static NDExpr Lerp(NDExpr a, NDExpr b, NDExpr t)
Parameters
Returns
- NDExpr
A fused arithmetic node.
Less(NDExpr, NDExpr)
public static NDExpr Less(NDExpr a, NDExpr b)
Parameters
Returns
LessEqual(NDExpr, NDExpr)
public static NDExpr LessEqual(NDExpr a, NDExpr b)
Parameters
Returns
Log(NDExpr)
public static NDExpr Log(NDExpr x)
Parameters
xNDExpr
Returns
Log10(NDExpr)
public static NDExpr Log10(NDExpr x)
Parameters
xNDExpr
Returns
Log1p(NDExpr)
public static NDExpr Log1p(NDExpr x)
Parameters
xNDExpr
Returns
Log2(NDExpr)
public static NDExpr Log2(NDExpr x)
Parameters
xNDExpr
Returns
LogAddExp(NDExpr, NDExpr)
Numerically stable log(exp(a)+exp(b)) (np.logaddexp). Same float-tier promotion as
CopySign(NDExpr, NDExpr) (complex has no loop). NOT bit-exact with NumPy — the managed fdlibm
log1p it composes over differs ≤2 ULP from NumPy's closed UCRT log1p (the same
documented ~ULP envelope as the unary transcendentals), so it is gated within 2 ULP, not
byte-for-byte.
public static NDExpr LogAddExp(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing logaddexp.
LogAddExp2(NDExpr, NDExpr)
Base-2 stable log-sum-exp log2(2a + 2b) (np.logaddexp2). See
LogAddExp(NDExpr, NDExpr) — ≤2 ULP vs NumPy (the extra LOG2E product), not bit-exact.
public static NDExpr LogAddExp2(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing logaddexp2.
LogicalAnd(NDExpr, NDExpr)
Element-wise logical AND (np.logical_and): the result is ALWAYS Boolean, formed by
nonzero-testing each operand at its OWN dtype — (a != 0) & (b != 0) — so it is
NOT the bitwise BitwiseAnd(NDExpr, NDExpr) (&). Every dtype is accepted, complex
included (a complex is truthy iff either component is nonzero); a NaN is truthy
(NaN != 0), and ±0 is falsy. Vectorizes on a SIMD lane (each operand becomes a
truthiness mask, combined by a vector AND).
public static NDExpr LogicalAnd(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A Boolean-typed expression node computing the logical AND.
LogicalNot(NDExpr)
public static NDExpr LogicalNot(NDExpr x)
Parameters
xNDExpr
Returns
LogicalOr(NDExpr, NDExpr)
Element-wise logical OR (np.logical_or) — (a != 0) | (b != 0), always Boolean. See
LogicalAnd(NDExpr, NDExpr) for the nonzero-test / dtype / NaN semantics; NOT the bitwise
BitwiseOr(NDExpr, NDExpr).
public static NDExpr LogicalOr(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A Boolean-typed expression node computing the logical OR.
LogicalXor(NDExpr, NDExpr)
Element-wise logical XOR (np.logical_xor) — (a != 0) ^ (b != 0), always Boolean. See
LogicalAnd(NDExpr, NDExpr); NOT the bitwise BitwiseXor(NDExpr, NDExpr).
public static NDExpr LogicalXor(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A Boolean-typed expression node computing the logical XOR.
Majority3(NDExpr, NDExpr, NDExpr)
Majority vote of three masks: true where at least two are true.
public static NDExpr Majority3(NDExpr a, NDExpr b, NDExpr c)
Parameters
Returns
- NDExpr
A fused bool node.
Max(NDExpr)
One-pass fused maximum of the expression (NaN-propagating, like np.max).
public static NDExpr Max(NDExpr x)
Parameters
xNDExpr
Returns
Max(NDExpr, NDExpr)
public static NDExpr Max(NDExpr a, NDExpr b)
Parameters
Returns
Max(NDExpr, bool)
One-pass fused np.max(x, axis=None, keepdims=True) — the whole-array maximum kept as shape (1,…,1) (NaN-propagating).
public static NDExpr Max(NDExpr x, bool keepdims)
Parameters
Returns
Max(NDExpr, int, bool)
One-pass fused maximum of the expression along axis (NaN-propagating).
public static NDExpr Max(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
MaxMagnitude(NDExpr, NDExpr)
The operand with the larger magnitude, ties keeping a — "keep the stronger signal".
public static NDExpr MaxMagnitude(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused select on
|a| >= |b|.
Maximum(NDExpr, NDExpr)
NaN-PROPAGATING element-wise maximum (np.maximum) — an exact alias of Max(NDExpr, NDExpr).
A NaN operand WINS (the result is NaN if either input is NaN); contrast FMax(NDExpr, NDExpr),
which ignores NaN. Provided so np.maximum ports verbatim; identical node, cost and
dtype to Max(NDExpr, NDExpr) (plain result_type promotion, complex compares lexicographically).
public static NDExpr Maximum(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the NaN-propagating maximum of
aandb.
Mean(NDExpr)
One-pass fused arithmetic mean of the expression (ints→float64, floats preserved).
public static NDExpr Mean(NDExpr x)
Parameters
xNDExpr
Returns
Mean(NDExpr, bool)
One-pass fused np.mean(x, axis=None, keepdims=True) — the whole-array mean kept as shape (1,…,1).
public static NDExpr Mean(NDExpr x, bool keepdims)
Parameters
Returns
Mean(NDExpr, int, bool)
One-pass fused arithmetic mean of the expression along axis.
public static NDExpr Mean(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Median3(NDExpr, NDExpr, NDExpr)
Median of three — the branch-free max(min(a,b), min(max(a,b), c)) (a robust 3-tap de-glitcher).
public static NDExpr Median3(NDExpr a, NDExpr b, NDExpr c)
Parameters
Returns
- NDExpr
A fused node yielding the middle value.
Min(NDExpr)
One-pass fused minimum of the expression (NaN-propagating, like np.min).
public static NDExpr Min(NDExpr x)
Parameters
xNDExpr
Returns
Min(NDExpr, NDExpr)
public static NDExpr Min(NDExpr a, NDExpr b)
Parameters
Returns
Min(NDExpr, bool)
One-pass fused np.min(x, axis=None, keepdims=True) — the whole-array minimum kept as shape (1,…,1) (NaN-propagating).
public static NDExpr Min(NDExpr x, bool keepdims)
Parameters
Returns
Min(NDExpr, int, bool)
One-pass fused minimum of the expression along axis (NaN-propagating).
public static NDExpr Min(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Minimum(NDExpr, NDExpr)
NaN-PROPAGATING element-wise minimum (np.minimum) — an exact alias of Min(NDExpr, NDExpr). A NaN operand WINS; contrast FMin(NDExpr, NDExpr). See Maximum(NDExpr, NDExpr).
public static NDExpr Minimum(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the NaN-propagating minimum of
aandb.
Mod(NDExpr, NDExpr)
public static NDExpr Mod(NDExpr a, NDExpr b)
Parameters
Returns
Multiply(NDExpr, NDExpr)
public static NDExpr Multiply(NDExpr a, NDExpr b)
Parameters
Returns
Mux(NDExpr, params NDExpr[])
Integer-indexed multiplexer: values[k] where index == k,
else 0. Nested selects with index 0 outermost; a non-integer index is
compared for equality at its own dtype (so 1.0 == 1 selects slot 1).
public static NDExpr Mux(NDExpr index, params NDExpr[] values)
Parameters
indexNDExprSelector compared for equality to 0, 1, 2, ….
valuesNDExpr[]Choices, one per index; an out-of-range index yields 0.
Returns
- NDExpr
A right-folded chain of fused selects.
Exceptions
- ArgumentNullException
indexis null, orvaluesholds a null.
NanMax(NDExpr)
One-pass fused np.nanmax: the maximum of the expression with NaNs ignored — the
NanMin(NDExpr) twin.
public static NDExpr NanMax(NDExpr x)
Parameters
xNDExpr
Returns
NanMax(NDExpr, bool)
One-pass fused np.nanmax(x, axis=None, keepdims=True) — the whole-array NaN-skipping maximum kept as shape (1,…,1).
public static NDExpr NanMax(NDExpr x, bool keepdims)
Parameters
Returns
NanMax(NDExpr, int, bool)
One-pass fused np.nanmax along axis (NaNs ignored; all-NaN slice → NaN).
public static NDExpr NanMax(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
NanMean(NDExpr)
One-pass fused np.nanmean: the arithmetic mean with NaNs skipped. Result dtype follows
Mean(NDExpr) (int/bool→float64, float16→float16, float32/float64 preserved,
complex128 preserved); an ALL-NaN input yields NaN, and an integer/bool child (no NaN) is
exactly Mean(NDExpr).
public static NDExpr NanMean(NDExpr x)
Parameters
xNDExpr
Returns
NanMean(NDExpr, bool)
One-pass fused np.nanmean(x, axis=None, keepdims=True) — the whole-array NaN-skipping mean kept as shape (1,…,1).
public static NDExpr NanMean(NDExpr x, bool keepdims)
Parameters
Returns
NanMean(NDExpr, int, bool)
One-pass fused np.nanmean along axis (NaNs skipped per slab).
public static NDExpr NanMean(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
NanMin(NDExpr)
One-pass fused np.nanmin: the minimum of the expression with NaNs ignored. On a
float/complex child NaNs are skipped (an ALL-NaN input yields NaN); on an integer/bool child —
which carries no NaN — it is exactly the plain minimum, preserving the child dtype. A zero-size
input raises (no identity), like Min(NDExpr).
public static NDExpr NanMin(NDExpr x)
Parameters
xNDExpr
Returns
NanMin(NDExpr, bool)
One-pass fused np.nanmin(x, axis=None, keepdims=True) — the whole-array NaN-skipping minimum kept as shape (1,…,1).
public static NDExpr NanMin(NDExpr x, bool keepdims)
Parameters
Returns
NanMin(NDExpr, int, bool)
One-pass fused np.nanmin along axis (NaNs ignored; all-NaN slice → NaN).
public static NDExpr NanMin(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
NanProd(NDExpr)
One-pass fused np.nanprod: the product with NaNs treated as 1. Composed as
Prod(Where(IsNaN(x), 1, x)) — bit-exact wherever the plain Prod(NDExpr) is
(float32/float64 via the M1 sequential divert), an identity pass-through for integer children,
and 1 for an empty / all-NaN input, matching NumPy. Over TEXT it is np.nanprod's answer,
np.prod's: NumPy's multiply.reduce refusal (no string loop multiplies two strings).
public static NDExpr NanProd(NDExpr x)
Parameters
xNDExpr
Returns
NanProd(NDExpr, bool)
One-pass fused np.nanprod(x, axis=None, keepdims=True) — the whole-array NaN-skipping product kept as shape (1,…,1).
public static NDExpr NanProd(NDExpr x, bool keepdims)
Parameters
Returns
NanProd(NDExpr, int, bool)
One-pass fused np.nanprod along axis (NaNs treated as 1).
public static NDExpr NanProd(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
NanSum(NDExpr)
One-pass fused np.nansum: the sum with NaNs treated as 0. Composed as
Sum(Where(IsNaN(x), 0, x)), so it is BIT-EXACT wherever the plain Sum(NDExpr)
is (float32/float64/complex via the M1 pairwise divert). An integer/bool child never carries a
NaN — IsNaN is all-false there and the Where passes the child through unchanged —
so NanSum(int) is exactly Sum(int) (int64), matching NumPy. An empty / all-NaN
input sums to 0. Over TEXT it is np.nansum's own answer: NumPy's NaN replacement leaves a
string array as it is (a string dtype is not inexact), so the result is np.sum's — a
StringDType concatenation, NumPy's add.reduce refusal for S / U.
public static NDExpr NanSum(NDExpr x)
Parameters
xNDExpr
Returns
NanSum(NDExpr, bool)
One-pass fused np.nansum(x, axis=None, keepdims=True) — the whole-array NaN-skipping sum kept as shape (1,…,1).
public static NDExpr NanSum(NDExpr x, bool keepdims)
Parameters
Returns
NanSum(NDExpr, int, bool)
One-pass fused np.nansum along axis (NaNs treated as 0).
public static NDExpr NanSum(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
NanTo(NDExpr, NDExpr)
Replace NaN with fallback, pass every other value through unchanged (the
NaN case of np.nan_to_num). Non-float inputs are never NaN, so they pass through.
public static NDExpr NanTo(NDExpr x, NDExpr fallback)
Parameters
Returns
- NDExpr
A fused select on
isnan(x).
Nand(NDExpr, NDExpr)
NOT-AND: !(a & b).
public static NDExpr Nand(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused bool node.
Negate(NDExpr)
public static NDExpr Negate(NDExpr x)
Parameters
xNDExpr
Returns
NextAfter(NDExpr, NDExpr)
The next representable value after a toward b
(np.nextafter) — an EXACT one-ULP bit step (bit-exact with NumPy). Same float-tier promotion
as CopySign(NDExpr, NDExpr); complex has no loop (throws at typing time).
public static NDExpr NextAfter(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing nextafter.
Nor(NDExpr, NDExpr)
NOT-OR: !(a | b).
public static NDExpr Nor(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused bool node.
NotEqual(NDExpr, NDExpr)
public static NDExpr NotEqual(NDExpr a, NDExpr b)
Parameters
Returns
Positive(NDExpr)
Identity at every numeric dtype (np.positive). The loaded value IS the result — a fused
tree wrapping an operand in Positive(NDExpr) compiles to a pure copy (and vectorizes
as one). Its only observable effect is dtype: it is dtype-PRESERVING, so unlike a bare
operand it forces the result to that operand's dtype. BOOL has no loop — NumPy rejects
np.positive on a boolean array (there is no dtype= escape in the fused tier),
so a bool child throws at typing.
public static NDExpr Positive(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node evaluating to
xunchanged (dtype preserved).
Power(NDExpr, NDExpr)
public static NDExpr Power(NDExpr a, NDExpr b)
Parameters
Returns
Prod(NDExpr)
One-pass fused product of the expression.
public static NDExpr Prod(NDExpr x)
Parameters
xNDExpr
Returns
Prod(NDExpr, bool)
One-pass fused np.prod(x, axis=None, keepdims=True) — the whole-array product kept as shape (1,…,1).
public static NDExpr Prod(NDExpr x, bool keepdims)
Parameters
Returns
Prod(NDExpr, int, bool)
One-pass fused product of the expression along axis.
public static NDExpr Prod(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
Ptp(NDExpr)
One-pass fused np.ptp: the peak-to-peak range max - min of the expression. The
result dtype is the child's, so integer/unsigned overflow WRAPS exactly as NumPy's does, and a
NaN anywhere in the child propagates to the result. There is NO empty identity — a zero-size
input raises, like Max(NDExpr).
public static NDExpr Ptp(NDExpr x)
Parameters
xNDExpr
Returns
Ptp(NDExpr, bool)
One-pass fused np.ptp(x, axis=None, keepdims=True) — the whole-array peak-to-peak range kept as shape (1,…,1) (dtype preserved, wrapping).
public static NDExpr Ptp(NDExpr x, bool keepdims)
Parameters
Returns
Ptp(NDExpr, int, bool)
One-pass fused np.ptp along axis (max − min; dtype preserved, wrapping).
public static NDExpr Ptp(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
RFind(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.rfind(a, sub, start=0, end=None) as an expression node: for each element, the
highest index where sub occurs inside a[start:end], or -1 (an empty substring is
found at the end); an int64 result.
public static NDExpr RFind(NDExpr a, NDExpr sub, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe searched strings.
subNDExprThe substrings (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, an int64 stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr).
Exceptions
- ArgumentNullException
aorsubis null.
RIndex(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.rindex(a, sub, start=0, end=None) as an expression node: RFind(NDExpr, NDExpr, NDExpr, NDExpr), but an
element without a match raises ValueError (substring not found).
public static NDExpr RIndex(NDExpr a, NDExpr sub, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe searched strings.
subNDExprThe substrings (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, an int64 stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr) and ValueError when any element has no match.
Exceptions
- ArgumentNullException
aorsubis null.
Rad2Deg(NDExpr)
public static NDExpr Rad2Deg(NDExpr x)
Parameters
xNDExpr
Returns
Real(NDExpr)
Real part (np.real) — the complex→real component extractor. A COMPLEX child yields its real
lane as float64; every REAL child is the IDENTITY with its dtype PRESERVED (the real
part of a real number is itself), so Real(int32) is int32, not a float. Unlike the
standalone np.real (which returns a writeable VIEW onto a complex array's real lane),
the fused node produces a fresh value stream — a read, not an alias. Scalar-only in the fused
kernel (the complex path has no SIMD lane), so a tree containing it runs scalar end-to-end.
public static NDExpr Real(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the element-wise real part of
x.
Reciprocal(NDExpr)
public static NDExpr Reciprocal(NDExpr x)
Parameters
xNDExpr
Returns
Relu(NDExpr)
Rectified linear unit: max(x, 0) (NaN-propagating like np.maximum).
public static NDExpr Relu(NDExpr x)
Parameters
xNDExprPre-activation.
Returns
- NDExpr
A fused np.maximum-with-zero node.
RightShift(NDExpr, NDExpr)
Bit shift right (np.right_shift) — arithmetic for signed, logical for unsigned. Same integer loop coverage / no-loop errors and overflow rule as LeftShift(NDExpr, NDExpr).
public static NDExpr RightShift(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
An expression node computing the right shift.
Rint(NDExpr)
Round to the nearest integer, half-to-even (np.rint) — the TRUE ufunc form of round-half-to-even.
The VALUE is identical to Round(NDExpr) (both are banker's rounding, and Rint aliases Round
at every kernel emit site), but the DTYPE differs: where Round(NDExpr) PRESERVES the input
dtype (an integer array rounds to itself unchanged), Rint PROMOTES to a float tier
(bool/int8/uint8→float16, int16/uint16→float32, int32+→float64; float/complex/decimal preserved) —
so Rint(int32) is a float64 while Round(int32) is the int32 identity. Complex rounds
the real and imaginary parts separately. Vectorizes at float32/float64 on a capable runtime, exactly
like Round(NDExpr).
public static NDExpr Rint(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing
xrounded half-to-even, at the promoted float tier.
Round(NDExpr)
public static NDExpr Round(NDExpr x)
Parameters
xNDExpr
Returns
Round(NDExpr, int)
Round to decimals decimal places (np.round(x, decimals) / np.around) — a
DTYPE-PRESERVING port of NumPy's PyArray_Round. For decimals == 0 this is exactly
Round(NDExpr) (banker's rint); for decimals != 0 it composes
op2(rint(op1(x, 10^|decimals|)), 10^|decimals|) (mul→div for positive, div→mul for
negative). Every dtype behaves as NumPy 2.4.2 does:
- float / complex: computed at the input's own float dtype (complex rounds each lane), dtype PRESERVED;
- INTEGER,
decimals ≥ 0: the IDENTITY (an integer has no fractional part — no float round-trip, so a huge int64 is untouched); - INTEGER,
decimals < 0: the round runs in float64 and is CAST BACK to the integer dtype, so an out-of-range result WRAPS (e.g.round(uint8 255, -1)→ 4); - BOOL with
decimals != 0: THROWS NumPy'sUFuncTypeError"Cannot cast ufunc 'multiply'/'divide' output from dtype('float64') to dtype('bool')…" (the multiply/divide output cannot cast back to bool).
Scalar-only in the fused kernel (the multi-step composition's SIMD form is deferred).
public static NDExpr Round(NDExpr x, int decimals)
Parameters
xNDExprThe operand to round.
decimalsintThe number of decimal places (negative rounds to tens/hundreds/…).
Returns
- NDExpr
An expression node computing
xrounded todecimalsplaces, dtype preserved.
SameSign(NDExpr, NDExpr)
Same sign: both negative, or both non-negative. Uses (a<0) == (b<0), so +0 groups
with the positives and signed-zero sign is NOT distinguished (document for -0.0-sensitive use).
public static NDExpr SameSign(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused bool node.
Saturate(NDExpr)
Saturating clamp to the unit interval [0, 1] — the shader/ML "saturate".
public static NDExpr Saturate(NDExpr x)
Parameters
xNDExprValue to clamp.
Returns
- NDExpr
A fused Clamp(NDExpr, NDExpr, NDExpr) to [0, 1].
Select(NDExpr[], NDExpr[], NDExpr)
Piecewise selection (np.select): each output element is drawn from the choice whose condition
is true, the FIRST matching condition winning; positions where every condition is false take
default. Lowered to a reverse Where(NDExpr, NDExpr, NDExpr) chain
(where(c0, v0, where(c1, v1, … where(cN, vN, default)))), so the result dtype is
result_type(*choices, default) (the nested where nodes compose the same promotion) and
the conditions are nonzero-tested at their own dtype exactly like Where(NDExpr, NDExpr, NDExpr)'s
condition — in practice each is a Boolean comparison, matching np.select's bool condlist.
public static NDExpr Select(NDExpr[] condlist, NDExpr[] choicelist, NDExpr @default = null)
Parameters
condlistNDExpr[]The conditions, outermost (highest priority) first.
choicelistNDExpr[]The choices, aligned with
condlist.defaultNDExprThe fill where no condition is true;
null≙ NumPy's default weak-int0.
Returns
- NDExpr
An expression node selecting per element from the first true condition's choice.
Exceptions
- ArgumentNullException
condlistorchoicelist(or an element) is null.- ArgumentException
The lists differ in length (NumPy "list of cases must be same length as list of conditions"), or
condlistis empty (NumPy "select with an empty condition list is not possible").
Sigmoid(NDExpr)
Logistic sigmoid: 1 / (1 + exp(-x)).
public static NDExpr Sigmoid(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused reciprocal-of-one-plus-exp node.
Sign(NDExpr)
public static NDExpr Sign(NDExpr x)
Parameters
xNDExpr
Returns
SignBit(NDExpr)
IEEE sign-bit predicate (np.signbit) — result is always bool. NOT x < 0: it
reads the raw sign bit, so -0.0 and a NEGATIVE NaN are True while +0.0, +inf
and a positive NaN are False. Signed integers use the two's-complement MSB (x < 0);
unsigned/bool/char are always False; COMPLEX has no loop (a complex child throws at typing).
Scalar-only in the fused kernel (bool result, no vector body here), so a tree containing it
runs scalar end-to-end.
public static NDExpr SignBit(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node evaluating True where
x's sign bit is set.
Sin(NDExpr)
public static NDExpr Sin(NDExpr x)
Parameters
xNDExpr
Returns
Sinh(NDExpr)
public static NDExpr Sinh(NDExpr x)
Parameters
xNDExpr
Returns
Softplus(NDExpr)
Softplus log(1 + exp(x)) in the numerically STABLE form max(x,0) + log(1 + exp(-|x|))
— never overflows for large x (the naive log(1+exp(x)) saturates to +inf around
x≈710 at float64). Uses Log(NDExpr) of 1 + … rather than log1p ON PURPOSE:
log1p has no SIMD kernel and would force the whole activation onto the per-element scalar
path, whereas Log(NDExpr)/Exp(NDExpr) vectorize (float32). The precision difference is
negligible here — the log1p-vs-log(1+·) gap only bites when its argument is tiny
(large |x|), exactly where that whole term is dominated by max(x,0).
public static NDExpr Softplus(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused, vectorizable stable-softplus node.
Spacing(NDExpr)
Distance to the adjacent representable value away from zero — one ULP (np.spacing). A
float-only ufunc: it PROMOTES bool/int to the tier float (like Fabs(NDExpr)), preserves
floats/decimal, and has NO COMPLEX loop (a complex child throws at typing). float32/float64
are SIGNED (carry the sign of x); float16 is NumPy's separate always-positive
npy_half_spacing. Pure bit-arithmetic (no transcendental), so it is IEEE-exact and
portable — no host-libm dependence.
public static NDExpr Spacing(NDExpr x)
Parameters
xNDExprThe operand.
Returns
- NDExpr
An expression node computing the one-ULP spacing at each element of
x.
Sqrt(NDExpr)
public static NDExpr Sqrt(NDExpr x)
Parameters
xNDExpr
Returns
Square(NDExpr)
public static NDExpr Square(NDExpr x)
Parameters
xNDExpr
Returns
StartsWith(NDExpr, NDExpr, NDExpr, NDExpr)
NumPy's np.strings.startswith(a, prefix, start=0, end=None) as an expression node: True where
a[start:end] starts with prefix; a bool result.
public static NDExpr StartsWith(NDExpr a, NDExpr prefix, NDExpr start = null, NDExpr end = null)
Parameters
aNDExprThe strings.
prefixNDExprThe prefixes, of
a's class (see Find(NDExpr, NDExpr, NDExpr, NDExpr)'ssub).startNDExprThe range start; null is
0.endNDExprThe range end; null is
None.
Returns
- NDExpr
The node, a bool stage (see Find(NDExpr, NDExpr, NDExpr, NDExpr)).
Remarks
At evaluation, the errors of Find(NDExpr, NDExpr, NDExpr, NDExpr) (a StringDType NA that is neither NaN-like nor a
string raises ValueError).
Exceptions
- ArgumentNullException
aorprefixis null.
Std(NDExpr, bool, int)
One-pass fused np.std(x, axis=None, keepdims=True, ddof=ddof) — the whole-array standard deviation kept as shape (1,…,1).
public static NDExpr Std(NDExpr x, bool keepdims, int ddof = 0)
Parameters
xNDExprThe expression to reduce.
keepdimsboolKept for API shape; a flat std kept as size-1 everywhere.
ddofintDelta degrees of freedom; the divisor is
max(N − ddof, 0).
Returns
Std(NDExpr, int)
One-pass fused np.std: the standard deviation sqrt(var) with ddof
delta degrees of freedom (the Var(NDExpr, int) twin — same dtypes, NaN-propagation
and empty→NaN semantics, a real float64 for a complex128 child).
public static NDExpr Std(NDExpr x, int ddof = 0)
Parameters
xNDExprThe expression to reduce.
ddofintDelta degrees of freedom; the divisor is
max(N − ddof, 0).
Returns
Std(NDExpr, int, bool, int)
One-pass fused np.std along axis with ddof delta degrees of freedom.
public static NDExpr Std(NDExpr x, int axis, bool keepdims = false, int ddof = 0)
Parameters
Returns
Step(NDExpr)
Unit step / hard Heaviside at 0: 1 where x > 0, else 0 (integer result, so it composes with arithmetic).
public static NDExpr Step(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused select producing 0/1.
StepToward(NDExpr, NDExpr, NDExpr)
Move x toward target by at most delta
(a clamped approach — control loops, animation): x + clamp(target-x, -delta, delta).
public static NDExpr StepToward(NDExpr x, NDExpr target, NDExpr delta)
Parameters
Returns
- NDExpr
A fused node.
StrLen(NDExpr)
NumPy's np.strings.str_len(x) as an expression node: the length of every element in characters (code
points for U and StringDType, bytes for S), trailing NULs of a fixed-width element not
counted; an int64 result.
public static NDExpr StrLen(NDExpr x)
Parameters
xNDExprThe strings: an
S,UorStringDTypearray leaf (or a C#string, which is NumPy'sstr).
Returns
- NDExpr
The node; evaluating it runs the engine's own
str_lenoverxfirst (a stage), so the rest of the expression reads its int64 result.
Remarks
Raised at evaluation, as NumPy raises them: TypeError when x is not text
(NumPy's no-loop text naming its class); ValueError for a StringDType NA whose NA
object is not a string (The length of a null string is undefined).
Exceptions
- ArgumentNullException
xis null.
Subtract(NDExpr, NDExpr)
public static NDExpr Subtract(NDExpr a, NDExpr b)
Parameters
Returns
Sum(NDExpr)
One-pass fused sum of the expression (NumPy dtype rules: int→int64, uint→uint64, floats preserved).
public static NDExpr Sum(NDExpr x)
Parameters
xNDExpr
Returns
Sum(NDExpr, bool)
One-pass fused np.sum(x, axis=None, keepdims=True) — the whole-array sum kept as shape (1,…,1) for broadcasting back against the input.
public static NDExpr Sum(NDExpr x, bool keepdims)
Parameters
Returns
Sum(NDExpr, int, bool)
One-pass fused sum of the expression along axis.
public static NDExpr Sum(NDExpr x, int axis, bool keepdims = false)
Parameters
Returns
SupportsSimdAt(NPTypeCode)
Whether this node and its sub-tree have a SIMD emit path WHEN every operand and the
output share element type t (the compiler only vectorizes a tree when
all its types are equal — see Compile(NPTypeCode[], NPTypeCode, string?)). Defaults to the structural
SupportsSimd; nodes whose SIMD-ability is type- or runtime-dependent
override this. The key case: rounding ops (Floor/Ceil/Round/Truncate) bind a per-type
Vector{N} BCL method that exists only for float/double on a capable runtime, so
vectorizing them at an integer type (or on a runtime without the method) would hit the
emitter's "Could not find ..." throw — this gate routes those to scalar instead.
public virtual bool SupportsSimdAt(NPTypeCode t)
Parameters
Returns
Swish(NDExpr)
SiLU / Swish: x * sigmoid(x).
public static NDExpr Swish(NDExpr x)
Parameters
xNDExprInput.
Returns
- NDExpr
A fused product of
xand its sigmoid.
Switch(NDExpr, params (NDExpr cond, NDExpr value)[])
Multi-way switch: the value of the FIRST case whose condition is true, else
default (np.select semantics). Folds to nested Where(NDExpr, NDExpr, NDExpr) nodes
with case 0 outermost, so earlier cases win ties. Named Switch, not Select, because Phase 4
reserves an NDExpr.Select for the condlist/choicelist form.
public static NDExpr Switch(NDExpr @default, params (NDExpr cond, NDExpr value)[] cases)
Parameters
defaultNDExprFallback when no case matches.
cases(NDExpr cond, NDExpr value)[]Ordered (condition, value) pairs; the first true condition wins.
Returns
- NDExpr
A right-folded chain of fused selects.
Exceptions
- ArgumentNullException
defaultis null, or a case tuple holds a null.
Tan(NDExpr)
public static NDExpr Tan(NDExpr x)
Parameters
xNDExpr
Returns
Tanh(NDExpr)
public static NDExpr Tanh(NDExpr x)
Parameters
xNDExpr
Returns
Threshold(NDExpr, NDExpr, NDExpr)
PyTorch-style threshold: pass x where x > t, else substitute value.
public static NDExpr Threshold(NDExpr x, NDExpr t, NDExpr value)
Parameters
Returns
- NDExpr
A fused select.
Truncate(NDExpr)
public static NDExpr Truncate(NDExpr x)
Parameters
xNDExpr
Returns
Unless(NDExpr, NDExpr)
One-armed negated gate: then where cond is FALSE, else 0.
public static NDExpr Unless(NDExpr cond, NDExpr then)
Parameters
Returns
- NDExpr
A fused select whose true arm is 0.
Var(NDExpr, bool, int)
One-pass fused np.var(x, axis=None, keepdims=True, ddof=ddof) — the whole-array variance kept as shape (1,…,1) (real float64 for a complex child).
public static NDExpr Var(NDExpr x, bool keepdims, int ddof = 0)
Parameters
xNDExprThe expression to reduce.
keepdimsboolKept for API shape; a flat variance kept as size-1 everywhere.
ddofintDelta degrees of freedom; the divisor is
max(N − ddof, 0).
Returns
Var(NDExpr, int)
One-pass fused np.var: the variance with ddof delta degrees of
freedom (Σ(x−mean)² / (N−ddof); ddof=0 is the population variance). Result dtype:
int/bool→float64, float16→float16, float32/float64 preserved, and a complex128 child yields a
real float64 variance. A NaN PROPAGATES; ddof ≥ N → +inf; empty → NaN.
public static NDExpr Var(NDExpr x, int ddof = 0)
Parameters
xNDExprThe expression to reduce.
ddofintDelta degrees of freedom; the divisor is
max(N − ddof, 0).
Returns
Var(NDExpr, int, bool, int)
One-pass fused np.var along axis with ddof delta degrees of freedom.
public static NDExpr Var(NDExpr x, int axis, bool keepdims = false, int ddof = 0)
Parameters
Returns
When(NDExpr, NDExpr)
One-armed gate: then where cond is true, else 0 — the
masking idiom. Preserves non-numeric dtypes (unlike cond * then, which would demand
arithmetic); the false arm is a WEAK literal 0 that adopts then's dtype.
public static NDExpr When(NDExpr cond, NDExpr then)
Parameters
Returns
- NDExpr
A fused select whose false arm is 0.
Where(NDExpr, NDExpr, NDExpr)
public static NDExpr Where(NDExpr cond, NDExpr a, NDExpr b)
Parameters
Returns
Xnor(NDExpr, NDExpr)
Logical equivalence (NOT-XOR): true where a and b agree.
public static NDExpr Xnor(NDExpr a, NDExpr b)
Parameters
Returns
- NDExpr
A fused bool node.
Operators
operator +(NDExpr, NDExpr)
public static NDExpr operator +(NDExpr a, NDExpr b)
Parameters
Returns
operator +(NDExpr, NDArray)
public static NDExpr operator +(NDExpr a, NDArray b)
Parameters
Returns
operator +(NDExpr, bool)
public static NDExpr operator +(NDExpr a, bool b)
Parameters
Returns
operator +(NDExpr, decimal)
public static NDExpr operator +(NDExpr a, decimal b)
Parameters
Returns
operator +(NDExpr, double)
public static NDExpr operator +(NDExpr a, double b)
Parameters
Returns
operator +(NDExpr, Half)
public static NDExpr operator +(NDExpr a, Half b)
Parameters
Returns
operator +(NDExpr, int)
public static NDExpr operator +(NDExpr a, int b)
Parameters
Returns
operator +(NDExpr, long)
public static NDExpr operator +(NDExpr a, long b)
Parameters
Returns
operator +(NDExpr, Complex)
public static NDExpr operator +(NDExpr a, Complex b)
Parameters
Returns
operator +(NDExpr, ulong)
public static NDExpr operator +(NDExpr a, ulong b)
Parameters
Returns
operator +(NDArray, NDExpr)
public static NDExpr operator +(NDArray a, NDExpr b)
Parameters
Returns
operator +(bool, NDExpr)
public static NDExpr operator +(bool a, NDExpr b)
Parameters
Returns
operator +(decimal, NDExpr)
public static NDExpr operator +(decimal a, NDExpr b)
Parameters
Returns
operator +(double, NDExpr)
public static NDExpr operator +(double a, NDExpr b)
Parameters
Returns
operator +(Half, NDExpr)
public static NDExpr operator +(Half a, NDExpr b)
Parameters
Returns
operator +(int, NDExpr)
public static NDExpr operator +(int a, NDExpr b)
Parameters
Returns
operator +(long, NDExpr)
public static NDExpr operator +(long a, NDExpr b)
Parameters
Returns
operator +(Complex, NDExpr)
public static NDExpr operator +(Complex a, NDExpr b)
Parameters
Returns
operator +(ulong, NDExpr)
public static NDExpr operator +(ulong a, NDExpr b)
Parameters
Returns
operator &(NDExpr, NDExpr)
public static NDExpr operator &(NDExpr a, NDExpr b)
Parameters
Returns
operator &(NDExpr, NDArray)
public static NDExpr operator &(NDExpr a, NDArray b)
Parameters
Returns
operator &(NDExpr, bool)
public static NDExpr operator &(NDExpr a, bool b)
Parameters
Returns
operator &(NDExpr, int)
public static NDExpr operator &(NDExpr a, int b)
Parameters
Returns
operator &(NDExpr, long)
public static NDExpr operator &(NDExpr a, long b)
Parameters
Returns
operator &(NDExpr, ulong)
public static NDExpr operator &(NDExpr a, ulong b)
Parameters
Returns
operator &(NDArray, NDExpr)
public static NDExpr operator &(NDArray a, NDExpr b)
Parameters
Returns
operator &(bool, NDExpr)
public static NDExpr operator &(bool a, NDExpr b)
Parameters
Returns
operator &(int, NDExpr)
public static NDExpr operator &(int a, NDExpr b)
Parameters
Returns
operator &(long, NDExpr)
public static NDExpr operator &(long a, NDExpr b)
Parameters
Returns
operator &(ulong, NDExpr)
public static NDExpr operator &(ulong a, NDExpr b)
Parameters
Returns
operator |(NDExpr, NDExpr)
public static NDExpr operator |(NDExpr a, NDExpr b)
Parameters
Returns
operator |(NDExpr, NDArray)
public static NDExpr operator |(NDExpr a, NDArray b)
Parameters
Returns
operator |(NDExpr, bool)
public static NDExpr operator |(NDExpr a, bool b)
Parameters
Returns
operator |(NDExpr, int)
public static NDExpr operator |(NDExpr a, int b)
Parameters
Returns
operator |(NDExpr, long)
public static NDExpr operator |(NDExpr a, long b)
Parameters
Returns
operator |(NDExpr, ulong)
public static NDExpr operator |(NDExpr a, ulong b)
Parameters
Returns
operator |(NDArray, NDExpr)
public static NDExpr operator |(NDArray a, NDExpr b)
Parameters
Returns
operator |(bool, NDExpr)
public static NDExpr operator |(bool a, NDExpr b)
Parameters
Returns
operator |(int, NDExpr)
public static NDExpr operator |(int a, NDExpr b)
Parameters
Returns
operator |(long, NDExpr)
public static NDExpr operator |(long a, NDExpr b)
Parameters
Returns
operator |(ulong, NDExpr)
public static NDExpr operator |(ulong a, NDExpr b)
Parameters
Returns
operator /(NDExpr, NDExpr)
public static NDExpr operator /(NDExpr a, NDExpr b)
Parameters
Returns
operator /(NDExpr, NDArray)
public static NDExpr operator /(NDExpr a, NDArray b)
Parameters
Returns
operator /(NDExpr, decimal)
public static NDExpr operator /(NDExpr a, decimal b)
Parameters
Returns
operator /(NDExpr, double)
public static NDExpr operator /(NDExpr a, double b)
Parameters
Returns
operator /(NDExpr, Half)
public static NDExpr operator /(NDExpr a, Half b)
Parameters
Returns
operator /(NDExpr, int)
public static NDExpr operator /(NDExpr a, int b)
Parameters
Returns
operator /(NDExpr, long)
public static NDExpr operator /(NDExpr a, long b)
Parameters
Returns
operator /(NDExpr, Complex)
public static NDExpr operator /(NDExpr a, Complex b)
Parameters
Returns
operator /(NDExpr, ulong)
public static NDExpr operator /(NDExpr a, ulong b)
Parameters
Returns
operator /(NDArray, NDExpr)
public static NDExpr operator /(NDArray a, NDExpr b)
Parameters
Returns
operator /(decimal, NDExpr)
public static NDExpr operator /(decimal a, NDExpr b)
Parameters
Returns
operator /(double, NDExpr)
public static NDExpr operator /(double a, NDExpr b)
Parameters
Returns
operator /(Half, NDExpr)
public static NDExpr operator /(Half a, NDExpr b)
Parameters
Returns
operator /(int, NDExpr)
public static NDExpr operator /(int a, NDExpr b)
Parameters
Returns
operator /(long, NDExpr)
public static NDExpr operator /(long a, NDExpr b)
Parameters
Returns
operator /(Complex, NDExpr)
public static NDExpr operator /(Complex a, NDExpr b)
Parameters
Returns
operator /(ulong, NDExpr)
public static NDExpr operator /(ulong a, NDExpr b)
Parameters
Returns
operator ^(NDExpr, NDExpr)
public static NDExpr operator ^(NDExpr a, NDExpr b)
Parameters
Returns
operator ^(NDExpr, NDArray)
public static NDExpr operator ^(NDExpr a, NDArray b)
Parameters
Returns
operator ^(NDExpr, bool)
public static NDExpr operator ^(NDExpr a, bool b)
Parameters
Returns
operator ^(NDExpr, int)
public static NDExpr operator ^(NDExpr a, int b)
Parameters
Returns
operator ^(NDExpr, long)
public static NDExpr operator ^(NDExpr a, long b)
Parameters
Returns
operator ^(NDExpr, ulong)
public static NDExpr operator ^(NDExpr a, ulong b)
Parameters
Returns
operator ^(NDArray, NDExpr)
public static NDExpr operator ^(NDArray a, NDExpr b)
Parameters
Returns
operator ^(bool, NDExpr)
public static NDExpr operator ^(bool a, NDExpr b)
Parameters
Returns
operator ^(int, NDExpr)
public static NDExpr operator ^(int a, NDExpr b)
Parameters
Returns
operator ^(long, NDExpr)
public static NDExpr operator ^(long a, NDExpr b)
Parameters
Returns
operator ^(ulong, NDExpr)
public static NDExpr operator ^(ulong a, NDExpr b)
Parameters
Returns
operator >(NDExpr, NDExpr)
public static NDExpr operator >(NDExpr a, NDExpr b)
Parameters
Returns
operator >=(NDExpr, NDExpr)
public static NDExpr operator >=(NDExpr a, NDExpr b)
Parameters
Returns
implicit operator NDExpr(NDArray)
public static implicit operator NDExpr(NDArray array)
Parameters
arrayNDArray
Returns
implicit operator NDExpr(bool)
public static implicit operator NDExpr(bool value)
Parameters
valuebool
Returns
implicit operator NDExpr(decimal)
public static implicit operator NDExpr(decimal value)
Parameters
valuedecimal
Returns
implicit operator NDExpr(double)
public static implicit operator NDExpr(double value)
Parameters
valuedouble
Returns
implicit operator NDExpr(Half)
public static implicit operator NDExpr(Half value)
Parameters
valueHalf
Returns
implicit operator NDExpr(int)
public static implicit operator NDExpr(int value)
Parameters
valueint
Returns
implicit operator NDExpr(long)
public static implicit operator NDExpr(long value)
Parameters
valuelong
Returns
implicit operator NDExpr(Complex)
public static implicit operator NDExpr(Complex value)
Parameters
valueComplex
Returns
implicit operator NDExpr(float)
public static implicit operator NDExpr(float value)
Parameters
valuefloat
Returns
implicit operator NDExpr(string)
A C# string as NumPy's Python str: the 0-d <U{len} text array
np.array(str) builds (PythonStrLiteral(string)), embedded as an array leaf, so
NDExpr.Equal(city, "paris") and (NDExpr)city < "m" compare against the text.
public static implicit operator NDExpr(string text)
Parameters
textstringThe text (trailing NULs are kept in the element, as NumPy keeps them up to the width).
Returns
- NDExpr
An array leaf over the 0-d text array.
Remarks
The text is an INPUT of the evaluation, not IL: one compiled program serves every text value of the same
tree, so a literal that varies per call compiles nothing new (unlike a numeric literal, which is baked into
the kernel). Its width is read by the comparison per call. A C# string is always str; compare
an S array against a 0-d S array (np.array(bytes, dtype: "S") reshaped to 0-d), since
NumPy's bytes and str never compare (UFuncTypeError).
Exceptions
- ArgumentNullException
textis null.
implicit operator NDExpr(uint)
public static implicit operator NDExpr(uint value)
Parameters
valueuint
Returns
implicit operator NDExpr(ulong)
public static implicit operator NDExpr(ulong value)
Parameters
valueulong
Returns
operator <(NDExpr, NDExpr)
public static NDExpr operator <(NDExpr a, NDExpr b)
Parameters
Returns
operator <=(NDExpr, NDExpr)
public static NDExpr operator <=(NDExpr a, NDExpr b)
Parameters
Returns
operator !(NDExpr)
public static NDExpr operator !(NDExpr a)
Parameters
aNDExpr
Returns
operator %(NDExpr, NDExpr)
public static NDExpr operator %(NDExpr a, NDExpr b)
Parameters
Returns
operator %(NDExpr, NDArray)
public static NDExpr operator %(NDExpr a, NDArray b)
Parameters
Returns
operator %(NDExpr, decimal)
public static NDExpr operator %(NDExpr a, decimal b)
Parameters
Returns
operator %(NDExpr, double)
public static NDExpr operator %(NDExpr a, double b)
Parameters
Returns
operator %(NDExpr, int)
public static NDExpr operator %(NDExpr a, int b)
Parameters
Returns
operator %(NDExpr, long)
public static NDExpr operator %(NDExpr a, long b)
Parameters
Returns
operator %(NDExpr, ulong)
public static NDExpr operator %(NDExpr a, ulong b)
Parameters
Returns
operator %(NDArray, NDExpr)
public static NDExpr operator %(NDArray a, NDExpr b)
Parameters
Returns
operator %(decimal, NDExpr)
public static NDExpr operator %(decimal a, NDExpr b)
Parameters
Returns
operator %(double, NDExpr)
public static NDExpr operator %(double a, NDExpr b)
Parameters
Returns
operator %(int, NDExpr)
public static NDExpr operator %(int a, NDExpr b)
Parameters
Returns
operator %(long, NDExpr)
public static NDExpr operator %(long a, NDExpr b)
Parameters
Returns
operator %(ulong, NDExpr)
public static NDExpr operator %(ulong a, NDExpr b)
Parameters
Returns
operator *(NDExpr, NDExpr)
public static NDExpr operator *(NDExpr a, NDExpr b)
Parameters
Returns
operator *(NDExpr, NDArray)
public static NDExpr operator *(NDExpr a, NDArray b)
Parameters
Returns
operator *(NDExpr, bool)
public static NDExpr operator *(NDExpr a, bool b)
Parameters
Returns
operator *(NDExpr, decimal)
public static NDExpr operator *(NDExpr a, decimal b)
Parameters
Returns
operator *(NDExpr, double)
public static NDExpr operator *(NDExpr a, double b)
Parameters
Returns
operator *(NDExpr, Half)
public static NDExpr operator *(NDExpr a, Half b)
Parameters
Returns
operator *(NDExpr, int)
public static NDExpr operator *(NDExpr a, int b)
Parameters
Returns
operator *(NDExpr, long)
public static NDExpr operator *(NDExpr a, long b)
Parameters
Returns
operator *(NDExpr, Complex)
public static NDExpr operator *(NDExpr a, Complex b)
Parameters
Returns
operator *(NDExpr, ulong)
public static NDExpr operator *(NDExpr a, ulong b)
Parameters
Returns
operator *(NDArray, NDExpr)
public static NDExpr operator *(NDArray a, NDExpr b)
Parameters
Returns
operator *(bool, NDExpr)
public static NDExpr operator *(bool a, NDExpr b)
Parameters
Returns
operator *(decimal, NDExpr)
public static NDExpr operator *(decimal a, NDExpr b)
Parameters
Returns
operator *(double, NDExpr)
public static NDExpr operator *(double a, NDExpr b)
Parameters
Returns
operator *(Half, NDExpr)
public static NDExpr operator *(Half a, NDExpr b)
Parameters
Returns
operator *(int, NDExpr)
public static NDExpr operator *(int a, NDExpr b)
Parameters
Returns
operator *(long, NDExpr)
public static NDExpr operator *(long a, NDExpr b)
Parameters
Returns
operator *(Complex, NDExpr)
public static NDExpr operator *(Complex a, NDExpr b)
Parameters
Returns
operator *(ulong, NDExpr)
public static NDExpr operator *(ulong a, NDExpr b)
Parameters
Returns
operator ~(NDExpr)
public static NDExpr operator ~(NDExpr a)
Parameters
aNDExpr
Returns
operator -(NDExpr, NDExpr)
public static NDExpr operator -(NDExpr a, NDExpr b)
Parameters
Returns
operator -(NDExpr, NDArray)
public static NDExpr operator -(NDExpr a, NDArray b)
Parameters
Returns
operator -(NDExpr, decimal)
public static NDExpr operator -(NDExpr a, decimal b)
Parameters
Returns
operator -(NDExpr, double)
public static NDExpr operator -(NDExpr a, double b)
Parameters
Returns
operator -(NDExpr, Half)
public static NDExpr operator -(NDExpr a, Half b)
Parameters
Returns
operator -(NDExpr, int)
public static NDExpr operator -(NDExpr a, int b)
Parameters
Returns
operator -(NDExpr, long)
public static NDExpr operator -(NDExpr a, long b)
Parameters
Returns
operator -(NDExpr, Complex)
public static NDExpr operator -(NDExpr a, Complex b)
Parameters
Returns
operator -(NDExpr, ulong)
public static NDExpr operator -(NDExpr a, ulong b)
Parameters
Returns
operator -(NDArray, NDExpr)
public static NDExpr operator -(NDArray a, NDExpr b)
Parameters
Returns
operator -(decimal, NDExpr)
public static NDExpr operator -(decimal a, NDExpr b)
Parameters
Returns
operator -(double, NDExpr)
public static NDExpr operator -(double a, NDExpr b)
Parameters
Returns
operator -(Half, NDExpr)
public static NDExpr operator -(Half a, NDExpr b)
Parameters
Returns
operator -(int, NDExpr)
public static NDExpr operator -(int a, NDExpr b)
Parameters
Returns
operator -(long, NDExpr)
public static NDExpr operator -(long a, NDExpr b)
Parameters
Returns
operator -(Complex, NDExpr)
public static NDExpr operator -(Complex a, NDExpr b)
Parameters
Returns
operator -(ulong, NDExpr)
public static NDExpr operator -(ulong a, NDExpr b)
Parameters
Returns
operator -(NDExpr)
public static NDExpr operator -(NDExpr a)
Parameters
aNDExpr
Returns
operator +(NDExpr)
Unary plus (np's +a): the identity copy Positive(NDExpr) — dtype-preserving, no bool loop.
public static NDExpr operator +(NDExpr a)
Parameters
aNDExpr