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	Thu Jan 28 07:12:59 2010 +0100
+++ b/liboctave/CMatrix.cc	Thu Jan 28 08:06:13 2010 +0100
@@ -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	Thu Jan 28 07:12:59 2010 +0100
+++ b/liboctave/ChangeLog	Thu Jan 28 08:06:13 2010 +0100
@@ -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	Thu Jan 28 07:12:59 2010 +0100
+++ b/liboctave/dMatrix.cc	Thu Jan 28 08:06:13 2010 +0100
@@ -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	Thu Jan 28 07:12:59 2010 +0100
+++ b/liboctave/fCMatrix.cc	Thu Jan 28 08:06:13 2010 +0100
@@ -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	Thu Jan 28 07:12:59 2010 +0100
+++ b/liboctave/fMatrix.cc	Thu Jan 28 08:06:13 2010 +0100
@@ -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)
         {