# HG changeset patch # User jwe # Date 804053312 0 # Node ID f62e82e0a2cec39496822519cfa50cd8df7a3d54 # Parent c0187e1c02f9168ea1fa30b84e014615a7e34480 [project @ 1995-06-25 04:08:32 by jwe] diff -r c0187e1c02f9 -r f62e82e0a2ce src/svd.cc --- a/src/svd.cc Sun Jun 25 04:03:14 1995 +0000 +++ b/src/svd.cc Sun Jun 25 04:08:32 1995 +0000 @@ -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 ();