changeset 1544:f1931fc63ce9

[project @ 1995-10-06 05:57:56 by jwe]
author jwe
date Fri, 06 Oct 1995 06:01:19 +0000
parents d6e96e0bc681
children 8bdfa6fe5d69
files liboctave/CmplxSVD.cc liboctave/CmplxSVD.h liboctave/dbleSVD.cc liboctave/dbleSVD.h src/svd.cc
diffstat 5 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CmplxSVD.cc	Fri Oct 06 05:54:07 1995 +0000
+++ b/liboctave/CmplxSVD.cc	Fri Oct 06 06:01:19 1995 +0000
@@ -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);
--- a/liboctave/CmplxSVD.h	Fri Oct 06 05:54:07 1995 +0000
+++ b/liboctave/CmplxSVD.h	Fri Oct 06 06:01:19 1995 +0000
@@ -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;
--- a/liboctave/dbleSVD.cc	Fri Oct 06 05:54:07 1995 +0000
+++ b/liboctave/dbleSVD.cc	Fri Oct 06 06:01:19 1995 +0000
@@ -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);
--- a/liboctave/dbleSVD.h	Fri Oct 06 05:54:07 1995 +0000
+++ b/liboctave/dbleSVD.h	Fri Oct 06 06:01:19 1995 +0000
@@ -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;
--- a/src/svd.cc	Fri Oct 06 05:54:07 1995 +0000
+++ b/src/svd.cc	Fri Oct 06 06:01:19 1995 +0000
@@ -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 ())