IterativeSolvers.hpp File Reference

Contains (sequential/threaded) iterative solvers. More...

#include <functional>
#include "StrumpackOptions.hpp"
#include "sparse/CompressedSparseMatrix.hpp"
#include "dense/DenseMatrix.hpp"
Include dependency graph for IterativeSolvers.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 strumpack
 

Typedefs

template<typename T >
using strumpack::iterative::SPMV = std::function< void(const T *, T *)>
 
template<typename T >
using strumpack::iterative::PREC = std::function< void(T *)>
 

Functions

template<typename scalar_t , typename real_t = typename RealType<scalar_t>::value_type>
real_t strumpack::iterative::GMRes (const SPMV< scalar_t > &A, const PREC< scalar_t > &M, std::size_t n, scalar_t *x, const scalar_t *b, real_t rtol, real_t atol, int &totit, int maxit, int restart, GramSchmidtType GStype, bool non_zero_guess, bool verbose)
 
template<typename scalar_t , typename real_t = typename RealType<scalar_t>::value_type>
real_t strumpack::iterative::BiCGStab (const SPMV< scalar_t > &A, const PREC< scalar_t > &M, std::size_t n, scalar_t *x, const scalar_t *b, real_t rtol, real_t atol, int &totit, int maxit, bool non_zero_guess, bool verbose)
 
template<typename scalar_t , typename integer_t , typename real_t = typename RealType<scalar_t>::value_type>
void strumpack::iterative::IterativeRefinement (const CompressedSparseMatrix< scalar_t, integer_t > &A, const std::function< void(DenseMatrix< scalar_t > &)> &M, DenseMatrix< scalar_t > &x, const DenseMatrix< scalar_t > &b, real_t rtol, real_t atol, int &totit, int maxit, bool non_zero_guess, bool verbose)
 
template<typename scalar_t , typename real_t = typename RealType<scalar_t>::value_type>
void strumpack::iterative::IterativeRefinement (const DenseMatrix< scalar_t > &A, const std::function< void(DenseMatrix< scalar_t > &)> &M, DenseMatrix< scalar_t > &x, const DenseMatrix< scalar_t > &b, real_t rtol, real_t atol, int &totit, int maxit, bool non_zero_guess, bool verbose)
 

Detailed Description

Contains (sequential/threaded) iterative solvers.

Function Documentation

◆ BiCGStab()

template<typename scalar_t , typename real_t = typename RealType<scalar_t>::value_type>
real_t strumpack::iterative::BiCGStab ( const SPMV< scalar_t > &  A,
const PREC< scalar_t > &  M,
std::size_t  n,
scalar_t *  x,
const scalar_t *  b,
real_t  rtol,
real_t  atol,
int &  totit,
int  maxit,
bool  non_zero_guess,
bool  verbose 
)

◆ IterativeRefinement() [1/2]

template<typename scalar_t , typename integer_t , typename real_t = typename RealType<scalar_t>::value_type>
void strumpack::iterative::IterativeRefinement ( const CompressedSparseMatrix< scalar_t, integer_t > &  A,
const std::function< void(DenseMatrix< scalar_t > &)> &  M,
DenseMatrix< scalar_t > &  x,
const DenseMatrix< scalar_t > &  b,
real_t  rtol,
real_t  atol,
int &  totit,
int  maxit,
bool  non_zero_guess,
bool  verbose 
)

Iterative refinement, with a sparse matrix, to solve a linear system M^{-1}Ax=M^{-1}b.

Template Parameters
scalar_tscalar type
integer_tinteger type used in A
real_treal type, can be derived from the scalar_t type
Parameters
Adense matrix A
Mroutine to apply M^{-1} to a matrix
xon output this contains the solution, on input this can be the initial guess. This always has to be allocated to the correct size (A.rows() x b.cols())
bthe right hand side, should have A.rows() rows
rtolrelative stopping tolerance
atolabsolute stopping tolerance
totiton output this will contain the number of iterations that were performed
maxitmaximum number of iterations
non_zero_guessx use x as an initial guess

◆ IterativeRefinement() [2/2]

template<typename scalar_t , typename real_t = typename RealType<scalar_t>::value_type>
void strumpack::iterative::IterativeRefinement ( const DenseMatrix< scalar_t > &  A,
const std::function< void(DenseMatrix< scalar_t > &)> &  M,
DenseMatrix< scalar_t > &  x,
const DenseMatrix< scalar_t > &  b,
real_t  rtol,
real_t  atol,
int &  totit,
int  maxit,
bool  non_zero_guess,
bool  verbose 
)

Iterative refinement, with a dense matrix, to solve a linear system M^{-1}Ax=M^{-1}b.

Template Parameters
scalar_tscalar type
real_treal type, can be derived from the scalar_t type
Parameters
Adense matrix A
direct_solveroutine to apply M^{-1} to a matrix
xon output this contains the solution, on input this can be the initial guess. This always has to be allocated to the correct size (A.rows() x b.cols())
bthe right hand side, should have A.rows() rows
rtolrelative stopping tolerance
atolabsolute stopping tolerance
totiton output this will contain the number of iterations that were performed
maxitmaximum number of iterations
non_zero_guessx use x as an initial guess