MCPcopy Create free account
hub / github.com/dblalock/bolt / resize

Method resize

cpp/src/external/eigen/src/SparseCore/SparseMatrix.h:611–630  ·  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

609 * \sa reserve(), setZero()
610 */
611 void resize(Index rows, Index cols)
612 {
613 const Index outerSize = IsRowMajor ? rows : cols;
614 m_innerSize = IsRowMajor ? cols : rows;
615 m_data.clear();
616 if (m_outerSize != outerSize || m_outerSize==0)
617 {
618 std::free(m_outerIndex);
619 m_outerIndex = static_cast<StorageIndex*>(std::malloc((outerSize + 1) * sizeof(StorageIndex)));
620 if (!m_outerIndex) internal::throw_std_bad_alloc();
621
622 m_outerSize = outerSize;
623 }
624 if(m_innerNonZeros)
625 {
626 std::free(m_innerNonZeros);
627 m_innerNonZeros = 0;
628 }
629 memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(StorageIndex));
630 }
631
632 /** \internal
633 * 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.80

Tested by

no test coverage detected