From 35f7829af10c61e33dd2e2a7a015058e11a11ea0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 25 Mar 2017 14:17:07 +0100 Subject: update --- eigen/doc/snippets/BiCGSTAB_step_by_step.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 eigen/doc/snippets/BiCGSTAB_step_by_step.cpp (limited to 'eigen/doc/snippets/BiCGSTAB_step_by_step.cpp') diff --git a/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp b/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp new file mode 100644 index 0000000..06147bb --- /dev/null +++ b/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp @@ -0,0 +1,14 @@ + int n = 10000; + VectorXd x(n), b(n); + SparseMatrix A(n,n); + /* ... fill A and b ... */ + BiCGSTAB > solver(A); + // start from a random solution + x = VectorXd::Random(n); + solver.setMaxIterations(1); + int i = 0; + do { + x = solver.solveWithGuess(b,x); + std::cout << i << " : " << solver.error() << std::endl; + ++i; + } while (solver.info()!=Success && i<100); \ No newline at end of file -- cgit v1.2.3