Rank

Shipping
matrix_rank

Numerical rank of a matrix (count of significant singular values)

Signature

Inputs

  • aSignal|ArrayrequiredA 2-D matrix.

Outputs

  • rankIntegerThe effective numerical rank (integer).

Description

Rank reports the numerical rank of a matrix — the number of singular values above a tolerance — computed via the MKL LAPACK SVD. Unlike exact symbolic rank, it accounts for floating-point noise, so a matrix that is theoretically full-rank but numerically near-singular reports its effective rank.

The output is an Integer. Rank is the standard diagnostic for detecting linear dependence among columns/rows, verifying that a system is well-posed, and confirming the conditioning of a design matrix before a solve or fit.

Mathematics

Examples

Full-rank check

For the SPD matrix , the rank output is — full rank, so the matrix is invertible and any has a unique solution.

Applications

  • Detecting linear dependence / collinearity among columns of a design matrix.
  • Verifying a linear system is well-posed before matrix_solve.
  • Assessing effective dimensionality of data or a transfer matrix.
  • Guarding a fit against rank deficiency.

Neat

Being SVD-based, it is a *numerical* rank robust to floating-point noise, not a brittle exact test that a tiny perturbation would break.

It shares the same singular-value spectrum used by matrix_lstsq, matrix_pinv, and matrix_cond, so their rank-related diagnostics stay consistent.

Known issues

The rank depends on the singular-value tolerance; a matrix with a small-but-nonzero singular value near the threshold may report ambiguously.

Rank alone doesn't quantify how close to singular a matrix is — pair it with matrix_cond for conditioning.

See also

ranksvdlinear-algebralapackmklintegerstateless