Perturbation< ValueType > Class Template Reference

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

Reference API: gko::Perturbation< ValueType > Class Template Reference
Reference API

#include <ginkgo/core/base/perturbation.hpp>

Inheritance diagram for gko::Perturbation< ValueType >:
[legend]

Public Types

using value_type = ValueType
 
- Public Types inherited from gko::EnablePolymorphicAssignment< ConcreteLinOp >
using result_type = ConcreteLinOp
 
- Public Types inherited from gko::ConvertibleTo< ResultType >
using result_type = ResultType
 

Public Member Functions

const std::shared_ptr< const LinOpget_basis () const noexcept
 
const std::shared_ptr< const LinOpget_projector () const noexcept
 
const std::shared_ptr< const LinOpget_scalar () const noexcept
 
Perturbationoperator= (const Perturbation &other)
 
Perturbationoperator= (Perturbation &&other)
 
 Perturbation (const Perturbation &other)
 
 Perturbation (Perturbation &&other)
 
- 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
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< 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 std::unique_ptr< Perturbationcreate (std::shared_ptr< const Executor > exec)
 
static std::unique_ptr< Perturbationcreate (std::shared_ptr< const LinOp > scalar, std::shared_ptr< const LinOp > basis)
 
static std::unique_ptr< Perturbationcreate (std::shared_ptr< const LinOp > scalar, std::shared_ptr< const LinOp > basis, std::shared_ptr< const LinOp > projector)
 
- Static Public Member Functions inherited from gko::EnableCreateMethod< ConcreteType >
template<typename... Args>
static std::unique_ptr< ConcreteType > create (Args &&... args)
 

Protected Member Functions

 Perturbation (std::shared_ptr< const Executor > exec)
 
 Perturbation (std::shared_ptr< const LinOp > scalar, std::shared_ptr< const LinOp > basis)
 
 Perturbation (std::shared_ptr< const LinOp > scalar, std::shared_ptr< const LinOp > basis, std::shared_ptr< const LinOp > projector)
 
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
 
void validate_perturbation ()
 
- 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< 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
 

Friends

class EnablePolymorphicObject< Perturbation, LinOp >
 
class EnableCreateMethod< Perturbation >
 

Additional Inherited Members

- 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::Perturbation< ValueType >

The Perturbation class can be used to construct a LinOp to represent the operation (identity + scalar * basis * projector). This operator adds a movement along a direction constructed by basis and projector on the LinOp. projector gives the coefficient of basis to decide the direction.

For example, the Householder matrix can be represented with the Perturbation operator as follows. If u is the Householder factor then we can generate the Householder transformation, H = (I - 2 u u*). In this case, the parameters of Perturbation class are scalar = -2, basis = u, and projector = u*.

Template Parameters
ValueTypeprecision of input and result vectors
Note
the apply operations of Perturbation class are not thread safe

Member Function Documentation

◆ create() [1/3]

template<typename ValueType = default_precision>
static std::unique_ptr< Perturbation > gko::Perturbation< ValueType >::create ( std::shared_ptr< const Executor exec)
static

Creates an empty perturbation operator (0x0 operator).

Parameters
execExecutor associated to the perturbation
Returns
A smart pointer to the newly created perturbation.

◆ create() [2/3]

template<typename ValueType = default_precision>
static std::unique_ptr< Perturbation > gko::Perturbation< ValueType >::create ( std::shared_ptr< const LinOp scalar,
std::shared_ptr< const LinOp basis 
)
static

Creates a perturbation with scalar and basis by setting projector to the conjugate transpose of basis. Basis must be transposable. Perturbation will throw gko::NotSupported if basis is not transposable.

Parameters
scalarscaling of the movement
basisthe direction basis
Returns
A smart pointer to the newly created perturbation.

◆ create() [3/3]

template<typename ValueType = default_precision>
static std::unique_ptr< Perturbation > gko::Perturbation< ValueType >::create ( std::shared_ptr< const LinOp scalar,
std::shared_ptr< const LinOp basis,
std::shared_ptr< const LinOp projector 
)
static

Creates a perturbation of scalar, basis and projector.

Parameters
scalarscaling of the movement
basisthe direction basis
projectordecides the coefficient of basis
Returns
A smart pointer to the newly created perturbation.

◆ get_basis()

template<typename ValueType = default_precision>
const std::shared_ptr< const LinOp > gko::Perturbation< ValueType >::get_basis ( ) const
inlinenoexcept

Returns the basis of the perturbation.

Returns
the basis of the perturbation

◆ get_projector()

template<typename ValueType = default_precision>
const std::shared_ptr< const LinOp > gko::Perturbation< ValueType >::get_projector ( ) const
inlinenoexcept

Returns the projector of the perturbation.

Returns
the projector of the perturbation

◆ get_scalar()

template<typename ValueType = default_precision>
const std::shared_ptr< const LinOp > gko::Perturbation< ValueType >::get_scalar ( ) const
inlinenoexcept

Returns the scalar of the perturbation.

Returns
the scalar of the perturbation

◆ validate_perturbation()

template<typename ValueType = default_precision>
void gko::Perturbation< ValueType >::validate_perturbation ( )
protected

Validates the dimensions of the scalar, basis and projector parameters for the apply. scalar must be 1 by 1. The dimension of basis should be same as the dimension of conjugate transpose of projector.


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