<p class="Example">
<span class="example">Example:</span>We initialize a Bicgstab-solver for
the problem <code>Au=f</code>, using the <a href="#control">solver control</a>
-explained above. <code>A</code> shall be a spare matrix and the vectors
+explained above. <code>A</code> shall be a sparse matrix and the vectors
<code>u</code> and <code>f</code> shall be vectors of doubles. Next,
we solve the problem.
</p>
// Include files for solver control, solver and preconditioner
#include <lac/solver_control.h>
#include <lac/solver_bicgstab.h>
-#include <lac/precondition.h>
+#include <lac/precondition_selector.h>
// Include files for matrices and vectors
#include <lac/sparsematrix.h>
SparseMatrix<double> A;
Vector<double> u,f;
-// NEED TO DEFINE A PRECONDITIONER
-solver.solve(A,u,f,precondition);
+// Generate a Jacobi preconditioner with the damping parameter 1
+PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
+
+// Use the matrix of the linear equation system for preconditioning
+// (this is the usual case).
+preconditioning.use_matrix(A);
+
+solver.solve(A,u,f,preconditioning);
</code>
</pre>
+<h2><a name="cg">SolverCG</a></h2>
+
+<p>
+This class implements the preconditioned cg-method.
+It is initialized by<br>
+<code>SolverCG (SolverControl &cn, VectorMemory<Vector> &mem)</code>.
+</p>
+<p class="Example">
+<span class="example">Example:</span>We initialize a CG-solver for
+the problem <code>Au=f</code>, using the <a href="#control">solver control</a>
+explained above. <code>A</code> shall be a sparse matrix and the vectors
+<code>u</code> and <code>f</code> shall be vectors of doubles. Next,
+we solve the problem.
+</p>
+
+<pre class="example">
+<code>
+// Include files for solver control, solver and preconditioner
+#include <lac/solver_control.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/precondition_selector.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;
+SolverCG<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.
+// <em>To make it clear: This code as it is will not do anything because</em>
+// <em>it does not contain any mathematical problem !</em>
+
+SparseMatrix<double> A;
+Vector<double> u,f;
+
+// Generate a Jacobi preconditioner with the damping parameter 1
+PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
+
+// Use the matrix of the linear equation system for preconditioning
+// (this is the usual case).
+preconditioning.use_matrix(A);
+
+solver.solve(A,u,f,preconditioning);
+</code>
+</pre>
<!-- Page Foot -->