* \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 logAbsDeterminant(), signDeterminant()
| 251 | * \sa logAbsDeterminant(), signDeterminant() |
| 252 | */ |
| 253 | Scalar absDeterminant() |
| 254 | { |
| 255 | using std::abs; |
| 256 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); |
| 257 | // Initialize with the determinant of the row matrix |
| 258 | Scalar det = Scalar(1.); |
| 259 | // Note that the diagonal blocks of U are stored in supernodes, |
| 260 | // which are available in the L part :) |
| 261 | for (Index j = 0; j < this->cols(); ++j) |
| 262 | { |
| 263 | for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) |
| 264 | { |
| 265 | if(it.index() == j) |
| 266 | { |
| 267 | det *= abs(it.value()); |
| 268 | break; |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | return det; |
| 273 | } |
| 274 | |
| 275 | /** \returns the natural log of the absolute value of the determinant of the matrix |
| 276 | * of which **this is the QR decomposition |