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

Method resize

Eigen/src/SparseCore/SparseMatrix.h:621–640  ·  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

619 * \sa reserve(), setZero()
620 */
621 void resize(Index rows, Index cols)
622 {
623 const Index outerSize = IsRowMajor ? rows : cols;
624 m_innerSize = IsRowMajor ? cols : rows;
625 m_data.clear();
626 if (m_outerSize != outerSize || m_outerSize==0)
627 {
628 std::free(m_outerIndex);
629 m_outerIndex = static_cast<StorageIndex*>(std::malloc((outerSize + 1) * sizeof(StorageIndex)));
630 if (!m_outerIndex) internal::throw_std_bad_alloc();
631
632 m_outerSize = outerSize;
633 }
634 if(m_innerNonZeros)
635 {
636 std::free(m_innerNonZeros);
637 m_innerNonZeros = 0;
638 }
639 memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(StorageIndex));
640 }
641
642 /** \internal
643 * Resize the nonzero vector to \a size */

Callers 7

reserveInnerVectorsMethod · 0.45
makeCompressedMethod · 0.45
pruneMethod · 0.45
resizeNonZerosMethod · 0.45
setIdentityMethod · 0.45
collapseDuplicatesMethod · 0.45
SparseMatrix.hFile · 0.45

Calls 2

throw_std_bad_allocFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected