Jacobi< ValueType, IndexType > Class Template Reference#
|
Reference API
|
#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< ConcreteLinOp > | |
| using | result_type = ConcreteLinOp |
Public Types inherited from gko::ConvertibleTo< ResultType > | |
| using | result_type = ResultType |
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 |
| const block_interleaved_storage_scheme< index_type > & | get_storage_scheme () const noexcept |
| const value_type * | get_blocks () const noexcept |
| const remove_complex< value_type > * | get_conditioning () const noexcept |
| size_type | get_num_stored_elements () const noexcept |
| void | convert_to (matrix::Dense< value_type > *result) const override |
| void | move_to (matrix::Dense< value_type > *result) override |
| void | write (mat_data &data) const override |
| std::unique_ptr< LinOp > | transpose () const override |
| std::unique_ptr< LinOp > | conj_transpose () const override |
| Jacobi & | operator= (const Jacobi &other) |
| Jacobi & | operator= (Jacobi &&other) |
| Jacobi (const Jacobi &other) | |
| Jacobi (Jacobi &&other) | |
| const parameters_type & | get_parameters () const |
Public Member Functions inherited from gko::EnableLinOp< ConcreteLinOp, PolymorphicBase > | |
| const ConcreteLinOp * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const |
| ConcreteLinOp * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) |
| const ConcreteLinOp * | apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) const |
| ConcreteLinOp * | 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< 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 | |
| PolymorphicObject & | operator= (const PolymorphicObject &) |
| std::unique_ptr< PolymorphicObject > | create_default (std::shared_ptr< const Executor > exec) const |
| std::unique_ptr< PolymorphicObject > | create_default () const |
| std::unique_ptr< PolymorphicObject > | clone (std::shared_ptr< const Executor > exec) const |
| std::unique_ptr< PolymorphicObject > | clone () const |
| PolymorphicObject * | copy_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) |
| PolymorphicObject * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
| PolymorphicObject * | move_from (ptr_param< PolymorphicObject > other) |
| PolymorphicObject * | clear () |
| std::shared_ptr< const Executor > | get_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< ConcreteLinOp > | |
| 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()) |
| 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 >()) |
Protected Member Functions | |
| Jacobi (std::shared_ptr< const Executor > exec) | |
| Jacobi (const Factory *factory, std::shared_ptr< const LinOp > system_matrix) | |
| block_interleaved_storage_scheme< index_type > | compute_storage_scheme (uint32 max_block_size, uint32 param_max_block_stride) |
| void | generate (const LinOp *system_matrix, bool skip_sorting) |
| void | detect_blocks (const matrix::Csr< ValueType, IndexType > *system_matrix) |
| void | apply_impl (const LinOp *b, LinOp *x) const override |
| void | apply_impl (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x) const override |
Protected Member Functions inherited from gko::EnableLinOp< ConcreteLinOp, PolymorphicBase > | |
| ConcreteLinOp * | self () noexcept |
| const ConcreteLinOp * | self () const noexcept |
Protected Member Functions inherited from gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > | |
| std::unique_ptr< PolymorphicObject > | create_default_impl (std::shared_ptr< const Executor > exec) const override |
| PolymorphicObject * | copy_from_impl (const PolymorphicObject *other) override |
| PolymorphicObject * | copy_from_impl (std::unique_ptr< PolymorphicObject > other) override |
| PolymorphicObject * | move_from_impl (PolymorphicObject *other) override |
| PolymorphicObject * | move_from_impl (std::unique_ptr< PolymorphicObject > other) override |
| PolymorphicObject * | clear_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 |
Friends | |
| class | EnableLinOp< Jacobi > |
| class | EnablePolymorphicObject< Jacobi, LinOp > |
Additional Inherited Members | |
Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject > | |
| std::vector< std::shared_ptr< const Logger > > | loggers_ |
Detailed Description
class gko::preconditioner::Jacobi< ValueType, IndexType >
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.
- Template Parameters
-
ValueType precision of matrix elements IndexType integral type used to store pointers to the start of each block
- Note
- The current implementation supports blocks of up to 32 rows / columns.
- When using the adaptive variant, there may be a trade-off in terms of slightly longer preconditioner generation due to extra work required to detect the optimal precision of the blocks.
- When the max_block_size is set to 1, specialized kernels are used, both for generation (inverting the diagonals) and application (diagonal scaling) to reduce the overhead involved in the usual (adaptive) block case.
Constructor & Destructor Documentation
◆ Jacobi() [1/4]
| gko::preconditioner::Jacobi< ValueType, IndexType >::Jacobi | ( | const Jacobi< ValueType, IndexType > & | other | ) |
Copy-constructs a Jacobi preconditioner. Inherits executor, copies all data and parameters.
◆ Jacobi() [2/4]
| 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).
◆ Jacobi() [3/4]
|
inlineexplicitprotected |
Creates an empty Jacobi preconditioner.
- Parameters
-
exec the executor this object is assigned to
References gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::block_pointers, gko::array< ValueType >::set_executor(), and gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::storage_optimization.
◆ Jacobi() [4/4]
|
inlineexplicitprotected |
Creates a Jacobi preconditioner from a matrix using a Jacobi::Factory.
- Parameters
-
factory the factory to use to create the preconditioner system_matrix the matrix this preconditioner should be created from
References gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::block_pointers, gko::preconditioner::Jacobi< ValueType, IndexType >::generate(), gko::PolymorphicObject::get_executor(), gko::array< ValueType >::set_executor(), gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::skip_sorting, and gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::storage_optimization.
Member Function Documentation
◆ compute_storage_scheme()
|
inlineprotected |
Computes the storage scheme suitable for storing blocks of a given maximum size.
- Parameters
-
max_block_size the maximum size of the blocks
- Returns
- a suitable storage scheme
References gko::PolymorphicObject::get_executor(), gko::get_significant_bit(), gko::get_superior_power(), and gko::preconditioner::Jacobi< ValueType, IndexType >::parameters_type::max_block_size.
◆ conj_transpose()
|
overridevirtual |
Returns a LinOp representing the conjugate transpose of the Transposable object.
- Returns
- a pointer to the new conjugate transposed object
Implements gko::Transposable.
◆ detect_blocks()
|
protected |
Detects the diagonal blocks and allocates the memory needed to store the preconditioner.
- Parameters
-
system_matrix the source matrix whose diagonal block pattern is to be detected
◆ generate()
|
protected |
Generates the preconditioner.
- Parameters
-
system_matrix the source matrix used to generate the preconditioner skip_sorting determines if the sorting of system_matrix can be skipped (therefore, marking that it is already sorted)
Referenced by gko::preconditioner::Jacobi< ValueType, IndexType >::Jacobi().
◆ get_blocks()
|
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.
- Returns
- the pointer to the memory used for storing the block data
References gko::array< ValueType >::get_const_data().
◆ get_conditioning()
|
inlinenoexcept |
Returns an array of 1-norm condition numbers of the blocks.
- Returns
- an array of 1-norm condition numbers of the blocks
- Note
- This value is valid only if adaptive precision variant is used, and implementations of the standard non-adaptive variant are allowed to omit the calculation of condition numbers.
References gko::array< ValueType >::get_const_data().
◆ get_num_blocks()
|
inlinenoexcept |
Returns the number of blocks of the operator.
- Returns
- the number of blocks of the operator
◆ get_num_stored_elements()
|
inlinenoexcept |
Returns the number of elements explicitly stored in the matrix.
- Returns
- the number of elements explicitly stored in the matrix
References gko::array< ValueType >::get_size().
◆ get_storage_scheme()
|
inlinenoexcept |
◆ operator=() [1/2]
| Jacobi & gko::preconditioner::Jacobi< ValueType, IndexType >::operator= | ( | const Jacobi< ValueType, IndexType > & | other | ) |
Copy-assigns a Jacobi preconditioner. Preserves executor, copies all data and parameters.
◆ operator=() [2/2]
| 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).
◆ parse()
|
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.
- Parameters
-
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.
- Returns
- parameters
- Note
- Jacobi does not support block_pointers and storage_optimization array.
◆ transpose()
|
overridevirtual |
Returns a LinOp representing the transpose of the Transposable object.
- Returns
- a pointer to the new transposed object
Implements gko::Transposable.
◆ write()
|
overridevirtual |
Writes a matrix to a matrix_data structure.
- Parameters
-
data the matrix_data structure
Implements gko::WritableToMatrixData< ValueType, IndexType >.
The documentation for this class was generated from the following file:
- ginkgo/core/preconditioner/jacobi.hpp
Generated by
Public Types inherited from