Ginkgo
Generated from pipelines/1554403166 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
|
A block-Jacobi preconditioner is a block-diagonal linear operator, obtained by inverting the diagonal blocks of the source operator. More...
#include <ginkgo/core/preconditioner/jacobi.hpp>
Classes | |
class | Factory |
struct | parameters_type |
Public Types | |
using | value_type = ValueType |
using | index_type = IndexType |
using | mat_data = matrix_data< ValueType, IndexType > |
using | transposed_type = Jacobi< ValueType, IndexType > |
Public Types inherited from gko::EnablePolymorphicAssignment< Jacobi< ValueType, IndexType > > | |
using | result_type = Jacobi< ValueType, IndexType > |
Public Types inherited from gko::ConvertibleTo< Jacobi< ValueType, IndexType > > | |
using | result_type = Jacobi< ValueType, IndexType > |
Public Types inherited from gko::ConvertibleTo< matrix::Dense< ValueType > > | |
using | result_type = matrix::Dense< ValueType > |
Public Types inherited from gko::WritableToMatrixData< ValueType, IndexType > | |
using | value_type = ValueType |
using | index_type = IndexType |
Public Member Functions | |
size_type | get_num_blocks () const noexcept |
Returns the number of blocks of the operator. More... | |
const block_interleaved_storage_scheme< index_type > & | get_storage_scheme () const noexcept |
Returns the storage scheme used for storing Jacobi blocks. More... | |
const value_type * | get_blocks () const noexcept |
Returns the pointer to the memory used for storing the block data. More... | |
const remove_complex< value_type > * | get_conditioning () const noexcept |
Returns an array of 1-norm condition numbers of the blocks. More... | |
size_type | get_num_stored_elements () const noexcept |
Returns the number of elements explicitly stored in the matrix. More... | |
void | convert_to (matrix::Dense< value_type > *result) const override |
Converts the implementer to an object of type result_type. More... | |
void | move_to (matrix::Dense< value_type > *result) override |
Converts the implementer to an object of type result_type by moving data from this object. More... | |
void | write (mat_data &data) const override |
Writes a matrix to a matrix_data structure. More... | |
std::unique_ptr< LinOp > | transpose () const override |
Returns a LinOp representing the transpose of the Transposable object. More... | |
std::unique_ptr< LinOp > | conj_transpose () const override |
Returns a LinOp representing the conjugate transpose of the Transposable object. More... | |
Jacobi & | operator= (const Jacobi &other) |
Copy-assigns a Jacobi preconditioner. More... | |
Jacobi & | operator= (Jacobi &&other) |
Move-assigns a Jacobi preconditioner. More... | |
Jacobi (const Jacobi &other) | |
Copy-constructs a Jacobi preconditioner. More... | |
Jacobi (Jacobi &&other) | |
Move-assigns a Jacobi preconditioner. More... | |
const parameters_type & | get_parameters () const |
Public Member Functions inherited from gko::EnableLinOp< Jacobi< ValueType, IndexType > > | |
const Jacobi< ValueType, IndexType > * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const |
Jacobi< ValueType, IndexType > * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) |
const Jacobi< ValueType, IndexType > * | apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) const |
Jacobi< ValueType, IndexType > * | apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) |
Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< Jacobi< ValueType, IndexType >, LinOp > | |
std::unique_ptr< Jacobi< ValueType, IndexType > > | create_default (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< Jacobi< ValueType, IndexType > > | create_default () const |
std::unique_ptr< Jacobi< ValueType, IndexType > > | clone (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< Jacobi< ValueType, IndexType > > | clone () const |
Jacobi< ValueType, IndexType > * | copy_from (const PolymorphicObject *other) |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, Jacobi< ValueType, IndexType > > * | copy_from (std::unique_ptr< Derived > &&other) |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, Jacobi< ValueType, IndexType > > * | copy_from (const std::unique_ptr< Derived > &other) |
Jacobi< ValueType, IndexType > * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
Jacobi< ValueType, IndexType > * | move_from (ptr_param< PolymorphicObject > other) |
Jacobi< ValueType, IndexType > * | clear () |
Public Member Functions inherited from gko::LinOp | |
LinOp * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) |
Applies a linear operator to a vector (or a sequence of vectors). More... | |
const LinOp * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const |
LinOp * | apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) |
Performs the operation x = alpha * op(b) + beta * x. More... | |
const LinOp * | apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) const |
const dim< 2 > & | get_size () const noexcept |
Returns the size of the operator. More... | |
virtual bool | apply_uses_initial_guess () const |
Returns true if the linear operator uses the data given in x as an initial guess. More... | |
LinOp & | operator= (const LinOp &)=default |
Copy-assigns a LinOp. More... | |
LinOp & | operator= (LinOp &&other) |
Move-assigns a LinOp. More... | |
LinOp (const LinOp &)=default | |
Copy-constructs a LinOp. More... | |
LinOp (LinOp &&other) | |
Move-constructs a LinOp. More... | |
Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< LinOp > | |
std::unique_ptr< LinOp > | create_default (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< LinOp > | create_default () const |
std::unique_ptr< LinOp > | clone (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< LinOp > | clone () const |
LinOp * | copy_from (const PolymorphicObject *other) |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, LinOp > * | copy_from (std::unique_ptr< Derived > &&other) |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, LinOp > * | copy_from (const std::unique_ptr< Derived > &other) |
LinOp * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
LinOp * | move_from (ptr_param< PolymorphicObject > other) |
LinOp * | clear () |
Public Member Functions inherited from gko::PolymorphicObject | |
PolymorphicObject & | operator= (const PolymorphicObject &) |
std::unique_ptr< PolymorphicObject > | create_default (std::shared_ptr< const Executor > exec) const |
Creates a new "default" object of the same dynamic type as this object. More... | |
std::unique_ptr< PolymorphicObject > | create_default () const |
Creates a new "default" object of the same dynamic type as this object. More... | |
std::unique_ptr< PolymorphicObject > | clone (std::shared_ptr< const Executor > exec) const |
Creates a clone of the object. More... | |
std::unique_ptr< PolymorphicObject > | clone () const |
Creates a clone of the object. More... | |
PolymorphicObject * | copy_from (const PolymorphicObject *other) |
Copies another object into this object. More... | |
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) |
Moves another object into this object. More... | |
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) |
Copies another object into this object. More... | |
PolymorphicObject * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
Copies another object into this object. More... | |
PolymorphicObject * | move_from (ptr_param< PolymorphicObject > other) |
Moves another object into this object. More... | |
PolymorphicObject * | clear () |
Transforms the object into its default state. More... | |
std::shared_ptr< const Executor > | get_executor () const noexcept |
Returns the Executor of the object. More... | |
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< Jacobi< ValueType, IndexType > > | |
void | convert_to (result_type *result) const override |
Converts the implementer to an object of type result_type. More... | |
void | move_to (result_type *result) override |
Converts the implementer to an object of type result_type by moving data from this object. More... | |
Public Member Functions inherited from gko::ConvertibleTo< Jacobi< ValueType, IndexType > > | |
void | convert_to (ptr_param< result_type > result) const |
void | move_to (ptr_param< result_type > result) |
Public Member Functions inherited from gko::ConvertibleTo< matrix::Dense< ValueType > > | |
void | convert_to (ptr_param< result_type > result) const |
void | move_to (ptr_param< result_type > result) |
Static Public Member Functions | |
static auto | build () -> decltype(Factory ::create()) |
static parameters_type | parse (const config::pnode &config, const config::registry &context, const config::type_descriptor &td_for_child=config::make_type_descriptor< ValueType, IndexType >()) |
Create the parameters from the property_tree. More... | |
Friends | |
class | EnableLinOp< Jacobi > |
class | EnablePolymorphicObject< Jacobi, LinOp > |
A block-Jacobi preconditioner is a block-diagonal linear operator, obtained by inverting the diagonal blocks of the source operator.
The Jacobi class implements the inversion of the diagonal blocks using Gauss-Jordan elimination with column pivoting, and stores the inverse explicitly in a customized format.
If the diagonal blocks of the matrix are not explicitly set by the user, the implementation will try to automatically detect the blocks by first finding the natural blocks of the matrix, and then applying the supervariable agglomeration procedure on them. However, if problem-specific knowledge regarding the block diagonal structure is available, it is usually beneficial to explicitly pass the starting rows of the diagonal blocks, as the block detection is merely a heuristic and cannot perfectly detect the diagonal block structure. The current implementation supports blocks of up to 32 rows / columns.
The implementation also includes an improved, adaptive version of the block-Jacobi preconditioner, which can store some of the blocks in lower precision and thus improve the performance of preconditioner application by reducing the amount of memory transfers. This variant can be enabled by setting the Jacobi::Factory's storage_optimization
parameter. Refer to the documentation of the parameter for more details.
ValueType | precision of matrix elements |
IndexType | integral type used to store pointers to the start of each block |
gko::preconditioner::Jacobi< ValueType, IndexType >::Jacobi | ( | const Jacobi< ValueType, IndexType > & | other | ) |
Copy-constructs a Jacobi preconditioner.
Inherits executor, copies all data and parameters.
gko::preconditioner::Jacobi< ValueType, IndexType >::Jacobi | ( | Jacobi< ValueType, IndexType > && | other | ) |
Move-assigns a Jacobi preconditioner.
Inherits executor, moves all data and parameters. The moved-from object will be empty (0x0 and default parameters).
|
overridevirtual |
Returns a LinOp representing the conjugate transpose of the Transposable object.
Implements gko::Transposable.
|
overridevirtual |
Converts the implementer to an object of type result_type.
result | the object used to store the result of the conversion |
Implements gko::ConvertibleTo< matrix::Dense< ValueType > >.
|
inlinenoexcept |
Returns the pointer to the memory used for storing the block data.
Element (i
, j
) of block b
is stored in position (get_block_pointers()[b] + i) * stride + j
of the array.
References gko::array< ValueType >::get_const_data().
|
inlinenoexcept |
Returns an array of 1-norm condition numbers of the blocks.
References gko::array< ValueType >::get_const_data().
|
inlinenoexcept |
Returns the number of blocks of the operator.
|
inlinenoexcept |
Returns the number of elements explicitly stored in the matrix.
References gko::array< ValueType >::get_size().
|
inlinenoexcept |
|
overridevirtual |
Converts the implementer to an object of type result_type by moving data from this object.
This method is used when the implementer is a temporary object, and move semantics can be used.
result | the object used to emplace the result of the conversion |
Implements gko::ConvertibleTo< matrix::Dense< ValueType > >.
Jacobi& gko::preconditioner::Jacobi< ValueType, IndexType >::operator= | ( | const Jacobi< ValueType, IndexType > & | other | ) |
Copy-assigns a Jacobi preconditioner.
Preserves executor, copies all data and parameters.
Jacobi& gko::preconditioner::Jacobi< ValueType, IndexType >::operator= | ( | Jacobi< ValueType, IndexType > && | other | ) |
Move-assigns a Jacobi preconditioner.
Preserves executor, moves all data and parameters. The moved-from object will be empty (0x0 and default parameters).
|
static |
Create the parameters from the property_tree.
Because this is directly tied to the specific type, the value/index type settings within config are ignored and type_descriptor is only used for children configs.
config | the property tree for setting |
context | the registry |
td_for_child | the type descriptor for children configs. The default uses the value/index type of this class. |
|
overridevirtual |
Returns a LinOp representing the transpose of the Transposable object.
Implements gko::Transposable.
|
overridevirtual |
Writes a matrix to a matrix_data structure.
data | the matrix_data structure |
Implements gko::WritableToMatrixData< ValueType, IndexType >.