matrix_rank

std.linalg.matrix_rank · Level L4

The numerical rank of a matrix with at least as many rows as columns (transpose a wide one first): how many singular values exceed rtol times the largest. NumPy's np.linalg.matrix_rank with tol = rtol·σ₁. For a rank-deficient matrix stored in floating point the exact rank is usually full, with tiny singular values; the tolerance is what makes the question answerable.

rank = #{i : σᵢ > rtol·σ₁}

Signature

matrix_rank(A: f64[n+k, n], rtol: f64[]) → f64[]

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.

Af64[n+k, n]rtolf64[]SVDValuessReduceMaxtopMultiplycutGreaterbigReduceSumrankrankf64[]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference np.linalg.matrix_rank(A, tol=rtol * s.max()) to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 40 float64 results are exact: the error is zero.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them exact, with zero error.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
100%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
0

Note

Each singular value against the cut is a decision. The verification uses matrices with singular values k, k − 1, …, 1 and then zeros, so every decision is far from the cut; near it, the rank is not certain.

Identity

Calls
—
Called by
—
sha256:9a6a44e04f0f90d22cb5c7bd4fcc26fbf2069c0386e86bd0245541c448421d14

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

Control handle

Symbol
Ω:std.linalg.matrix_rank · Ω:matrix_rank
Pins
sha256:86f9860c60352008d4d55d074c293f6489c5851d4d9d8659b257cd3ebcf26fdcthis graph alone
Evidence
sha256:02efff09a4d7aedfd57cfb679f36072eeba7410a5b2bf16142161a378d408805the 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.