\brief Give the absolute value of the determinant. * * \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa l
| 369 | * \sa logAbsDeterminant(), signDeterminant() |
| 370 | */ |
| 371 | Scalar absDeterminant() { |
| 372 | using std::abs; |
| 373 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); |
| 374 | // Initialize with the determinant of the row matrix |
| 375 | Scalar det = Scalar(1.); |
| 376 | // Note that the diagonal blocks of U are stored in supernodes, |
| 377 | // which are available in the L part :) |
| 378 | for (Index j = 0; j < this->cols(); ++j) { |
| 379 | for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { |
| 380 | if (it.index() == j) { |
| 381 | det *= abs(it.value()); |
| 382 | break; |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | return det; |
| 387 | } |
| 388 | |
| 389 | /** \brief Give the natural log of the absolute determinant. |
| 390 | * |