---
name: "solver_option"
section: "2rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.0-2+b1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/solver_option"
---

# solver\_option(2rheolef)

options for direct or interative solvers

## NAME

**solver\_option** - options for direct or interative solvers

## DESCRIPTION

This class implements a set of options for direct or iterative solvers, as implemented by the solver(2). An instance of this class can be supplied to the **solver** constructor.

## OPTIONS

- **iterative**

  Indicate if we want to use an iterative solver or a a direct one. Default is direct for 1D or 2D problems and iterative for 3D ones. Direct solver is **mumps** when available, otherwise **umfpack** or builtin solver when none of these solvers are available at Rheolef configure time. Iterative solver is **cg** for symmetric positive definite systems and **gmres** otherwise.

## OPTIONS FOR ITERATIVE SOLVERS

- **tol**

  Tolerance for the stopping criterion. Default is the machine epsilon for the default **Float** type. The default **Float** type is **double** defined at Rheolef configure time and is **double** by default, when no special configure option is used.

- **max\_iter**

  Maximum number of iteration when using iterative method.

- **absolute\_stopping**

  Absolute or relative stopping criterion. With the absolute criterion, the algorithm stops when **norm(A\*x-b) \< tol**, otherwise it stops when **norm(A\*x-b) \< tol\*norm(b)**. Default is to use an absolute stopping criterion.

- **residue**

  On return, gives the obtained residue, optionally divided by the initial one when using a relatiive stopping. It is less or equal to **tol** when the iterative algorithm stops with succes.

- **n\_iter**

  On return, gives the number of iterations performed. It is always less or equal to **max\_iter** when the iterative algorithm stops with succes.

- **p\_err**

  A pointer to the **odiststeam** standard error where residues are printed during iterations. When this pointer is zero, no errors are printed. Default is to print to **derr**.

- **label**

  When printing errors, each line is prefixed by **\[@var{label**\]}. When the label is empty, each iterative algorithm uses its default label, e.g. **"cg"** for the conjugate gradient **cg**. By default the label is empty and this option is used to superset the algorithm default.

- **krylov\_dimension**

  The dimension of the Krylov space used by the **gmres** algorithm. Default is **krylov\_dimension=6**.

## OPTIONS FOR DIRECT SOLVERS

- **n\_refinement**

  Number of iterative refinement, when using direct method (**umfpack** only support it). This option is only active when using iterative solvers.

- **compute\_determinant**

  Compute also the determinant of the matrix. This option is only active when using direct solvers. Requires **mumps** or **umfpack**.

- **prefered\_library**

  When both **mumps** and **umfpack** are available, then **mumps** is the default. This option allows one to force to choose **umfpack**, by setting the string to **"umfpack"**. This option is only active when using direct solvers.

## OPTIONS FOR DEVELOPPERS

- **verbose\_level**

  Can be set to 0, 1, 2 or 3. The default is 0.

- **level\_of\_fill**

  Built an incomplete factorization with the prescribed level of fill \[1:5\].

- **do\_check**

  Performs extra checks for debug.

- **force\_seq**

  In distributed mode, restrict the linear system resolution to diagonal blocs per process. This option is only active when using the **mumps** direct solver.

- **ooc**

  Out-of-core limit (Mo/percent depending on compilation options). In development.

- **amalgamation**

  Level of amalgamation \[10:70\] for Kass. In development.

## IMPLEMENTATION

```
class solver_option {
public:
  typedef std::size_t size_type;
  static const long int  decide = -1;
  mutable long int   iterative;
  Float              tol;
  size_type          max_iter;
  bool               absolute_stopping;
  mutable Float      residue;
  mutable size_type  n_iter;
  odiststream*       p_err;
  mutable std::string label;
  size_type          krylov_dimension;
  size_type          n_refinement;
  bool               compute_determinant;
  std::string        prefered_library;
  size_type          verbose_level;
  bool               do_check;
  bool               force_seq;
  size_type          level_of_fill;
  size_type          amalgamation;
  size_type          ooc;
// allocator and default values:
  solver_option()
   : iterative     (decide),
#if defined(_RHEOLEF_HAVE_FLOAT128)
     tol           (1e6*std::numeric_limits<Float>::epsilon()),
#else
     tol           (std::numeric_limits<Float>::epsilon()),
#endif
     max_iter      (100000),
     absolute_stopping (true),
     residue       (0),
     n_iter        (0),
     p_err         (&derr),
     label         (),
     krylov_dimension (6),
     n_refinement  (2),
     compute_determinant(false),
     prefered_library(),
     verbose_level (0),
     do_check      (false),
     force_seq     (false),
     level_of_fill (1),
     amalgamation  (10),
     ooc           (20000)
  {
  }
  solver_option (const solver_option&);
  solver_option& operator= (const solver_option&);
};

```

## SEE ALSO

solver(2)

## COPYRIGHT

Copyright (C) 2000-2018 Pierre Saramito \<Pierre.Saramito@imag.fr\> GPLv3+: GNU GPL version 3 or later \<http://gnu.org/licenses/gpl.html\>. This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.
