home *** CD-ROM | disk | FTP | other *** search
- function r = rank(x,tol)
- %RANK Number of linearly independent rows or columns.
- % K = RANK(X) is the number of singular values of X
- % that are larger than MAX(SIZE(X)) * NORM(X) * EPS.
- % K = RANK(X,tol) is the number of singular values of X that
- % are larger than tol.
-
- % Copyright (c) 1984-93 by The MathWorks, Inc.
-
- s = svd(x);
- if (nargin == 1)
- tol = max(size(x)) * s(1) * eps;
- end
- r = sum(s > tol);
-