Mercurial > hg > octave-terminal
changeset 4706:2c73119a576a
[project @ 2004-01-22 04:36:54 by jwe]
author | jwe |
---|---|
date | Thu, 22 Jan 2004 04:36:54 +0000 |
parents | a1b165f5e934 |
children | 8d4bb887f381 |
files | scripts/ChangeLog scripts/linear-algebra/rank.m |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2004-01-21 Quentin Spencer <qspencer@ieee.org> + + * linear-algebra/rank.m: Allow rank ([]) to return 0, same as + rank ([], tol). + 2004-01-10 John W. Eaton <jwe@bevo.che.wisc.edu> * elfun/acot.m: Return atan (1./z).
--- a/scripts/linear-algebra/rank.m +++ b/scripts/linear-algebra/rank.m @@ -39,13 +39,18 @@ if (nargin == 1) sigma = svd (A); - tolerance = max (size (A)) * sigma (1) * eps; + if (isempty (sigma)) + tolerance = 0; + else + tolerance = max (size (A)) * sigma (1) * eps; + endif elseif (nargin == 2) sigma = svd (A); tolerance = tol; else usage ("rank (A)"); endif + retval = sum (sigma > tolerance); endfunction