home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / MATFUN.DI$ / RANK.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  419 b   |  15 lines

  1. function r = rank(x,tol)
  2. %RANK    Number of linearly independent rows or columns.
  3. %    K = RANK(X) is the number of singular values of X
  4. %    that are larger than MAX(SIZE(X)) * NORM(X) * EPS.
  5. %    K = RANK(X,tol) is the number of singular values of X that
  6. %    are larger than tol.
  7.  
  8. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  9.  
  10. s = svd(x);
  11. if (nargin == 1)
  12.     tol = max(size(x)) * s(1) * eps;
  13. end
  14. r = sum(s > tol);
  15.