MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / absDeterminant

Method absDeterminant

include/Eigen/Eigen/src/SparseLU/SparseLU.h:353–373  ·  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

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