Class WeightedAverageNode
A root-only fused weighted average Σ(values·weights) / Σ(weights) over two elementwise
sub-trees (Average(NDExpr, NDExpr)). Like ReduceNode it is
host-driven (no elementwise emit) and must be the root of the expression.
public sealed class WeightedAverageNode : NDExpr
- Inheritance
-
WeightedAverageNode
- Inherited Members
Constructors
WeightedAverageNode(NDExpr, NDExpr, int?, bool)
Build a weighted-average node over values and weights.
public WeightedAverageNode(NDExpr values, NDExpr weights, int? axis = null, bool keepdims = false)
Parameters
valuesNDExprThe value expression (numerator's left factor).
weightsNDExprThe weight expression (numerator's right factor and the denominator).
axisint?The reduction axis, or null for a flat (reduce-all) average.
keepdimsboolWhen true, the reduced axis (or every axis, for a flat average) is kept as size 1.
Exceptions
- ArgumentNullException
valuesorweightsis null.
Properties
SupportsSimd
Never SIMD — a reduction has no elementwise vector body; the host drives it.
public override bool SupportsSimd { get; }
Property Value
Methods
AppendSignature(StringBuilder)
Fold the node's identity into a structural signature (axis / keepdims + both children).
public override void AppendSignature(StringBuilder sb)
Parameters
sbStringBuilderThe signature builder.
EmitScalar(ILGenerator, NDExprCompileContext)
A weighted average is host-driven as the tree root; it emits no elementwise scalar value.
public override void EmitScalar(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorUnused.
ctxNDExprCompileContextUnused.
Exceptions
- InvalidOperationException
Always — the node is driven by np.evaluate, never emitted.
EmitVector(ILGenerator, NDExprCompileContext)
A weighted average has no vector path — it is driven by np.evaluate.
public override void EmitVector(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorUnused.
ctxNDExprCompileContextUnused.
Exceptions
- InvalidOperationException
Always.