diff liboctave/CMatrix.cc @ 15382:197774b411ec stable

rcond: use new copy of data for full factorization if positive definite cholesky factorization fails (bug #37336) * dMatrix.cc (Matrix::rcond): Don't reuse modified matrix data if positive definite cholesky factorization was attempted but fails. * CMatrix.cc (ComplexMatrix::rcond): Likewise. * fMatrix.cc (FloatMatrix::rcond): Likewise. * fCMatrix.cc (FloatComplexMatrix::rcond): Likewise. * rcond.cc: New tests.
author John W. Eaton <jwe@octave.org>
date Thu, 13 Sep 2012 15:14:47 -0400
parents 72c96de7a403
children
line wrap: on
line diff
--- a/liboctave/CMatrix.cc	Thu Jun 21 14:42:05 2012 -0400
+++ b/liboctave/CMatrix.cc	Thu Sep 13 15:14:47 2012 -0400
@@ -1786,13 +1786,15 @@
       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';
+
+              ComplexMatrix atmp = *this;
+              Complex *tmp_data = atmp.fortran_vec ();
+
               anorm = atmp.abs().sum().
                 row(static_cast<octave_idx_type>(0)).max();
 
@@ -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,8 +2103,10 @@
         {
           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();
 
           F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,