MATLAB Function Reference | ![]() ![]() |
Syntax
k = rank(A) k = rank(A,tol)
Description
The rank
function provides an estimate of the number of linearly independent rows or columns of a matrix.
returns the number of singular values of k = rank(A)
A
that are larger than the default tolerance, max(size(A))
*norm(A)
*eps
.
returns the number of singular values of k = rank(A,
tol)
A
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. The SVD algorithm is the most time consuming, but also the most reliable.
s = svd(A); tol = max(size(A))*s(1)*eps; r = sum(s > tol);
References
[1] Anderson, E., Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. Dongarra, J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, and D. Sorensen, LAPACK User's Guide, Third Edition, SIAM, Philadelphia, 1999.
![]() | randperm | rat, rats | ![]() |