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

Method absDeterminant

Eigen/src/SparseLU/SparseLU.h:253–273  ·  view source on GitHub ↗

* \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), signDeterminant()

Source from the content-addressed store, hash-verified

251 * \sa logAbsDeterminant(), signDeterminant()
252 */
253 Scalar absDeterminant()
254 {
255 using std::abs;
256 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
257 // Initialize with the determinant of the row matrix
258 Scalar det = Scalar(1.);
259 // Note that the diagonal blocks of U are stored in supernodes,
260 // which are available in the L part :)
261 for (Index j = 0; j < this->cols(); ++j)
262 {
263 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
264 {
265 if(it.index() == j)
266 {
267 det *= abs(it.value());
268 break;
269 }
270 }
271 }
272 return det;
273 }
274
275 /** \returns the natural log of the absolute value of the determinant of the matrix
276 * of which **this is the QR decomposition

Callers

nothing calls this directly

Calls 4

colsMethod · 0.95
absFunction · 0.50
indexMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected