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

Method signDeterminant

Eigen/src/SparseLU/SparseLU.h:309–331  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

307 * \sa absDeterminant(), logAbsDeterminant()
308 */
309 Scalar signDeterminant()
310 {
311 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
312 // Initialize with the determinant of the row matrix
313 Index det = 1;
314 // Note that the diagonal blocks of U are stored in supernodes,
315 // which are available in the L part :)
316 for (Index j = 0; j < this->cols(); ++j)
317 {
318 for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
319 {
320 if(it.index() == j)
321 {
322 if(it.value()<0)
323 det = -det;
324 else if(it.value()==0)
325 return 0;
326 break;
327 }
328 }
329 }
330 return det * m_detPermR * m_detPermC;
331 }
332
333 /** \returns The determinant of the matrix.
334 *

Callers

nothing calls this directly

Calls 3

colsMethod · 0.95
indexMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected