# HG changeset patch # User jwe # Date 812959279 0 # Node ID f1931fc63ce914f3fb50dd7ebf46a844bc01c22c # Parent d6e96e0bc681e19411439de58b7b2b166770a359 [project @ 1995-10-06 05:57:56 by jwe] diff --git a/liboctave/CmplxSVD.cc b/liboctave/CmplxSVD.cc --- a/liboctave/CmplxSVD.cc +++ b/liboctave/CmplxSVD.cc @@ -47,7 +47,7 @@ ComplexMatrix ComplexSVD::left_singular_matrix (void) const { - if (type == SVD::sigma_only) + if (type_computed == SVD::sigma_only) { (*current_liboctave_error_handler) ("ComplexSVD: U not computed because type == SVD::sigma_only"); @@ -60,7 +60,7 @@ ComplexMatrix ComplexSVD::right_singular_matrix (void) const { - if (type == SVD::sigma_only) + if (type_computed == SVD::sigma_only) { (*current_liboctave_error_handler) ("ComplexSVD: V not computed because type == SVD::sigma_only"); @@ -107,6 +107,8 @@ break; } + type_computed = svd_type; + Complex *u = (ncol_u > 0 ? new Complex[m * ncol_u] : 0); double *s_vec = new double[min_mn]; Complex *vt = (nrow_vt > 0 ? new Complex[nrow_vt * n] : 0); diff --git a/liboctave/CmplxSVD.h b/liboctave/CmplxSVD.h --- a/liboctave/CmplxSVD.h +++ b/liboctave/CmplxSVD.h @@ -72,9 +72,9 @@ DiagMatrix singular_values (void) const { return sigma; } - ComplexMatrix left_singular_matrix (void); + ComplexMatrix left_singular_matrix (void) const; - ComplexMatrix right_singular_matrix (void); + ComplexMatrix right_singular_matrix (void) const; friend ostream& operator << (ostream& os, const ComplexSVD& a); @@ -82,6 +82,8 @@ int init (const ComplexMatrix& a, SVD::type svd_type = SVD::std); + SVD::type type_computed; + DiagMatrix sigma; ComplexMatrix left_sm; ComplexMatrix right_sm; diff --git a/liboctave/dbleSVD.cc b/liboctave/dbleSVD.cc --- a/liboctave/dbleSVD.cc +++ b/liboctave/dbleSVD.cc @@ -45,7 +45,7 @@ Matrix left_singular_matrix (void) const { - if (type == SVD::sigma_only) + if (type_computed == SVD::sigma_only) { (*current_liboctave_error_handler) ("ComplexSVD: U not computed because type == SVD::sigma_only"); @@ -58,7 +58,7 @@ Matrix right_singular_matrix (void) const { - if (type == SVD::sigma_only) + if (type_computed == SVD::sigma_only) { (*current_liboctave_error_handler) ("ComplexSVD: V not computed because type == SVD::sigma_only"); @@ -105,6 +105,8 @@ break; } + type_computed = svd_type; + double *u = (ncol_u > 0 ? new double[m * ncol_u] : 0); double *s_vec = new double[min_mn]; double *vt = (ncol_vt > 0 ? new double[nrow_vt * n] : 0); diff --git a/liboctave/dbleSVD.h b/liboctave/dbleSVD.h --- a/liboctave/dbleSVD.h +++ b/liboctave/dbleSVD.h @@ -74,9 +74,9 @@ DiagMatrix singular_values (void) const { return sigma; } - Matrix left_singular_matrix (void); + Matrix left_singular_matrix (void) const; - Matrix right_singular_matrix (void); + Matrix right_singular_matrix (void) const; friend ostream& operator << (ostream& os, const SVD& a); @@ -84,6 +84,8 @@ int init (const Matrix& a, type svd_type = std); + SVD::type type_computed; + DiagMatrix sigma; Matrix left_sm; Matrix right_sm; diff --git a/src/svd.cc b/src/svd.cc --- a/src/svd.cc +++ b/src/svd.cc @@ -66,7 +66,8 @@ else if (arg_is_empty > 0) return Octave_object (3, Matrix ()); - SVD::type type = ((nargout == 1) ? SVD::sigma_only + SVD::type type = ((nargout == 0 || nargout == 1) + ? SVD::sigma_only : (nargin == 2) ? SVD::economy : SVD::std); if (arg.is_real_type ())