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

Method determinant

cvxpy/cvxcore/include/Eigen/src/SparseLU/SparseLU.h:434–453  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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