Cg< ValueType > Class Template Reference

Cg&lt; ValueType &gt; Class Template Reference#

Reference API: gko::batch::solver::Cg< ValueType > Class Template Reference
Reference API
gko::batch::solver::Cg< ValueType > Class Template Referencefinal

#include <ginkgo/core/solver/batch_cg.hpp>

Inheritance diagram for gko::batch::solver::Cg< ValueType >:
[legend]

Classes

class  Factory
 
struct  parameters_type
 

Public Types

using value_type = ValueType
 
using real_type = gko::remove_complex< ValueType >
 
- Public Types inherited from gko::batch::solver::EnableBatchSolver< ConcreteSolver, ValueType, PolymorphicBase >
using real_type = remove_complex< ValueType >
 
- Public Types inherited from gko::EnablePolymorphicAssignment< ConcreteBatchLinOp >
using result_type = ConcreteBatchLinOp
 
- Public Types inherited from gko::ConvertibleTo< ResultType >
using result_type = ResultType
 

Public Member Functions

const parameters_typeget_parameters () const
 
- Public Member Functions inherited from gko::batch::solver::EnableBatchSolver< ConcreteSolver, ValueType, PolymorphicBase >
const ConcreteSolver * apply (ptr_param< const MultiVector< ValueType > > b, ptr_param< MultiVector< ValueType > > x) const
 
const ConcreteSolver * apply (ptr_param< const MultiVector< ValueType > > alpha, ptr_param< const MultiVector< ValueType > > b, ptr_param< const MultiVector< ValueType > > beta, ptr_param< MultiVector< ValueType > > x) const
 
ConcreteSolver * apply (ptr_param< const MultiVector< ValueType > > b, ptr_param< MultiVector< ValueType > > x)
 
ConcreteSolver * apply (ptr_param< const MultiVector< ValueType > > alpha, ptr_param< const MultiVector< ValueType > > b, ptr_param< const MultiVector< ValueType > > beta, ptr_param< MultiVector< ValueType > > x)
 
- Public Member Functions inherited from gko::batch::solver::BatchSolver
std::shared_ptr< const BatchLinOpget_system_matrix () const
 
std::shared_ptr< const BatchLinOpget_preconditioner () const
 
double get_tolerance () const
 
void reset_tolerance (double res_tol)
 
int get_max_iterations () const
 
void reset_max_iterations (int max_iterations)
 
::gko::batch::stop::tolerance_type get_tolerance_type () const
 
void reset_tolerance_type (::gko::batch::stop::tolerance_type tol_type)
 
- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< AbstractObject, PolymorphicBase >
std::unique_ptr< AbstractObject > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > create_default () const
 
std::unique_ptr< AbstractObject > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > clone () const
 
AbstractObject * copy_from (const PolymorphicObject *other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (std::unique_ptr< Derived > &&other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (const std::unique_ptr< Derived > &other)
 
AbstractObject * copy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
AbstractObject * move_from (ptr_param< PolymorphicObject > other)
 
AbstractObject * clear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectcreate_default () const
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectclone () const
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (std::unique_ptr< Derived, Deleter > &&other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (const std::unique_ptr< Derived, Deleter > &other)
 
PolymorphicObjectcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
PolymorphicObjectmove_from (ptr_param< PolymorphicObject > other)
 
PolymorphicObjectclear ()
 
std::shared_ptr< const Executorget_executor () const noexcept
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 
void remove_logger (const Logger *logger) override
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 
void clear_loggers () override
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 
- Public Member Functions inherited from gko::EnablePolymorphicAssignment< ConcreteBatchLinOp >
void convert_to (result_type *result) const override
 
void move_to (result_type *result) override
 
- Public Member Functions inherited from gko::ConvertibleTo< ResultType >
virtual void convert_to (result_type *result) const =0
 
void convert_to (ptr_param< result_type > result) const
 
virtual void move_to (result_type *result)=0
 
void move_to (ptr_param< result_type > result)
 

Static Public Member Functions

static auto build () -> decltype(Factory ::create())
 

Friends

class EnableBatchLinOp< Cg >
 
class EnablePolymorphicObject< Cg, BatchLinOp >
 

Additional Inherited Members

- Protected Member Functions inherited from gko::batch::solver::EnableBatchSolver< ConcreteSolver, ValueType, PolymorphicBase >
ConcreteSolver * self () noexcept
 
const ConcreteSolver * self () const noexcept
 
 EnableBatchSolver (std::shared_ptr< const Executor > exec)
 
template<typename FactoryParameters >
 EnableBatchSolver (std::shared_ptr< const Executor > exec, std::shared_ptr< const BatchLinOp > system_matrix, const FactoryParameters &params)
 
void set_system_matrix (std::shared_ptr< const BatchLinOp > new_system_matrix)
 
void set_preconditioner (std::shared_ptr< const BatchLinOp > new_precond)
 
EnableBatchSolveroperator= (const EnableBatchSolver &other)
 
EnableBatchSolveroperator= (EnableBatchSolver &&other)
 
 EnableBatchSolver (const EnableBatchSolver &other)
 
 EnableBatchSolver (EnableBatchSolver &&other)
 
void apply_impl (const MultiVector< ValueType > *b, MultiVector< ValueType > *x) const
 
void apply_impl (const MultiVector< ValueType > *alpha, const MultiVector< ValueType > *b, const MultiVector< ValueType > *beta, MultiVector< ValueType > *x) const
 
virtual void solver_apply (const MultiVector< ValueType > *b, MultiVector< ValueType > *x, log::detail::log_data< real_type > *info) const =0
 
- Protected Member Functions inherited from gko::batch::solver::BatchSolver
 BatchSolver (std::shared_ptr< const BatchLinOp > system_matrix, std::shared_ptr< const BatchLinOp > gen_preconditioner, const double res_tol, const int max_iterations, const ::gko::batch::stop::tolerance_type tol_type)
 
void set_system_matrix_base (std::shared_ptr< const BatchLinOp > system_matrix)
 
void set_preconditioner_base (std::shared_ptr< const BatchLinOp > precond)
 
- Protected Member Functions inherited from gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >
std::unique_ptr< PolymorphicObjectcreate_default_impl (std::shared_ptr< const Executor > exec) const override
 
PolymorphicObjectcopy_from_impl (const PolymorphicObject *other) override
 
PolymorphicObjectcopy_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectmove_from_impl (PolymorphicObject *other) override
 
PolymorphicObjectmove_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectclear_impl () override
 
- Protected Member Functions inherited from gko::PolymorphicObject
 PolymorphicObject (std::shared_ptr< const Executor > exec)
 
 PolymorphicObject (const PolymorphicObject &other)
 
- Protected Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void log (Params &&... params) const
 
- Protected Attributes inherited from gko::batch::solver::BatchSolver
std::shared_ptr< const BatchLinOpsystem_matrix_ {}
 
std::shared_ptr< const BatchLinOppreconditioner_ {}
 
double residual_tol_ {}
 
int max_iterations_ {}
 
::gko::batch::stop::tolerance_type tol_type_ {}
 
array< unsigned char > workspace_ {}
 
- Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject >
std::vector< std::shared_ptr< const Logger > > loggers_
 

Detailed Description

template<typename ValueType = default_precision>
class gko::batch::solver::Cg< ValueType >

Cg or the Conjugate Gradient is a Krylov subspace solver. It is a short recurrence solver that is generally used to solve linear systems with SPD matrices.

This solver solves a batch of linear systems using the Cg algorithm. Each linear system in the batch can converge independently.

Unless otherwise specified via the preconditioner factory parameter, this implementation does not use any preconditioner by default. The type of tolerance (absolute or relative) and the maximum number of iterations to be used in the stopping criterion can be set via the factory parameters.

Note
The tolerance check is against the internal residual computed within the solver process. This implicit (internal) residual can diverge from the true residual (||b - Ax||). A posterori checks (by computing the true residual, ||b - Ax||) are recommended to ensure that the solution has converged to the desired tolerance.
Template Parameters
ValueTypeprecision of matrix elements

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