| 17 | } |
| 18 | |
| 19 | void 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 | |
| 37 | void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename) |
| 38 | { |
no test coverage detected