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

Function buildProblem

doc/special_examples/Tutorial_sparse_example_details.cpp:19–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n)
20{
21 b.setZero();
22 Eigen::ArrayXd boundary = Eigen::ArrayXd::LinSpaced(n, 0,M_PI).sin().pow(2);
23 for(int j=0; j<n; ++j)
24 {
25 for(int i=0; i<n; ++i)
26 {
27 int id = i+j*n;
28 insertCoefficient(id, i-1,j, -1, coefficients, b, boundary);
29 insertCoefficient(id, i+1,j, -1, coefficients, b, boundary);
30 insertCoefficient(id, i,j-1, -1, coefficients, b, boundary);
31 insertCoefficient(id, i,j+1, -1, coefficients, b, boundary);
32 insertCoefficient(id, i,j, 4, coefficients, b, boundary);
33 }
34 }
35}
36
37void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename)
38{

Callers 1

mainFunction · 0.85

Calls 4

insertCoefficientFunction · 0.85
sinMethod · 0.80
setZeroMethod · 0.45
powMethod · 0.45

Tested by

no test coverage detected