aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/BiCGSTAB_simple.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-10-16 15:25:39 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-10-16 15:25:39 +0200
commitc6da881849734fc8c76a151e60da3bc65ef2e2fd (patch)
tree160f6b0e5d82ec7a9abe084251efad6f0f74a2a8 /doc/snippets/BiCGSTAB_simple.cpp
parentb61facb08b1e6c49724f27e15d72b490c6c07d8f (diff)
Fix bug #674: typo in documentation example for BiCGSTAB. They are now proper snippet files.
Diffstat (limited to 'doc/snippets/BiCGSTAB_simple.cpp')
-rw-r--r--doc/snippets/BiCGSTAB_simple.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/snippets/BiCGSTAB_simple.cpp b/doc/snippets/BiCGSTAB_simple.cpp
new file mode 100644
index 000000000..5520f4f1f
--- /dev/null
+++ b/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