From bug-octave-request at bevo dot che dot wisc dot edu Wed Jan 21 22:15:43 2004 Subject: rank.m doesn't handle empty input From: Quentin Spencer To: bug-octave at bevo dot che dot wisc dot edu Date: Wed, 21 Jan 2004 22:10:52 -0600 This patch allows rank.m to return 0 when the input is a 0x0 matrix rather than an error message, which makes it compatible with the Matlab rank function. *** rank.m.~1.16.~ 2000-02-23 21:55:32.000000000 -0600 --- rank.m 2004-01-21 22:07:32.000000000 -0600 *************** *** 39,45 **** if (nargin == 1) sigma = svd (A); ! tolerance = max (size (A)) * sigma (1) * eps; elseif (nargin == 2) sigma = svd (A); tolerance = tol; --- 39,49 ---- if (nargin == 1) sigma = svd (A); ! if(isempty(sigma)) ! tolerance = 0; ! else ! tolerance = max (size (A)) * sigma (1) * eps; ! end elseif (nargin == 2) sigma = svd (A); tolerance = tol; ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------