Ginkgo: gko::preconditioner::Jacobi< ValueType, IndexType > Class Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::preconditioner::Jacobi< ValueType, IndexType > Class Template Reference
Linear Operators » Preconditioners » Jacobi Preconditioner | Linear Operators » Preconditioners | Linear Operators

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>`

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

## Classes
struct | parameters_type
class | Factory

## 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< default_precision, int32 > >
using | result_type
Public Types inherited from gko::WritableToMatrixData< default_precision, int32 >
using | value_type
using | index_type

## Public Member Functions
size_type | get_num_blocks () const noexcept
| Returns the number of blocks of the operator.
const block_interleaved_storage_scheme< index_type > & | get_storage_scheme () const noexcept
| Returns the storage scheme used for storing Jacobi blocks.
const value_type * | get_blocks () const noexcept
| Returns the pointer to the memory used for storing the block data.
const remove_complex< value_type > * | get_conditioning () const noexcept
| Returns an array of 1-norm condition numbers of the blocks.
size_type | get_num_stored_elements () const noexcept
| Returns the number of elements explicitly stored in the matrix.
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
| Returns a LinOp representing the transpose of the Transposable object.
std::unique_ptr< LinOp > | conj_transpose () const override
| Returns a LinOp representing the conjugate transpose of the Transposable object.
Jacobi & | operator= (const Jacobi &other)
| Copy-assigns a Jacobi preconditioner.
Jacobi & | operator= (Jacobi &&other)
| Move-assigns a Jacobi preconditioner.
| Jacobi (const Jacobi &other)
| Copy-constructs a Jacobi preconditioner.
| Jacobi (Jacobi &&other)
| Move-assigns a Jacobi preconditioner.
const parameters_type & | get_parameters () const
Public Member Functions inherited from gko::EnableLinOp< Jacobi< default_precision, int32 > >
const Jacobi< default_precision, int32 > * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Public Member Functions inherited from gko::EnablePolymorphicAssignment< Jacobi< default_precision, int32 > >
void | convert_to (result_type *result) const override
void | move_to (result_type *result) override
Public Member Functions inherited from gko::WritableToMatrixData< default_precision, int32 >
virtual void | write (matrix_data< default_precision, int32 > &data) const=0
| Writes a matrix to a matrix_data structure.

## 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.

## 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

  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/2]

template<typename ValueType = default_precision, typename IndexType = int32>

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/2]

template<typename ValueType = default_precision, typename IndexType = int32>

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).

## 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.

## ◆ 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

## ◆ 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.

## ◆ 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

## ◆ 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

## ◆ operator=() [1/2]

template<typename ValueType = default_precision, typename IndexType = int32>

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]

template<typename ValueType = default_precision, typename IndexType = int32>

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()

template<typename ValueType = default_precision, typename IndexType = int32>

parameters_type gko::preconditioner::Jacobi< ValueType, IndexType >::parse | ( | const config::pnode & | config,
|  | const config::registry & | context,
|  | const config::type_descriptor & | td_for_child = config::make_type_descriptor< ValueType, IndexType >() )
| 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()

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.

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

- ginkgo/core/preconditioner/jacobi.hpp