changeset 15383:2137f5638521

maint: periodic merge of stable to default
author John W. Eaton <jwe@octave.org>
date Thu, 13 Sep 2012 15:20:16 -0400
parents e4c6947d87cd (current diff) 197774b411ec (diff)
children d8d7596fc68d
files libinterp/corefcn/rcond.cc liboctave/array/CMatrix.cc liboctave/array/dMatrix.cc liboctave/array/fCMatrix.cc liboctave/array/fMatrix.cc
diffstat 5 files changed, 63 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/rcond.cc	Thu Sep 13 11:21:22 2012 -0700
+++ b/libinterp/corefcn/rcond.cc	Thu Sep 13 15:20:16 2012 -0400
@@ -91,4 +91,13 @@
 %!assert (rcond (ones (2)), 0)
 %!assert (rcond ([1 1; 2 1]), 1/9)
 %!assert (rcond (magic (4)), 0, eps)
+
+%!shared x, sx
+%! x = [-5.25, -2.25; -2.25, 1] * eps () + ones (2) / 2;
+%! sx = [-5.25, -2.25; -2.25, 1] * eps ("single") + ones (2) / 2;
+%!assert (rcond (x) < eps ());
+%!assert (rcond (sx) < eps ('single'));
+%!assert (rcond (x*i) < eps ());
+%!assert (rcond (sx*i) < eps ('single'));
+
 */
--- a/liboctave/array/CMatrix.cc	Thu Sep 13 11:21:22 2012 -0700
+++ b/liboctave/array/CMatrix.cc	Thu Sep 13 15:20:16 2012 -0400
@@ -1786,15 +1786,17 @@
       else if (typ == MatrixType::Full || typ == MatrixType::Hermitian)
         {
           double anorm = -1.0;
-          ComplexMatrix atmp = *this;
-          Complex *tmp_data = atmp.fortran_vec ();
 
           if (typ == MatrixType::Hermitian)
             {
               octave_idx_type info = 0;
               char job = 'L';
-              anorm = atmp.abs ().sum ().
-                row(static_cast<octave_idx_type>(0)).max ();
+
+              ComplexMatrix atmp = *this;
+              Complex *tmp_data = atmp.fortran_vec ();
+
+              anorm = atmp.abs().sum().
+                row(static_cast<octave_idx_type>(0)).max();
 
               F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                          tmp_data, nr, info
@@ -1829,6 +1831,9 @@
             {
               octave_idx_type info = 0;
 
+              ComplexMatrix atmp = *this;
+              Complex *tmp_data = atmp.fortran_vec ();
+
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
@@ -2098,9 +2103,11 @@
         {
           info = 0;
           char job = 'L';
+
           ComplexMatrix atmp = *this;
           Complex *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
--- a/liboctave/array/dMatrix.cc	Thu Sep 13 11:21:22 2012 -0700
+++ b/liboctave/array/dMatrix.cc	Thu Sep 13 15:20:16 2012 -0400
@@ -1454,15 +1454,17 @@
       else if (typ == MatrixType::Full || typ == MatrixType::Hermitian)
         {
           double anorm = -1.0;
-          Matrix atmp = *this;
-          double *tmp_data = atmp.fortran_vec ();
 
           if (typ == MatrixType::Hermitian)
             {
               octave_idx_type info = 0;
               char job = 'L';
-              anorm = atmp.abs ().sum ().
-                row(static_cast<octave_idx_type>(0)).max ();
+
+              Matrix atmp = *this;
+              double *tmp_data = atmp.fortran_vec ();
+
+              anorm = atmp.abs().sum().
+                row(static_cast<octave_idx_type>(0)).max();
 
               F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                          tmp_data, nr, info
@@ -1495,6 +1497,9 @@
             {
               octave_idx_type info = 0;
 
+              Matrix atmp = *this;
+              double *tmp_data = atmp.fortran_vec ();
+
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
@@ -1760,9 +1765,11 @@
         {
           info = 0;
           char job = 'L';
+
           Matrix atmp = *this;
           double *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -1838,8 +1845,9 @@
 
           Matrix atmp = *this;
           double *tmp_data = atmp.fortran_vec ();
-          if (anorm < 0.)
-            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          if(anorm < 0.)
+            anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           Array<double> z (dim_vector (4 * nc, 1));
           double *pz = z.fortran_vec ();
--- a/liboctave/array/fCMatrix.cc	Thu Sep 13 11:21:22 2012 -0700
+++ b/liboctave/array/fCMatrix.cc	Thu Sep 13 15:20:16 2012 -0400
@@ -1782,15 +1782,17 @@
       else if (typ == MatrixType::Full || typ == MatrixType::Hermitian)
         {
           float anorm = -1.0;
-          FloatComplexMatrix atmp = *this;
-          FloatComplex *tmp_data = atmp.fortran_vec ();
 
           if (typ == MatrixType::Hermitian)
             {
               octave_idx_type info = 0;
               char job = 'L';
-              anorm = atmp.abs ().sum ().
-                row(static_cast<octave_idx_type>(0)).max ();
+
+              FloatComplexMatrix atmp = *this;
+              FloatComplex *tmp_data = atmp.fortran_vec ();
+
+              anorm = atmp.abs().sum().
+                row(static_cast<octave_idx_type>(0)).max();
 
               F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                          tmp_data, nr, info
@@ -1825,6 +1827,9 @@
             {
               octave_idx_type info = 0;
 
+              FloatComplexMatrix atmp = *this;
+              FloatComplex *tmp_data = atmp.fortran_vec ();
+
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
@@ -2094,9 +2099,11 @@
         {
           info = 0;
           char job = 'L';
+
           FloatComplexMatrix atmp = *this;
           FloatComplex *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
--- a/liboctave/array/fMatrix.cc	Thu Sep 13 11:21:22 2012 -0700
+++ b/liboctave/array/fMatrix.cc	Thu Sep 13 15:20:16 2012 -0400
@@ -1454,15 +1454,17 @@
       else if (typ == MatrixType::Full || typ == MatrixType::Hermitian)
         {
           float anorm = -1.0;
-          FloatMatrix atmp = *this;
-          float *tmp_data = atmp.fortran_vec ();
 
           if (typ == MatrixType::Hermitian)
             {
               octave_idx_type info = 0;
               char job = 'L';
-              anorm = atmp.abs ().sum ().
-                row (static_cast<octave_idx_type>(0)).max ();
+
+              FloatMatrix atmp = *this;
+              float *tmp_data = atmp.fortran_vec ();
+
+              anorm = atmp.abs().sum().
+                row(static_cast<octave_idx_type>(0)).max();
 
               F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                          tmp_data, nr, info
@@ -1495,6 +1497,9 @@
             {
               octave_idx_type info = 0;
 
+              FloatMatrix atmp = *this;
+              float *tmp_data = atmp.fortran_vec ();
+
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
@@ -1760,9 +1765,11 @@
         {
           info = 0;
           char job = 'L';
+
           FloatMatrix atmp = *this;
           float *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -1838,8 +1845,9 @@
 
           FloatMatrix atmp = *this;
           float *tmp_data = atmp.fortran_vec ();
-          if (anorm < 0.)
-            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
+
+          if(anorm < 0.)
+            anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max();
 
           Array<float> z (dim_vector (4 * nc, 1));
           float *pz = z.fortran_vec ();