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

Method makeCompressed

Eigen/src/SparseCore/SparseMatrix.h:464–492  ·  view source on GitHub ↗

Turns the matrix into the \em compressed format. */

Source from the content-addressed store, hash-verified

462 /** Turns the matrix into the \em compressed format.
463 */
464 void makeCompressed()
465 {
466 if(isCompressed())
467 return;
468
469 eigen_internal_assert(m_outerIndex!=0 && m_outerSize>0);
470
471 Index oldStart = m_outerIndex[1];
472 m_outerIndex[1] = m_innerNonZeros[0];
473 for(Index j=1; j<m_outerSize; ++j)
474 {
475 Index nextOldStart = m_outerIndex[j+1];
476 Index offset = oldStart - m_outerIndex[j];
477 if(offset>0)
478 {
479 for(Index k=0; k<m_innerNonZeros[j]; ++k)
480 {
481 m_data.index(m_outerIndex[j]+k) = m_data.index(oldStart+k);
482 m_data.value(m_outerIndex[j]+k) = m_data.value(oldStart+k);
483 }
484 }
485 m_outerIndex[j+1] = m_outerIndex[j] + m_innerNonZeros[j];
486 oldStart = nextOldStart;
487 }
488 std::free(m_innerNonZeros);
489 m_innerNonZeros = 0;
490 m_data.resize(m_outerIndex[m_outerSize]);
491 m_data.squeeze();
492 }
493
494 /** Turns the matrix into the uncompressed mode */
495 void uncompress()

Callers 15

factorizeMethod · 0.80
runMethod · 0.80
factorizeMethod · 0.80
getMatrixMethod · 0.80
getMatrixMethod · 0.80
getMatrixMethod · 0.80

Calls 4

indexMethod · 0.45
valueMethod · 0.45
resizeMethod · 0.45
squeezeMethod · 0.45

Tested by

no test coverage detected