Mercurial > hg > octave-lyh
changeset 14520:c4ed0fdf2b62
Fix initialization in Higham's method for norm estimate (bug #36031).
* oct-norm.cc (higham): Initialize mu to 1.
author | Marco Caliari <marco.caliari@univr.it> |
---|---|
date | Tue, 03 Apr 2012 20:38:05 -0700 |
parents | 80abf6374cb7 |
children | 3b19a952ab54 |
files | liboctave/oct-norm.cc src/data.cc |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/oct-norm.cc +++ b/liboctave/oct-norm.cc @@ -415,7 +415,7 @@ // the OSE part VectorT y(m.rows (), 1, 0), z(m.rows (), 1); typedef typename VectorT::element_type RR; - RR lambda = 0, mu = 0; + RR lambda = 0, mu = 1; for (octave_idx_type k = 0; k < m.columns (); k++) { octave_quit ();
--- a/src/data.cc +++ b/src/data.cc @@ -5233,6 +5233,12 @@ %! fhi = single (1e+300); %!assert (norm (flo*m2,"fro"), single (sqrt (30)*flo), -eps ("single")) %!assert (norm (fhi*m2,"fro"), single (sqrt (30)*fhi), -eps ("single")) + +%!test +%! ## Test for norm returning NaN on sparse matrix (bug #30631) +%! A = sparse (2,2); +%! A(2,1) = 1; +%! assert (norm (A), 1); */ static octave_value