kalman_level

std.stats.kalman_level · Level L2

Filter a sequence of noisy observations with a local-level Kalman filter: a random walk observed with noise, in each coordinate independently. Returns the filtered mean and variance after every observation. A Scan with two carries, m and P (Round 14.10).

(mₜ, Pₜ) = kalman_level_step(mₜ₋₁, Pₜ₋₁, zₜ)

Signature

kalman_level(m0: f64[k], P0: f64[k], Z: f64[n, k], Q: f64[k], R: f64[k]) → f64[n, k], f64[n, k]

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.

m0f64[k]P0f64[k]Zf64[n, k]Qf64[k]Rf64[k]Scan·kalman_level_stepM, VMf64[n, k]Vf64[n, k]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference m, P = m0, P0; for each z in Z: m, P = kalman_level_step(m, P, z) in exact rational arithmetic, on all 40 test cases.
  • All 1,238 float64 results inside the running error bound; the closest uses 78% of it.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 67% of it.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
57%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
5.1e+5

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Note

The gain divides by P + Q + R, which the positive noise variance R keeps away from zero, so every step's error is bounded, whatever the observations.

Identity

Calls
Called by
—
sha256:6f7d2a964fe5549bd79e8bfc0ef9dbe20a4250b42199135063b30f48a01772ee

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

Control handle

Symbol
Ω:std.stats.kalman_level · Ω:kalman_level
Pins
sha256:7d8c4681837a0ff4fc28339d0ec799e86ba15a36bc6b5284688a1b82d3c9d433this graph and the 1 it reaches through calls
Evidence
sha256:695e1d9544509fedb777574718c988cd0401f305da91937dc53bc100ff82630fthe hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.