diff options
Diffstat (limited to 'eigen/doc/snippets/BiCGSTAB_simple.cpp')
-rw-r--r-- | eigen/doc/snippets/BiCGSTAB_simple.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/eigen/doc/snippets/BiCGSTAB_simple.cpp b/eigen/doc/snippets/BiCGSTAB_simple.cpp new file mode 100644 index 0000000..5520f4f --- /dev/null +++ b/eigen/doc/snippets/BiCGSTAB_simple.cpp @@ -0,0 +1,11 @@ + int n = 10000; + VectorXd x(n), b(n); + SparseMatrix<double> A(n,n); + /* ... fill A and b ... */ + BiCGSTAB<SparseMatrix<double> > solver; + solver.compute(A); + x = solver.solve(b); + std::cout << "#iterations: " << solver.iterations() << std::endl; + std::cout << "estimated error: " << solver.error() << std::endl; + /* ... update b ... */ + x = solver.solve(b); // solve again
\ No newline at end of file |