# HG changeset patch # User jwe # Date 868328301 0 # Node ID 17e2f90e0d3b3030077e7c81c20b560a72394125 # Parent aa76250a5b875baa0643d68204aac79bab547470 [project @ 1997-07-08 02:17:36 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +Mon Jul 7 21:14:41 1997 John W. Eaton + + * 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 * lo-mappers.cc (acos (const Complex&)): Select branch that is diff --git a/liboctave/CmplxQR.cc b/liboctave/CmplxQR.cc --- 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 { diff --git a/liboctave/dbleQR.cc b/liboctave/dbleQR.cc --- 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 { diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Mon Jul 7 21:14:07 1997 John W. Eaton + + * DLD-FUNCTIONS/qr.cc (Fqr): Correctly handle nargout == 0. + Wed Jul 2 16:47:09 1997 John W. Eaton * matherr.c: New file. Move matherr function here. diff --git a/src/DLD-FUNCTIONS/qr.cc b/src/DLD-FUNCTIONS/qr.cc --- 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; } } } diff --git a/src/matherr.c b/src/matherr.c --- a/src/matherr.c +++ b/src/matherr.c @@ -24,9 +24,10 @@ #include #endif -#include "oct-math.h" +#if defined (EXCEPTION_IN_MATH) -#if defined (EXCEPTION_IN_MATH) +#include + int matherr (struct exception *x) { @@ -51,8 +52,6 @@ } #endif -#endif - /* ;;; Local Variables: *** ;;; mode: C ***