Table of Contents

Class MinMaxNode

Namespace
NumSharp.Backends.Iteration
Assembly
NumSharp.dll
public sealed class MinMaxNode : NDExpr
Inheritance
MinMaxNode
Inherited Members

Constructors

MinMaxNode(bool, NDExpr, NDExpr)

Builds an np.minimum / np.maximum node: NaN-propagating, and for complex128 NumPy's CLE / CGE selection (a tie keeps left). Prefer the Min(NDExpr, NDExpr) / Max(NDExpr, NDExpr) factories; this is what they call.

public MinMaxNode(bool isMin, NDExpr left, NDExpr right)

Parameters

isMin bool

True for np.minimum, false for np.maximum.

left NDExpr

The first operand (x1).

right NDExpr

The second operand (x2).

Exceptions

ArgumentNullException

left or right is null.

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 override bool SupportsSimd { get; }

Property Value

bool

Methods

AppendSignature(StringBuilder)

Appends this node's structural signature, the kernel-cache key component: Min(..) / Max(..), or ClipMin(..) / ClipMax(..) for a clip half, so a complex Clip(NDExpr, NDExpr, NDExpr) and the equivalent-looking Min(Max(x, lo), hi) never share a compiled kernel.

public override void AppendSignature(StringBuilder sb)

Parameters

sb StringBuilder

The builder the signature is appended to.

EmitScalar(ILGenerator, NDExprCompileContext)

Emits the per-element body: both children converted to this node's dtype, then the engine's own scalar clamp (EmitScalarClamp(ILGenerator, NPTypeCode, bool, bool, bool)), the body its maximum / minimum ufuncs and np.clip's kernels run, so fused and unfused results agree bit for bit.

public override void EmitScalar(ILGenerator il, NDExprCompileContext ctx)

Parameters

il ILGenerator

The kernel's IL stream; one value of this node's dtype is left on its stack.

ctx NDExprCompileContext

The compile context holding the per-node dtypes.

Exceptions

NotSupportedException

The node's dtype is not one of the 15 element dtypes.

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 override void EmitVector(ILGenerator il, NDExprCompileContext ctx)

Parameters

il ILGenerator
ctx NDExprCompileContext