changeset 10539:8db807a0eb78

Return correct Hessenberg matrix when called with 0 or 1 output arguments rather than full form with two output arguments.
author Rik <code@nomad.inbox5.com>
date Thu, 22 Apr 2010 13:37:35 -0700
parents 26673015caec
children 952d4df5b686
files src/ChangeLog src/DLD-FUNCTIONS/hess.cc
diffstat 2 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Apr 22 09:41:37 2010 +0200
+++ b/src/ChangeLog	Thu Apr 22 13:37:35 2010 -0700
@@ -1,3 +1,8 @@
+2010-04-22  Rik <octave@nomad.inbox5.com>
+
+	* DLD-FUNCTIONS/hess.cc.: return correct Hessenberg matrix when called 
+   with only one output argument.
+
 2010-04-22  Jaroslav Hajek  <highegg@gmail.com>
 
 	* data.cc (do_hypot): New helper function. Move bulk code from Fhypot
--- a/src/DLD-FUNCTIONS/hess.cc	Thu Apr 22 09:41:37 2010 +0200
+++ b/src/DLD-FUNCTIONS/hess.cc	Thu Apr 22 13:37:35 2010 -0700
@@ -99,8 +99,13 @@
             {
               FloatHESS result (tmp);
 
-              retval(1) = result.hess_matrix ();
-              retval(0) = result.unitary_hess_matrix ();
+              if (nargout <= 1)
+                retval(0) = result.hess_matrix ();
+              else
+                {
+                  retval(1) = result.hess_matrix ();
+                  retval(0) = result.unitary_hess_matrix ();
+                }
             }
         }
       else if (arg.is_complex_type ())
@@ -111,8 +116,13 @@
             {
               FloatComplexHESS result (ctmp);
 
-              retval(1) = result.hess_matrix ();
-              retval(0) = result.unitary_hess_matrix ();
+              if (nargout <= 1)
+                retval(0) = result.hess_matrix ();
+              else
+                {
+                  retval(1) = result.hess_matrix ();
+                  retval(0) = result.unitary_hess_matrix ();
+                }
             }
         }
     }
@@ -126,8 +136,13 @@
             {
               HESS result (tmp);
 
-              retval(1) = result.hess_matrix ();
-              retval(0) = result.unitary_hess_matrix ();
+              if (nargout <= 1)
+                retval(0) = result.hess_matrix ();
+              else
+                {
+                  retval(1) = result.hess_matrix ();
+                  retval(0) = result.unitary_hess_matrix ();
+                }
             }
         }
       else if (arg.is_complex_type ())
@@ -138,8 +153,13 @@
             {
               ComplexHESS result (ctmp);
 
-              retval(1) = result.hess_matrix ();
-              retval(0) = result.unitary_hess_matrix ();
+              if (nargout <= 1)
+                retval(0) = result.hess_matrix ();
+              else
+                {
+                  retval(1) = result.hess_matrix ();
+                  retval(0) = result.unitary_hess_matrix ();
+                }
             }
         }
       else