\returns The determinant of the matrix. * * \sa absDeterminant(), logAbsDeterminant() */
| 432 | * \sa absDeterminant(), logAbsDeterminant() |
| 433 | */ |
| 434 | Scalar determinant() |
| 435 | { |
| 436 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); |
| 437 | // Initialize with the determinant of the row matrix |
| 438 | Scalar det = Scalar(1.); |
| 439 | // Note that the diagonal blocks of U are stored in supernodes, |
| 440 | // which are available in the L part :) |
| 441 | for (Index j = 0; j < this->cols(); ++j) |
| 442 | { |
| 443 | for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) |
| 444 | { |
| 445 | if(it.index() == j) |
| 446 | { |
| 447 | det *= it.value(); |
| 448 | break; |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | return (m_detPermR * m_detPermC) > 0 ? det : -det; |
| 453 | } |
| 454 | |
| 455 | Index nnzL() const { return m_nnzL; }; |
| 456 | Index nnzU() const { return m_nnzU; }; |