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

Method logAbsDeterminant

include/Eigen/Eigen/src/SparseLU/SparseLU.h:383–403  ·  view source on GitHub ↗

\returns the natural log of the absolute value of the determinant of the matrix * of which **this is the QR decomposition * * \note This method is useful to work around the risk of overflow/underflow that's * inherent to the determinant computation. * * \sa absDeterminant(), signDeterminant() */

Source from the content-addressed store, hash-verified

381 * \sa absDeterminant(), signDeterminant()
382 */
383 Scalar logAbsDeterminant() const
384 {
385 using std::log;
386 using std::abs;
387
388 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
389 Scalar det = Scalar(0.);
390 for (Index j = 0; j < this->cols(); ++j)
391 {
392 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
393 {
394 if(it.row() < j) continue;
395 if(it.row() == j)
396 {
397 det += log(abs(it.value()));
398 break;
399 }
400 }
401 }
402 return det;
403 }
404
405 /** \returns A number representing the sign of the determinant
406 *

Callers

nothing calls this directly

Calls 5

colsMethod · 0.95
logFunction · 0.50
absFunction · 0.50
rowMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected