Mercurial > hg > octave-lojdl
changeset 12517:c2e8c9d9e284
Fix bug #32818, nonconformant arguments in svds.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 17 Mar 2011 23:11:47 -0700 |
parents | 3d6584617da0 |
children | 9f926b9f83cc |
files | scripts/ChangeLog scripts/sparse/svds.m |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-03-17 Rik <octave@nomad.inbox5.com> + + * scripts/sparse/svds.m: Fix bug #32818, nonconformant arguments + in svds. + 2010-03-17 Rik <octave@nomad.inbox5.com> * io/fileread.m: Add seealso reference to sscanf.
--- a/scripts/sparse/svds.m +++ b/scripts/sparse/svds.m @@ -173,10 +173,10 @@ if (nargout > 1) [V, s, flag] = eigs ([sparse(m,m), b; b', sparse(n,n)], b_k, b_sigma, b_opts); + s = diag (s); else s = eigs ([sparse(m,m), b; b', sparse(n,n)], b_k, b_sigma, b_opts); endif - s = diag (s); if (ischar (sigma)) norma = max (s); @@ -224,11 +224,11 @@ else if (max_a == 0) u = eye (m, k); - s = diag(s); + s = diag (s); v = eye (n, k); else u = root2 * V(1:m,ind); - s = diag(s); + s = diag (s); v = root2 * V(m+1:end,ind); endif @@ -273,4 +273,7 @@ %! assert(s2, s((idx+floor(k/2)):-1:(idx-floor(k/2))), 1e-10); %!test %! [u2,s2,v2,flag] = svds(zeros (10), k); -%! assert (isequal(u2, eye (10, k)) && isequal (s2, zeros(k)) && isequal (v2, eye(10, 7))) +%! assert (isequal(u2, eye (10, k)) && isequal (s2, zeros(k)) && isequal (v2, eye(10, 7))); +%!test +%! s = svds (speye (10)); +%! assert (s, ones (6, 1), 2*eps);