Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
#include <cusp/monitor.h>
#include <cusp/krylov/cg.h>
int main(void)
// create an empty sparse matrix structure (CSR format)
// initialize matrix
// allocate storage for solution (x) and right hand side (b)
// set stopping criteria:
// iteration_limit = 100
// relative_tolerance = 1e-6
cusp::monitor<float> monitor(b, 100, 1e-6);
// solve the linear system A x = b
cusp::krylov::cg(A, x, b, monitor);
// monitor will report solver progress and results
return 0;