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

Method determinant

include/Eigen/Eigen/src/SparseLU/SparseLU.h:437–456  ·  view source on GitHub ↗

\returns The determinant of the matrix. * * \sa absDeterminant(), logAbsDeterminant() */

Source from the content-addressed store, hash-verified

435 * \sa absDeterminant(), logAbsDeterminant()
436 */
437 Scalar determinant()
438 {
439 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
440 // Initialize with the determinant of the row matrix
441 Scalar det = Scalar(1.);
442 // Note that the diagonal blocks of U are stored in supernodes,
443 // which are available in the L part :)
444 for (Index j = 0; j < this->cols(); ++j)
445 {
446 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
447 {
448 if(it.index() == j)
449 {
450 det *= it.value();
451 break;
452 }
453 }
454 }
455 return (m_detPermR * m_detPermC) > 0 ? det : -det;
456 }
457
458 Index nnzL() const { return m_nnzL; }
459 Index nnzU() const { return m_nnzU; }

Callers 1

factorizeMethod · 0.45

Calls 3

colsMethod · 0.95
indexMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected