Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct > Class Template Reference

Conjugate Gradients solver. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/alina/arccore/alina/ConjugateGradientSolver.h>

Inheritance diagram for Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >:
Collaboration diagram for Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >:

Public Types

using Backend = Backend_
using backend_type = Backend
using BackendType = Backend
typedef Backend::vector vector
typedef Backend::value_type value_type
typedef Backend::params backend_params
typedef math::scalar_of< value_type >::type scalar_type
typedef math::inner_product_impl< typenamemath::rhs_of< value_type >::type >::return_type coef_type
using params = ConjugateGradientSolverParams

Public Member Functions

 ConjugateGradientSolver (size_t n, const params &prm=params(), const backend_params &backend_prm=backend_params(), const InnerProduct &inner_product=InnerProduct())
 Preallocates necessary data structures for the system of size n.
template<class Matrix, class Precond, class Vec1, class Vec2>
SolverResult operator() (const Matrix &A, const Precond &P, const Vec1 &rhs, Vec2 &&x) const
template<class Precond, class Vec1, class Vec2>
SolverResult operator() (const Precond &P, const Vec1 &rhs, Vec2 &&x) const
 Computes the solution for the given right-hand side.
size_t bytes () const
 Memory used in bytes.

Public Attributes

params prm

Private Member Functions

template<class Vec>
scalar_type norm (const Vec &x) const

Private Attributes

size_t n
std::shared_ptr< vector > r
std::shared_ptr< vector > s
std::shared_ptr< vector > p
std::shared_ptr< vector > q
InnerProduct inner_product

Friends

std::ostream & operator<< (std::ostream &os, const ConjugateGradientSolver &s)

Detailed Description

template<class Backend_, class InnerProduct = detail::default_inner_product>
class Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >

Conjugate Gradients solver.

An effective method for symmetric positive definite systems [Barr94]_.

Definition at line 95 of file ConjugateGradientSolver.h.

Member Typedef Documentation

◆ Backend

template<class Backend_, class InnerProduct = detail::default_inner_product>
using Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::Backend = Backend_

Definition at line 100 of file ConjugateGradientSolver.h.

◆ backend_params

template<class Backend_, class InnerProduct = detail::default_inner_product>
typedef Backend::params Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::backend_params

Definition at line 106 of file ConjugateGradientSolver.h.

◆ backend_type

template<class Backend_, class InnerProduct = detail::default_inner_product>
using Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::backend_type = Backend

Definition at line 101 of file ConjugateGradientSolver.h.

◆ BackendType

template<class Backend_, class InnerProduct = detail::default_inner_product>
using Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::BackendType = Backend

Definition at line 102 of file ConjugateGradientSolver.h.

◆ coef_type

template<class Backend_, class InnerProduct = detail::default_inner_product>
typedef math::inner_product_impl<typenamemath::rhs_of<value_type>::type>::return_type Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::coef_type

Definition at line 111 of file ConjugateGradientSolver.h.

◆ params

template<class Backend_, class InnerProduct = detail::default_inner_product>
using Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::params = ConjugateGradientSolverParams

Definition at line 113 of file ConjugateGradientSolver.h.

◆ scalar_type

template<class Backend_, class InnerProduct = detail::default_inner_product>
typedef math::scalar_of<value_type>::type Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::scalar_type

Definition at line 108 of file ConjugateGradientSolver.h.

◆ value_type

template<class Backend_, class InnerProduct = detail::default_inner_product>
typedef Backend::value_type Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::value_type

Definition at line 105 of file ConjugateGradientSolver.h.

◆ vector

template<class Backend_, class InnerProduct = detail::default_inner_product>
typedef Backend::vector Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::vector

Definition at line 104 of file ConjugateGradientSolver.h.

Constructor & Destructor Documentation

◆ ConjugateGradientSolver()

template<class Backend_, class InnerProduct = detail::default_inner_product>
Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::ConjugateGradientSolver ( size_t n,
const params & prm = params(),
const backend_params & backend_prm = backend_params(),
const InnerProduct & inner_product = InnerProduct() )
inline

Preallocates necessary data structures for the system of size n.

Definition at line 116 of file ConjugateGradientSolver.h.

Member Function Documentation

◆ bytes()

template<class Backend_, class InnerProduct = detail::default_inner_product>
size_t Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::bytes ( ) const
inlinevirtual

Memory used in bytes.

Implements Arcane::Alina::SolverBase.

Definition at line 210 of file ConjugateGradientSolver.h.

◆ norm()

template<class Backend_, class InnerProduct = detail::default_inner_product>
template<class Vec>
scalar_type Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::norm ( const Vec & x) const
inlineprivate

Definition at line 242 of file ConjugateGradientSolver.h.

◆ operator()() [1/2]

template<class Backend_, class InnerProduct = detail::default_inner_product>
template<class Matrix, class Precond, class Vec1, class Vec2>
SolverResult Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::operator() ( const Matrix & A,
const Precond & P,
const Vec1 & rhs,
Vec2 && x ) const
inline

Definition at line 141 of file ConjugateGradientSolver.h.

◆ operator()() [2/2]

template<class Backend_, class InnerProduct = detail::default_inner_product>
template<class Precond, class Vec1, class Vec2>
SolverResult Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::operator() ( const Precond & P,
const Vec1 & rhs,
Vec2 && x ) const
inline

Computes the solution for the given right-hand side.

Computes the solution for the given right-hand side rhs. The system matrix is the same that was used for the setup of the preconditioner P. Returns the number of iterations made and the achieved residual as a std::tuple. The solution vector x provides initial approximation in input and holds the computed solution on output.

Definition at line 205 of file ConjugateGradientSolver.h.

◆ operator<<

template<class Backend_, class InnerProduct = detail::default_inner_product>
std::ostream & operator<< ( std::ostream & os,
const ConjugateGradientSolver< Backend_, InnerProduct > & s )
friend

Definition at line 218 of file ConjugateGradientSolver.h.

Member Data Documentation

◆ inner_product

template<class Backend_, class InnerProduct = detail::default_inner_product>
InnerProduct Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::inner_product
private

Definition at line 239 of file ConjugateGradientSolver.h.

◆ n

template<class Backend_, class InnerProduct = detail::default_inner_product>
size_t Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::n
private

Definition at line 232 of file ConjugateGradientSolver.h.

◆ p

template<class Backend_, class InnerProduct = detail::default_inner_product>
std::shared_ptr<vector> Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::p
private

Definition at line 236 of file ConjugateGradientSolver.h.

◆ prm

template<class Backend_, class InnerProduct = detail::default_inner_product>
params Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::prm

Definition at line 228 of file ConjugateGradientSolver.h.

◆ q

template<class Backend_, class InnerProduct = detail::default_inner_product>
std::shared_ptr<vector> Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::q
private

Definition at line 237 of file ConjugateGradientSolver.h.

◆ r

template<class Backend_, class InnerProduct = detail::default_inner_product>
std::shared_ptr<vector> Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::r
private

Definition at line 234 of file ConjugateGradientSolver.h.

◆ s

template<class Backend_, class InnerProduct = detail::default_inner_product>
std::shared_ptr<vector> Arcane::Alina::ConjugateGradientSolver< Backend_, InnerProduct >::s
private

Definition at line 235 of file ConjugateGradientSolver.h.


The documentation for this class was generated from the following file: