| 8 | void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename); |
| 9 | |
| 10 | int main(int argc, char** argv) |
| 11 | { |
| 12 | assert(argc==2); |
| 13 | |
| 14 | int n = 300; // size of the image |
| 15 | int m = n*n; // number of unknows (=number of pixels) |
| 16 | |
| 17 | // Assembly: |
| 18 | std::vector<T> coefficients; // list of non-zeros coefficients |
| 19 | Eigen::VectorXd b(m); // the right hand side-vector resulting from the constraints |
| 20 | buildProblem(coefficients, b, n); |
| 21 | |
| 22 | SpMat A(m,m); |
| 23 | A.setFromTriplets(coefficients.begin(), coefficients.end()); |
| 24 | |
| 25 | // Solving: |
| 26 | Eigen::SimplicialCholesky<SpMat> chol(A); // performs a Cholesky factorization of A |
| 27 | Eigen::VectorXd x = chol.solve(b); // use the factorization to solve for the given right hand side |
| 28 | |
| 29 | // Export the result to a file: |
| 30 | saveAsBitmap(x, n, argv[1]); |
| 31 | |
| 32 | return 0; |
| 33 | } |
| 34 |
nothing calls this directly
no test coverage detected