From: schrage
-#include
@@ -85,11 +85,40 @@ It is initialized by
Example:We initialize a Bicgstab-solver for
-the problem Au=f
.
+the problem Au=f
, using the solver control
+explained above. A
shall be a spare matrix and the vectors
+u
and f
shall be vectors of doubles. Next,
+we solve the problem.
+// Include files for solver control, solver and preconditioner
+#include <lac/solver_control.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/precondition.h>
+
+// Include files for matrices and vectors
+#include <lac/sparsematrix.h>
+#include <lac/vector.h>
+
+// Initialize the solver control and the solver
+
+SolverControl control(1000,1e-6);
+VectorMemory<Vector<double> > vectormem;
+SolverBicgstab<SparseMatrix,Vector<double> > solver(control,vectormem);
+
+// Initialize the problem matrices. Well...they shouldn't only be
+// initialized but also contain the problem, so this is just an example
+// to get the definitions and types and everything right.
+// To make it clear: This code as it is will not do anything because
+// it does not contain any mathematical problem !
+
+SparseMatrix<double> A;
+Vector<double> u,f;
+// NEED TO DEFINE A PRECONDITIONER
+
+solver.solve(A,u,f,precondition);