rank

Purpose

Rank of a matrix.

Synopsis

k = rank(X)
k = rank(X,tol)

Description

rank(X) is the number of singular values of X that are larger than max(size(X))*norm(X)*eps.

rank(X,tol) is the number of singular values of X that are larger than tol.

Algorithm

There are a number of ways to compute the rank of a matrix. MATLAB uses the method based on the singular value decomposition, or SVD, described in Chapter 11 of the LINPACK User's Guide. The SVD algorithm is the most time consuming, but also the most reliable.

The rank algorithm is

s = svd(X);
tol = max(size(X))*s(1)*eps;
r = sum(s > tol);

References

[1] J.J. Dongarra, J.R. Bunch, C.B. Moler, and G.W. Stewart, LINPACK User's Guide, SIAM, Philadelphia, 1979.

(c) Copyright 1994 by The MathWorks, Inc.