Mercurial > hg > octave-lyh
changeset 10213:f7ba6cfe7fb7
fix det() after singular matrix is flagged
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 28 Jan 2010 08:06:13 +0100 |
parents | 56f7734f5448 |
children | 57e24c53e063 |
files | liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc liboctave/fCMatrix.cc liboctave/fMatrix.cc |
diffstat | 5 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1577,8 +1577,14 @@ { volatile int typ = mattype.type (); + // Even though the matrix is marked as singular (Rectangular), we may + // still get a useful number from the LU factorization, because it always + // completes. + if (typ == MatrixType::Unknown) typ = mattype.type (*this); + else if (typ == MatrixType::Rectangular) + typ = MatrixType::Full; if (typ == MatrixType::Lower || typ == MatrixType::Upper) {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,11 @@ +2010-01-28 Jaroslav Hajek <highegg@gmail.com> + + * dMatrix.cc (Matrix::determinant): Treat matrices marked as singular + normally. + * fMatrix.cc (FloatMatrix::determinant): Ditto. + * CMatrix.cc (ComplexMatrix::determinant): Ditto. + * fCMatrix.cc (FloatComplexMatrix::determinant): Ditto. + 2010-01-26 John W. Eaton <jwe@octave.org> * file-ops.cc: Don't tag functions with OCTAVE_API in source file.
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -1242,8 +1242,14 @@ { volatile int typ = mattype.type (); + // Even though the matrix is marked as singular (Rectangular), we may + // still get a useful number from the LU factorization, because it always + // completes. + if (typ == MatrixType::Unknown) typ = mattype.type (*this); + else if (typ == MatrixType::Rectangular) + typ = MatrixType::Full; if (typ == MatrixType::Lower || typ == MatrixType::Upper) {
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -1570,8 +1570,14 @@ { volatile int typ = mattype.type (); + // Even though the matrix is marked as singular (Rectangular), we may + // still get a useful number from the LU factorization, because it always + // completes. + if (typ == MatrixType::Unknown) typ = mattype.type (*this); + else if (typ == MatrixType::Rectangular) + typ = MatrixType::Full; if (typ == MatrixType::Lower || typ == MatrixType::Upper) {
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -1241,8 +1241,14 @@ { volatile int typ = mattype.type (); + // Even though the matrix is marked as singular (Rectangular), we may + // still get a useful number from the LU factorization, because it always + // completes. + if (typ == MatrixType::Unknown) typ = mattype.type (*this); + else if (typ == MatrixType::Rectangular) + typ = MatrixType::Full; if (typ == MatrixType::Lower || typ == MatrixType::Upper) {