diff liboctave/dbleSVD.cc @ 2621:337a09dd1c06

[project @ 1997-01-24 21:49:41 by jwe]
author jwe
date Fri, 24 Jan 1997 21:55:06 +0000
parents 1b57120c997b
children eedc2f3f61f7
line wrap: on
line diff
--- a/liboctave/dbleSVD.cc	Thu Jan 23 16:26:26 1997 +0000
+++ b/liboctave/dbleSVD.cc	Fri Jan 24 21:55:06 1997 +0000
@@ -99,7 +99,15 @@
       break;
 
     case SVD::sigma_only:
-      jobu = jobv = 'N';
+
+      // Note:  for this case, both jobu and jobv should be 'N', but
+      // there seems to be a bug in dgesvd from Lapack V2.0.  To
+      // demonstrate the bug, set both jobu and jobv to 'N' and find
+      // the singular values of [eye(3), eye(3)].  The result is
+      // [-sqrt(2), -sqrt(2), -sqrt(2)].
+
+      jobu = 'O';
+      jobv = 'N';
       ncol_u = nrow_vt = 1;
       break;
 
@@ -109,7 +117,7 @@
 
   type_computed = svd_type;
 
-  if (jobu != 'N')
+  if (! (jobu == 'N' || jobu == 'O'))
     left_sm.resize (m, ncol_u);
 
   double *u = left_sm.fortran_vec ();
@@ -117,7 +125,7 @@
   sigma.resize (nrow_s, ncol_s);
   double *s_vec  = sigma.fortran_vec ();
 
-  if (jobv != 'N')
+  if (! (jobv == 'N' || jobv == 'O'))
     right_sm.resize (nrow_vt, n);
 
   double *vt = right_sm.fortran_vec ();
@@ -137,7 +145,7 @@
     (*current_liboctave_error_handler) ("unrecoverable error in dgesvd");
   else
     {
-      if (jobv != 'N')
+      if (! (jobv == 'N' || jobv == 'O'))
 	right_sm = right_sm.transpose ();
     }