Mercurial > hg > octave-max
comparison liboctave/fCMatrix.cc @ 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 | 0522a65bcd56 |
children | 07ebe522dac2 |
comparison
equal
deleted
inserted
replaced
10212:56f7734f5448 | 10213:f7ba6cfe7fb7 |
---|---|
1568 (*current_liboctave_error_handler) ("matrix must be square"); | 1568 (*current_liboctave_error_handler) ("matrix must be square"); |
1569 else | 1569 else |
1570 { | 1570 { |
1571 volatile int typ = mattype.type (); | 1571 volatile int typ = mattype.type (); |
1572 | 1572 |
1573 // Even though the matrix is marked as singular (Rectangular), we may | |
1574 // still get a useful number from the LU factorization, because it always | |
1575 // completes. | |
1576 | |
1573 if (typ == MatrixType::Unknown) | 1577 if (typ == MatrixType::Unknown) |
1574 typ = mattype.type (*this); | 1578 typ = mattype.type (*this); |
1579 else if (typ == MatrixType::Rectangular) | |
1580 typ = MatrixType::Full; | |
1575 | 1581 |
1576 if (typ == MatrixType::Lower || typ == MatrixType::Upper) | 1582 if (typ == MatrixType::Lower || typ == MatrixType::Upper) |
1577 { | 1583 { |
1578 for (octave_idx_type i = 0; i < nc; i++) | 1584 for (octave_idx_type i = 0; i < nc; i++) |
1579 retval *= elem (i,i); | 1585 retval *= elem (i,i); |