MCPcopy Create free account
hub / github.com/PX4/eigen / logAbsDeterminant

Method logAbsDeterminant

Eigen/src/SparseLU/SparseLU.h:283–303  ·  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

281 * \sa absDeterminant(), signDeterminant()
282 */
283 Scalar logAbsDeterminant() const
284 {
285 using std::log;
286 using std::abs;
287
288 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
289 Scalar det = Scalar(0.);
290 for (Index j = 0; j < this->cols(); ++j)
291 {
292 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
293 {
294 if(it.row() < j) continue;
295 if(it.row() == j)
296 {
297 det += log(abs(it.value()));
298 break;
299 }
300 }
301 }
302 return det;
303 }
304
305 /** \returns A number representing the sign of the determinant
306 *

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