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

Function conservativeResize

include/Eigen/Eigen/src/SparseCore/SparseVector.h:272–281  ·  view source on GitHub ↗

Resizes the sparse vector to \a newSize, while leaving old values untouched. * * If the size of the vector is decreased, then the storage of the out-of bounds coefficients is kept and reserved. * Call .data().squeeze() to free extra memory. * * \sa reserve(), setZero() */

Source from the content-addressed store, hash-verified

270 * \sa reserve(), setZero()
271 */
272 void conservativeResize(Index newSize)
273 {
274 if (newSize < m_size)
275 {
276 Index i = 0;
277 while (i<m_data.size() && m_data.index(i)<newSize) ++i;
278 m_data.resize(i);
279 }
280 m_size = newSize;
281 }
282
283 void resizeNonZeros(Index size) { m_data.resize(size); }
284

Callers 2

removeOuterVectorsMethod · 0.70

Calls 3

sizeMethod · 0.45
indexMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected