Mercurial > hg > octave-terminal
changeset 8995:1b097d86a61a
remove a TODO in oct-norm.cc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 18 Mar 2009 16:17:15 +0100 |
parents | a8d30dc1beec |
children | af43309a59f4 |
files | liboctave/ChangeLog liboctave/oct-norm.cc |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2009-03-18 Jaroslav Hajek <highegg@gmail.com> + + * oct-norm.cc (get_eps): Remove that hack. + (higham): Use std::numeric_limits instead. + Include OCTAVE_QUIT. + 2009-03-16 Jason Riedy <jason@acm.org> * Sparse.cc (transpose): Eliminate the workspace by computing in
--- a/liboctave/oct-norm.cc +++ b/liboctave/oct-norm.cc @@ -413,6 +413,7 @@ RR lambda = 0, mu = 0; for (octave_idx_type k = 0; k < m.columns (); k++) { + OCTAVE_QUIT; VectorT col (m.column (k)); if (k > 0) higham_subp (y, col, 4*k, p, lambda, mu); @@ -430,6 +431,7 @@ int iter = 0; while (iter < maxiter) { + OCTAVE_QUIT; y = m*x; gamma1 = gamma; gamma = vector_norm (y, p); @@ -449,9 +451,6 @@ return gamma; } -// TODO: is there a better way? -inline float get_eps (float) { return FLT_EPSILON; } -inline double get_eps (double) { return DBL_EPSILON; } // derive column vector and SVD types static const char *p_less1_gripe = "xnorm: p must be at least 1"; @@ -477,7 +476,8 @@ else if (p > 1) { VectorT x; - res = higham (m, p, std::sqrt (get_eps (p)), max_norm_iter, x); + const R sqrteps = std::sqrt (std::numeric_limits<R>::epsilon ()); + res = higham (m, p, sqrteps, max_norm_iter, x); } else (*current_liboctave_error_handler) (p_less1_gripe); @@ -497,7 +497,8 @@ else if (p > 1) { VectorT x; - res = higham (m, p, std::sqrt (get_eps (p)), max_norm_iter, x); + const R sqrteps = std::sqrt (std::numeric_limits<R>::epsilon ()); + res = higham (m, p, sqrteps, max_norm_iter, x); } else (*current_liboctave_error_handler) (p_less1_gripe);