# HG changeset patch # User Jaroslav Hajek # Date 1264662373 -3600 # Node ID f7ba6cfe7fb74c2266530945ca8316aae7bb0032 # Parent 56f7734f5448864a07493f48cbc34dbaa4e4922d fix det() after singular matrix is flagged diff --git a/liboctave/CMatrix.cc b/liboctave/CMatrix.cc --- 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) { diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,11 @@ +2010-01-28 Jaroslav Hajek + + * 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 * file-ops.cc: Don't tag functions with OCTAVE_API in source file. diff --git a/liboctave/dMatrix.cc b/liboctave/dMatrix.cc --- 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) { diff --git a/liboctave/fCMatrix.cc b/liboctave/fCMatrix.cc --- 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) { diff --git a/liboctave/fMatrix.cc b/liboctave/fMatrix.cc --- 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) {