Mercurial > hg > octave-terminal
changeset 1310:f62e82e0a2ce
[project @ 1995-06-25 04:08:32 by jwe]
author | jwe |
---|---|
date | Sun, 25 Jun 1995 04:08:32 +0000 |
parents | c0187e1c02f9 |
children | b4586d676b7f |
files | src/svd.cc |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/svd.cc +++ b/src/svd.cc @@ -30,6 +30,8 @@ #include "tree-const.h" #include "user-prefs.h" +#include "pr-output.h" +#include "mappers.h" #include "gripes.h" #include "error.h" #include "utils.h" @@ -41,7 +43,9 @@ \n\ Compute the singular value decomposition of X. Given a second input\n\ argument, an `economy' sized factorization is computed that omits\n\ -unnecessary rows and columns of U and V") +unnecessary rows and columns of U and V.\n\ +\n\ +X may not contain any Inf or NaN values.") { Octave_object retval; @@ -70,6 +74,13 @@ if (! error_state) { + if (any_element_is_inf_or_nan (tmp)) + { + error ("svd: cannot take SVD of matrix containing Inf or\ + NaN values"); + return retval; + } + SVD result (tmp, type); DiagMatrix sigma = result.singular_values (); @@ -92,6 +103,13 @@ if (! error_state) { + if (any_element_is_inf_or_nan (ctmp)) + { + error ("svd: cannot take SVD of matrix containing Inf or\ + NaN values"); + return retval; + } + ComplexSVD result (ctmp, type); DiagMatrix sigma = result.singular_values ();