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

Method signDeterminant

include/Eigen/Eigen/src/SparseLU/SparseLU.h:409–431  ·  view source on GitHub ↗

\returns A number representing the sign of the determinant * * \sa absDeterminant(), logAbsDeterminant() */

Source from the content-addressed store, hash-verified

407 * \sa absDeterminant(), logAbsDeterminant()
408 */
409 Scalar signDeterminant()
410 {
411 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
412 // Initialize with the determinant of the row matrix
413 Index det = 1;
414 // Note that the diagonal blocks of U are stored in supernodes,
415 // which are available in the L part :)
416 for (Index j = 0; j < this->cols(); ++j)
417 {
418 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
419 {
420 if(it.index() == j)
421 {
422 if(it.value()<0)
423 det = -det;
424 else if(it.value()==0)
425 return 0;
426 break;
427 }
428 }
429 }
430 return det * m_detPermR * m_detPermC;
431 }
432
433 /** \returns The determinant of the matrix.
434 *

Callers

nothing calls this directly

Calls 3

colsMethod · 0.95
indexMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected