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

Method resize

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

Resizes the matrix to a \a rows x \a cols matrix and initializes it to zero. * * This function does not free the currently allocated memory. To release as much as memory as possible, * call \code mat.data().squeeze(); \endcode after resizing it. * * \sa reserve(), setZero() */

Source from the content-addressed store, hash-verified

737 * \sa reserve(), setZero()
738 */
739 void resize(Index rows, Index cols)
740 {
741 const Index outerSize = IsRowMajor ? rows : cols;
742 m_innerSize = IsRowMajor ? cols : rows;
743 m_data.clear();
744
745 if ((m_outerIndex == 0) || (m_outerSize != outerSize)) {
746 m_outerIndex = internal::conditional_aligned_realloc_new_auto<StorageIndex, true>(m_outerIndex, outerSize + 1, m_outerSize + 1);
747 m_outerSize = outerSize;
748 }
749
750 internal::conditional_aligned_delete_auto<StorageIndex, true>(m_innerNonZeros, m_outerSize);
751 m_innerNonZeros = 0;
752
753 std::fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0));
754 }
755
756 /** \internal
757 * Resize the nonzero vector to \a size */

Callers 11

reserveInnerVectorsMethod · 0.45
makeCompressedMethod · 0.45
pruneMethod · 0.45
conservativeResizeMethod · 0.45
resizeNonZerosMethod · 0.45
setIdentityMethod · 0.45
assignDiagonalMethod · 0.45
set_from_triplets_sortedFunction · 0.45
collapseDuplicatesMethod · 0.45
SparseMatrix.hFile · 0.45
deserializeMethod · 0.45

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected