diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-10-16 15:25:39 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-10-16 15:25:39 +0200 |
commit | c6da881849734fc8c76a151e60da3bc65ef2e2fd (patch) | |
tree | 160f6b0e5d82ec7a9abe084251efad6f0f74a2a8 /doc/snippets/BiCGSTAB_step_by_step.cpp | |
parent | b61facb08b1e6c49724f27e15d72b490c6c07d8f (diff) |
Fix bug #674: typo in documentation example for BiCGSTAB. They are now proper snippet files.
Diffstat (limited to 'doc/snippets/BiCGSTAB_step_by_step.cpp')
-rw-r--r-- | doc/snippets/BiCGSTAB_step_by_step.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/snippets/BiCGSTAB_step_by_step.cpp b/doc/snippets/BiCGSTAB_step_by_step.cpp new file mode 100644 index 000000000..06147bb81 --- /dev/null +++ b/doc/snippets/BiCGSTAB_step_by_step.cpp @@ -0,0 +1,14 @@ + int n = 10000; + VectorXd x(n), b(n); + SparseMatrix<double> A(n,n); + /* ... fill A and b ... */ + BiCGSTAB<SparseMatrix<double> > 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 |