Qu

rank

Builtin index · Core maths

result = rank(A, tol=)

Input: A, tol · Output: result

What it is

Numerical rank of A (an r×c Mat or CMat) — the count of singular values clearing the tolerance. tol is an optional scalar, same default and convention as pinv's.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = rank(A, tol=)
A Mat or CMatNumerical rank of A (an r×c Mat or CMat) — the count of singular values clearing the tolerance.
tol scalartol is an optional scalar, same default and convention as pinv's.
Num —integer-valued
Returns a scalar Num (integer-valued).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

A = [4, 7; 2, 6]
print("det(A) = {det(A)}")     # 10

print("rank(A) = {rank(A)}")   # 2

output
det(A) = 10
rank(A) = 2

from numerics-dsp

How it works

rank(A) — the numerical rank, the same SVD-based tolerance pinv already reports (a singular value counts once it clears eps * max(rows, cols) * largest_singular_value).

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.