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

Function generate_sparse_rectangular_problem

test/spqr_support.cpp:15–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14template<typename MatrixType,typename DenseMat>
15int generate_sparse_rectangular_problem(MatrixType& A, DenseMat& dA, int maxRows = 300, int maxCols = 300)
16{
17 eigen_assert(maxRows >= maxCols);
18 typedef typename MatrixType::Scalar Scalar;
19 int rows = internal::random<int>(1,maxRows);
20 int cols = internal::random<int>(1,rows);
21 double density = (std::max)(8./(rows*cols), 0.01);
22
23 A.resize(rows,cols);
24 dA.resize(rows,cols);
25 initSparse<Scalar>(density, dA, A,ForceNonZeroDiag);
26 A.makeCompressed();
27 return rows;
28}
29
30template<typename Scalar> void test_spqr_scalar()
31{

Callers 1

test_spqr_scalarFunction · 0.70

Calls 2

makeCompressedMethod · 0.80
resizeMethod · 0.45

Tested by 1

test_spqr_scalarFunction · 0.56