Table of Contents

Class BinaryNode

Namespace
NumSharp.Backends.Iteration
Assembly
NumSharp.dll
public sealed class BinaryNode : NDExpr
Inheritance
BinaryNode
Inherited Members
Extension Methods

Constructors

BinaryNode(BinaryOp, NDExpr, NDExpr)

public BinaryNode(BinaryOp op, NDExpr left, NDExpr right)

Parameters

op BinaryOp
left NDExpr
right NDExpr

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)

Stable structural signature. Used to derive a cache key when the user doesn't supply one.

public override void AppendSignature(StringBuilder sb)

Parameters

sb StringBuilder

EmitScalar(ILGenerator, NDExprCompileContext)

Emit scalar code. On exit, the evaluation stack must have exactly one value of dtype ctx.OutputType.

public override void EmitScalar(ILGenerator il, NDExprCompileContext ctx)

Parameters

il ILGenerator
ctx NDExprCompileContext

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

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 override bool SupportsSimdAt(NPTypeCode t)

Parameters

t NPTypeCode

Returns

bool