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

Function resize

test/array_for_matrix.cpp:212–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212template<typename MatrixTraits> void resize(const MatrixTraits& t)
213{
214 typedef typename MatrixTraits::Index Index;
215 typedef typename MatrixTraits::Scalar Scalar;
216 typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
217 typedef Array<Scalar,Dynamic,Dynamic> Array2DType;
218 typedef Matrix<Scalar,Dynamic,1> VectorType;
219 typedef Array<Scalar,Dynamic,1> Array1DType;
220
221 Index rows = t.rows(), cols = t.cols();
222
223 MatrixType m(rows,cols);
224 VectorType v(rows);
225 Array2DType a2(rows,cols);
226 Array1DType a1(rows);
227
228 m.array().resize(rows+1,cols+1);
229 VERIFY(m.rows()==rows+1 && m.cols()==cols+1);
230 a2.matrix().resize(rows+1,cols+1);
231 VERIFY(a2.rows()==rows+1 && a2.cols()==cols+1);
232 v.array().resize(cols);
233 VERIFY(v.size()==cols);
234 a1.matrix().resize(cols);
235 VERIFY(a1.size()==cols);
236}
237
238template<int>
239void regression_bug_654()

Callers 1

test_array_for_matrixFunction · 0.70

Calls 6

rowsMethod · 0.45
colsMethod · 0.45
resizeMethod · 0.45
arrayMethod · 0.45
matrixMethod · 0.45
sizeMethod · 0.45

Tested by 1

test_array_for_matrixFunction · 0.56