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

Function insertCoefficient

doc/special_examples/Tutorial_sparse_example_details.cpp:8–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6typedef Eigen::Triplet<double> T;
7
8void insertCoefficient(int id, int i, int j, double w, std::vector<T>& coeffs,
9 Eigen::VectorXd& b, const Eigen::VectorXd& boundary)
10{
11 int n = int(boundary.size());
12 int id1 = i+j*n;
13
14 if(i==-1 || i==n) b(id) -= w * boundary(j); // constrained coefficient
15 else if(j==-1 || j==n) b(id) -= w * boundary(i); // constrained coefficient
16 else coeffs.push_back(T(id,id1,w)); // unknown coefficient
17}
18
19void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n)
20{

Callers 1

buildProblemFunction · 0.85

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected