Mercurial > hg > octave-lyh
changeset 6027:068e52f1c005
[project @ 2006-10-03 20:07:56 by jwe]
author | jwe |
---|---|
date | Tue, 03 Oct 2006 20:07:56 +0000 |
parents | 31bf61b463ce |
children | 3dbbbec85190 |
files | liboctave/ChangeLog liboctave/MatrixType.cc src/ChangeLog src/DLD-FUNCTIONS/luinc.cc |
diffstat | 4 files changed, 65 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2006-10-03 David Bateman <dbateman@free.fr> + + * MatrixType.cc (MatrixType::MatrixType): Avoid crash if np == 0 + or p == 0. + 2006-10-02 John W. Eaton <jwe@octave.org> * dbleDET.cc (DET::initialize2): Ensure arg to log10 is double.
--- a/liboctave/MatrixType.cc +++ b/liboctave/MatrixType.cc @@ -847,7 +847,8 @@ bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { - if (t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) + if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) && + np > 0 && p != 0) { typ = t; nperm = np;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2006-10-03 John W. Eaton <jwe@octave.org> + * DLD-FUNCTIONS/luinc.cc (Fluinc): Avoid crash if SparseLU or + SparseComplexLU constructor fails. + * DLD-FUNCTIONS/find.cc (find_nonzero_elem_idx): Delete unused variable.
--- a/src/DLD-FUNCTIONS/luinc.cc +++ b/src/DLD-FUNCTIONS/luinc.cc @@ -168,13 +168,16 @@ SparseLU fact (sm, Qinit, thresh, true, droptol, milu, udiag); - SparseMatrix P = fact.Pr (); - SparseMatrix L = P.transpose () * fact.L (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, MatrixType - (MatrixType::Permuted_Lower, - sm_nr, fact.row_perm ())); + if (! error_state) + { + SparseMatrix P = fact.Pr (); + SparseMatrix L = P.transpose () * fact.L (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (L, MatrixType + (MatrixType::Permuted_Lower, + sm_nr, fact.row_perm ())); + } } break; @@ -183,11 +186,14 @@ SparseLU fact (sm, Qinit, thresh, true, droptol, milu, udiag); - retval(2) = fact.Pr (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), - MatrixType (MatrixType::Lower)); + if (! error_state) + { + retval(2) = fact.Pr (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (fact.L (), + MatrixType (MatrixType::Lower)); + } } break; @@ -197,12 +203,15 @@ SparseLU fact (sm, Qinit, thresh, false, droptol, milu, udiag); - retval(3) = fact.Pc (); - retval(2) = fact.Pr (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), - MatrixType (MatrixType::Lower)); + if (! error_state) + { + retval(3) = fact.Pc (); + retval(2) = fact.Pr (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (fact.L (), + MatrixType (MatrixType::Lower)); + } } break; } @@ -230,13 +239,17 @@ SparseComplexLU fact (sm, Qinit, thresh, true, droptol, milu, udiag); - SparseMatrix P = fact.Pr (); - SparseComplexMatrix L = P.transpose () * fact.L (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, MatrixType - (MatrixType::Permuted_Lower, - sm_nr, fact.row_perm ())); + + if (! error_state) + { + SparseMatrix P = fact.Pr (); + SparseComplexMatrix L = P.transpose () * fact.L (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (L, MatrixType + (MatrixType::Permuted_Lower, + sm_nr, fact.row_perm ())); + } } break; @@ -245,11 +258,14 @@ SparseComplexLU fact (sm, Qinit, thresh, true, droptol, milu, udiag); - retval(2) = fact.Pr (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), - MatrixType (MatrixType::Lower)); + if (! error_state) + { + retval(2) = fact.Pr (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (fact.L (), + MatrixType (MatrixType::Lower)); + } } break; @@ -259,12 +275,15 @@ SparseComplexLU fact (sm, Qinit, thresh, false, droptol, milu, udiag); - retval(3) = fact.Pc (); - retval(2) = fact.Pr (); - retval(1) = octave_value (fact.U (), - MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), - MatrixType (MatrixType::Lower)); + if (! error_state) + { + retval(3) = fact.Pc (); + retval(2) = fact.Pr (); + retval(1) = octave_value (fact.U (), + MatrixType (MatrixType::Upper)); + retval(0) = octave_value (fact.L (), + MatrixType (MatrixType::Lower)); + } } break; }