.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH solver 2rheolef "rheolef-6.5" "rheolef-6.5" "rheolef-6.5" .\" label: /*Class:solver .SH NAME \fBsolver\fP - direct or interative solver interface .\" skip: @clindex solver .\" skip: @clindex csr .\" skip: @clindex vec .\" skip: @clindex permutation .\" skip: @toindex pastix, multifrontal solver library .\" skip: @cindex Choleski factorization .\" skip: @cindex direct solver .\" skip: @cindex supernodal factorization .SH DESCRIPTION The class implements a matrix factorization: LU factorization for an unsymmetric matrix and Choleski fatorisation for a symmetric one. .PP Let \fIa\fP be a square invertible matrix in \fBcsr\fP format (see csr(2)). .\" begin_example .Sp .nf csr a; .Sp .fi .\" end_example We get the factorization by: .\" begin_example .Sp .nf solver sa (a); .Sp .fi .\" end_example Each call to the direct solver for a*x = b writes either: .\" begin_example .Sp .nf vec x = sa.solve(b); .Sp .fi .\" end_example When the matrix is modified in a computation loop but conserves its sparsity pattern, an efficient re-factorization writes: .\" begin_example .Sp .nf sa.update_values (new_a); x = sa.solve(b); .Sp .fi .\" end_example This approach skip the long step of the symbolic factization step. .PP .SH ITERATIVE SOLVER The factorization can also be incomplete, i.e. a pseudo-inverse, suitable for preconditionning iterative methods. In that case, the sa.solve(b) call runs a conjugate gradient when the matrix is symmetric, or a generalized minimum residual algorithm when the matrix is unsymmetric. .PP .SH AUTOMATIC CHOICE AND CUSTOMIZATION The symmetry of the matrix is tested via the a.is_symmetric() property (see csr(2)) while the choice between direct or iterative solver is switched from the a.pattern_dimension() value. When the pattern is 3D, an iterative method is faster and less memory consuming. Otherwhise, for 1D or 2D problems, the direct method is prefered. .PP These default choices can be supersetted by using explicit options: .\" begin_example .Sp .nf solver_option_type opt; opt.iterative = true; solver sa (a, opt); .Sp .fi .\" end_example See the solver.h header for the complete list of available options. .PP .SH IMPLEMENTATION NOTE The implementation bases on the pastix library. .PP .\" skip start:AUTHOR: .\" skip start:DATE: .\" END .SH IMPLEMENTATION .\" begin_example .Sp .nf template class solver_basic : public smart_pointer > { public: // typedefs: typedef solver_rep rep; typedef smart_pointer base; // allocator: solver_basic (); explicit solver_basic (const csr& a, const solver_option_type& opt = solver_option_type()); void update_values (const csr& a); // accessors: vec trans_solve (const vec& b) const; vec solve (const vec& b) const; }; // factorizations: template solver_basic ldlt(const csr& a, const solver_option_type& opt = solver_option_type()); template solver_basic lu (const csr& a, const solver_option_type& opt = solver_option_type()); template solver_basic ic0 (const csr& a, const solver_option_type& opt = solver_option_type()); template solver_basic ilu0(const csr& a, const solver_option_type& opt = solver_option_type()); typedef solver_basic solver; .Sp .fi .\" end_example .\" LENGTH = 2 .SH SEE ALSO csr(2), csr(2)