MCPcopy Create free account
hub / github.com/Derious/cuMPC / absDeterminant

Method absDeterminant

dependence/eigen-3.4.0/Eigen/src/SparseLU/SparseLU.h:350–370  ·  view source on GitHub ↗

* \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()

Source from the content-addressed store, hash-verified

348 * \sa logAbsDeterminant(), signDeterminant()
349 */
350 Scalar absDeterminant()
351 {
352 using std::abs;
353 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
354 // Initialize with the determinant of the row matrix
355 Scalar det = Scalar(1.);
356 // Note that the diagonal blocks of U are stored in supernodes,
357 // which are available in the L part :)
358 for (Index j = 0; j < this->cols(); ++j)
359 {
360 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
361 {
362 if(it.index() == j)
363 {
364 det *= abs(it.value());
365 break;
366 }
367 }
368 }
369 return det;
370 }
371
372 /** \returns the natural log of the absolute value of the determinant of the matrix
373 * of which **this is the QR decomposition

Callers

nothing calls this directly

Calls 4

colsMethod · 0.95
absFunction · 0.50
indexMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected