Ginkgo  Generated from pipelines/224724463 branch based on develop. Ginkgo version 1.3.0
A numerical linear algebra library targeting many-core architectures
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
gko::preconditioner::Jacobi< ValueType, IndexType > Class Template Reference

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>

Collaboration diagram for gko::preconditioner::Jacobi< ValueType, IndexType >:
[legend]

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< LinOptranspose () const override
 Returns a LinOp representing the transpose of the Transposable object. More...
 
std::unique_ptr< LinOpconj_transpose () const override
 Returns a LinOp representing the conjugate transpose of the Transposable object. More...
 
const parameters_typeget_parameters () const
 
- Public Member Functions inherited from gko::EnableLinOp< Jacobi< ValueType, IndexType > >
const Jacobi< ValueType, IndexType > * apply (const LinOp *b, LinOp *x) const
 
Jacobi< ValueType, IndexType > * apply (const LinOp *b, LinOp *x)
 
const Jacobi< ValueType, IndexType > * apply (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x) const
 
Jacobi< ValueType, IndexType > * apply (const LinOp *alpha, const LinOp *b, const LinOp *beta, 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)
 
Jacobi< ValueType, IndexType > * copy_from (std::unique_ptr< PolymorphicObject > other)
 
Jacobi< ValueType, IndexType > * clear ()
 
- Public Member Functions inherited from gko::LinOp
LinOpapply (const LinOp *b, LinOp *x)
 Applies a linear operator to a vector (or a sequence of vectors). More...
 
const LinOpapply (const LinOp *b, LinOp *x) const
 Applies a linear operator to a vector (or a sequence of vectors). More...
 
LinOpapply (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x)
 Performs the operation x = alpha * op(b) + beta * x. More...
 
const LinOpapply (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x) const
 Performs the operation x = alpha * op(b) + beta * x. More...
 
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...
 
- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< LinOp >
std::unique_ptr< LinOpcreate_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< LinOpcreate_default () const
 
std::unique_ptr< LinOpclone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< LinOpclone () const
 
LinOpcopy_from (const PolymorphicObject *other)
 
LinOpcopy_from (std::unique_ptr< PolymorphicObject > other)
 
LinOpclear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_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< PolymorphicObjectcreate_default () const
 Creates a new "default" object of the same dynamic type as this object. More...
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 Creates a clone of the object. More...
 
std::unique_ptr< PolymorphicObjectclone () const
 Creates a clone of the object. More...
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 Copies another object into this object. More...
 
PolymorphicObjectcopy_from (std::unique_ptr< PolymorphicObject > other)
 Moves another object into this object. More...
 
PolymorphicObjectclear ()
 Transforms the object into its default state. More...
 
std::shared_ptr< const Executorget_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
 Adds a new logger to the list of subscribed loggers. More...
 
void remove_logger (const Logger *logger) override
 Removes a logger from the list of subscribed loggers. More...
 
- 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...
 

Static Public Member Functions

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

Friends

class EnableLinOp< Jacobi >
 
class EnablePolymorphicObject< Jacobi, LinOp >
 

Detailed Description

template<typename ValueType = default_precision, typename IndexType = int32>
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
ValueTypeprecision of matrix elements
IndexTypeintegral 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.

Member Function Documentation

◆ conj_transpose()

template<typename ValueType = default_precision, typename IndexType = int32>
std::unique_ptr<LinOp> gko::preconditioner::Jacobi< ValueType, IndexType >::conj_transpose ( ) const
overridevirtual

Returns a LinOp representing the conjugate transpose of the Transposable object.

Returns
a pointer to the new conjugate transposed object

Implements gko::Transposable.

◆ convert_to()

template<typename ValueType = default_precision, typename IndexType = int32>
void gko::preconditioner::Jacobi< ValueType, IndexType >::convert_to ( matrix::Dense< value_type > *  result) const
overridevirtual

Converts the implementer to an object of type result_type.

Parameters
resultthe object used to store the result of the conversion

Implements gko::ConvertibleTo< matrix::Dense< ValueType > >.

◆ get_blocks()

template<typename ValueType = default_precision, typename IndexType = int32>
const value_type* gko::preconditioner::Jacobi< ValueType, IndexType >::get_blocks ( ) const
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()

template<typename ValueType = default_precision, typename IndexType = int32>
const remove_complex<value_type>* gko::preconditioner::Jacobi< ValueType, IndexType >::get_conditioning ( ) const
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()

template<typename ValueType = default_precision, typename IndexType = int32>
size_type gko::preconditioner::Jacobi< ValueType, IndexType >::get_num_blocks ( ) const
inlinenoexcept

Returns the number of blocks of the operator.

Returns
the number of blocks of the operator

◆ get_num_stored_elements()

template<typename ValueType = default_precision, typename IndexType = int32>
size_type gko::preconditioner::Jacobi< ValueType, IndexType >::get_num_stored_elements ( ) const
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_num_elems().

◆ get_storage_scheme()

template<typename ValueType = default_precision, typename IndexType = int32>
const block_interleaved_storage_scheme<index_type>& gko::preconditioner::Jacobi< ValueType, IndexType >::get_storage_scheme ( ) const
inlinenoexcept

Returns the storage scheme used for storing Jacobi blocks.

Returns
the storage scheme used for storing Jacobi blocks

◆ move_to()

template<typename ValueType = default_precision, typename IndexType = int32>
void gko::preconditioner::Jacobi< ValueType, IndexType >::move_to ( matrix::Dense< value_type > *  result)
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.

Parameters
resultthe object used to emplace the result of the conversion
Note
ConvertibleTo::move_to can be implemented by simply calling ConvertibleTo::convert_to. However, this operation can often be optimized by exploiting the fact that implementer's data can be moved to the result.

Implements gko::ConvertibleTo< matrix::Dense< ValueType > >.

◆ transpose()

template<typename ValueType = default_precision, typename IndexType = int32>
std::unique_ptr<LinOp> gko::preconditioner::Jacobi< ValueType, IndexType >::transpose ( ) const
overridevirtual

Returns a LinOp representing the transpose of the Transposable object.

Returns
a pointer to the new transposed object

Implements gko::Transposable.

◆ write()

template<typename ValueType = default_precision, typename IndexType = int32>
void gko::preconditioner::Jacobi< ValueType, IndexType >::write ( mat_data data) const
overridevirtual

Writes a matrix to a matrix_data structure.

Parameters
datathe matrix_data structure

Implements gko::WritableToMatrixData< ValueType, IndexType >.


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