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

Method setIdentity

include/Eigen/Eigen/src/SparseCore/SparseMatrix.h:856–867  ·  view source on GitHub ↗

Sets *this to the identity matrix. * This function also turns the matrix into compressed mode, and drop any reserved memory. */

Source from the content-addressed store, hash-verified

854 /** Sets *this to the identity matrix.
855 * This function also turns the matrix into compressed mode, and drop any reserved memory. */
856 inline void setIdentity()
857 {
858 eigen_assert(m_outerSize == m_innerSize && "ONLY FOR SQUARED MATRICES");
859 internal::conditional_aligned_delete_auto<StorageIndex, true>(m_innerNonZeros, m_outerSize);
860 m_innerNonZeros = 0;
861 m_data.resize(m_outerSize);
862 // is it necessary to squeeze?
863 m_data.squeeze();
864 std::iota(m_outerIndex, m_outerIndex + m_outerSize + 1, StorageIndex(0));
865 std::iota(innerIndexPtr(), innerIndexPtr() + m_outerSize, StorageIndex(0));
866 std::fill_n(valuePtr(), m_outerSize, Scalar(1));
867 }
868
869 inline SparseMatrix& operator=(const SparseMatrix& other)
870 {

Callers 7

factorizeMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
JacobiSVD.hFile · 0.45

Calls 2

squeezeMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected