Class RoundNode
Round-to-decimals node — np.round(x, decimals) with decimals != 0 (the
decimals == 0 case is the plain Round node, so the factory only
builds a RoundNode for a nonzero decimals, which is baked into the node and folded
into its identity). A DTYPE-PRESERVING port of NumPy's PyArray_Round: it composes
op2(rint(op1(x, f)), f) with f = 10^|decimals| (mul→div for positive decimals,
div→mul for negative), at the input's own float dtype for a float/complex child, at float64 (then
cast back, wrapping) for an integer child with negative decimals, and as the identity for an
integer child with positive decimals. Scalar-only (CanEmitVectorV2(NPTypeCode, IReadOnlyDictionary<NDExpr, NPTypeCode>) false) — the
multi-step composition's SIMD form is deferred.
public sealed class RoundNode : NDExpr
- Inheritance
-
RoundNode
- Inherited Members
Constructors
RoundNode(NDExpr, int)
Construct round(child, decimals); decimals must be nonzero.
public RoundNode(NDExpr child, int decimals)
Parameters
Exceptions
- ArgumentNullException
childis 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
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
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
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 override void EmitVector(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorctxNDExprCompileContext