\returns the natural log of the absolute value of the determinant of the matrix * of which **this is the QR decomposition * * \note This method is useful to work around the risk of overflow/underflow that's * inherent to the determinant computation. * * \sa absDeterminant(), signDeterminant() */
| 381 | * \sa absDeterminant(), signDeterminant() |
| 382 | */ |
| 383 | Scalar logAbsDeterminant() const |
| 384 | { |
| 385 | using std::log; |
| 386 | using std::abs; |
| 387 | |
| 388 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); |
| 389 | Scalar det = Scalar(0.); |
| 390 | for (Index j = 0; j < this->cols(); ++j) |
| 391 | { |
| 392 | for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) |
| 393 | { |
| 394 | if(it.row() < j) continue; |
| 395 | if(it.row() == j) |
| 396 | { |
| 397 | det += log(abs(it.value())); |
| 398 | break; |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | return det; |
| 403 | } |
| 404 | |
| 405 | /** \returns A number representing the sign of the determinant |
| 406 | * |