ema

std.seq.ema · Level L2

Exponential moving average of a series, started at its first value: a Scan of ema_step.

s₀ = x₀, sᵢ = α·xᵢ + (1 − α)·sᵢ₋₁

Signature

ema(x: f64[n], alpha: f64[]) → f64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

xf64[n]alphaf64[]SlicefirstReshapes0Scan·ema_stepssf64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference s = x[0]; for each v in x: s = alpha*v + (1 - alpha)*s in exact rational arithmetic, on all 40 test cases.
  • All 141 float64 results inside the running error bound; the closest uses 48% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
65%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
6.44

Identity

Calls
Called by
—
sha256:811adc4e6cf80740163db191617c6682c1e3635c63fd669b792d1f7f8a7f5114

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.