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