changeset 3068:17e2f90e0d3b

[project @ 1997-07-08 02:17:36 by jwe]
author jwe
date Tue, 08 Jul 1997 02:18:21 +0000
parents aa76250a5b87
children db6d57d718f7
files liboctave/ChangeLog liboctave/CmplxQR.cc liboctave/dbleQR.cc src/ChangeLog src/DLD-FUNCTIONS/qr.cc src/matherr.c
diffstat 6 files changed, 67 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jul  7 21:14:41 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* dbleQR.cc (QR::init): Don't forget to initialize Q when type is raw.
+	* CmplxQR.cc (ComplexQR::init): Ditto.
+
 Sun Jun 15 21:06:37 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* lo-mappers.cc (acos (const Complex&)): Select branch that is
--- a/liboctave/CmplxQR.cc
+++ b/liboctave/CmplxQR.cc
@@ -98,6 +98,8 @@
 	      for (int i = limit + 1; i < m; i++)
 		A_fact.elem (i, j) *= tau.elem (j);
 	    }
+
+	  q = A_fact;
 	}
       else
 	{
--- a/liboctave/dbleQR.cc
+++ b/liboctave/dbleQR.cc
@@ -96,6 +96,8 @@
 	      for (int i = limit + 1; i < m; i++)
 		A_fact.elem (i, j) *= tau.elem (j);
 	    }
+
+	  q = A_fact;
 	}
       else
 	{
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jul  7 21:14:07 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* DLD-FUNCTIONS/qr.cc (Fqr): Correctly handle nargout == 0. 
+
 Wed Jul  2 16:47:09 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* matherr.c: New file.  Move matherr function here.
--- a/src/DLD-FUNCTIONS/qr.cc
+++ b/src/DLD-FUNCTIONS/qr.cc
@@ -72,7 +72,7 @@
   else if (arg_is_empty > 0)
     return octave_value_list (3, Matrix ());
 
-  QR::type type = nargout == 1 ? QR::raw
+  QR::type type = (nargout == 0 || nargout == 1) ? QR::raw
     : (nargin == 2 ? QR::economy : QR::std);
 
   if (arg.is_real_type ())
@@ -81,18 +81,32 @@
 
       if (! error_state)
 	{
-	  if (nargout < 3)
+	  switch (nargout)
 	    {
-	      QR fact (m, type);
-	      retval(1) = fact.R ();
-	      retval(0) = fact.Q ();
-	    }
-	  else
-	    {
-	      QRP fact (m, type);
-	      retval(2) = fact.P ();
-	      retval(1) = fact.R ();
-	      retval(0) = fact.Q ();
+	    case 0:
+	    case 1:
+	      {
+		QR fact (m, type);
+		retval(0) = fact.Q ();
+	      }
+	      break;
+
+	    case 2:
+	      {
+		QR fact (m, type);
+		retval(1) = fact.R ();
+		retval(0) = fact.Q ();
+	      }
+	      break;
+
+	    default:
+	      {
+		QRP fact (m, type);
+		retval(2) = fact.P ();
+		retval(1) = fact.R ();
+		retval(0) = fact.Q ();
+	      }
+	      break;
 	    }
 	}
     }
@@ -102,18 +116,32 @@
 
       if (! error_state)
 	{
-	  if (nargout < 3)
+	  switch (nargout)
 	    {
-	      ComplexQR fact (m, type);
-	      retval(1) = fact.R ();
-	      retval(0) = fact.Q ();
-	    }
-	  else
-	    {
-	      ComplexQRP fact (m, type);
-	      retval(2) = fact.P ();
-	      retval(1) = fact.R ();
-	      retval(0) = fact.Q ();
+	    case 0:
+	    case 1:
+	      {
+		ComplexQR fact (m, type);
+		retval(0) = fact.Q ();
+	      }
+	      break;
+
+	    case 2:
+	      {
+		ComplexQR fact (m, type);
+		retval(1) = fact.R ();
+		retval(0) = fact.Q ();
+	      }
+	      break;
+
+	    default:
+	      {
+		ComplexQRP fact (m, type);
+		retval(2) = fact.P ();
+		retval(1) = fact.R ();
+		retval(0) = fact.Q ();
+	      }
+	      break;
 	    }
 	}
     }
--- a/src/matherr.c
+++ b/src/matherr.c
@@ -24,9 +24,10 @@
 #include <config.h>
 #endif
 
-#include "oct-math.h"
+#if defined (EXCEPTION_IN_MATH)
 
-#if defined (EXCEPTION_IN_MATH)
+#include <math.h>
+
 int
 matherr (struct exception *x)
 {
@@ -51,8 +52,6 @@
 }
 #endif
 
-#endif
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C ***