LinOp Class Reference

LinOp Class Reference#

Reference API: gko::LinOp Class Reference
Reference API

Inherits gko::EnableAbstractPolymorphicObject< LinOp >.

Inherited by gko::EnableAbstractPolymorphicObject< StencilMatrix< ValueType >, LinOp >, gko::EnableAbstractPolymorphicObject< BlockOperator, LinOp >, gko::EnableAbstractPolymorphicObject< Combination< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Composition< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< ConcreteLinOp, LinOp >, gko::EnableAbstractPolymorphicObject< Perturbation< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Matrix< default_precision, int32, int64 >, LinOp >, gko::EnableAbstractPolymorphicObject< Vector< double >, LinOp >, gko::EnableAbstractPolymorphicObject< Schwarz< default_precision, int32, int64 >, LinOp >, gko::EnableAbstractPolymorphicObject< Factorization< ValueType, IndexType >, LinOp >, gko::EnableAbstractPolymorphicObject< ScaledReordered< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Direct< ValueType, IndexType >, LinOp >, gko::EnableAbstractPolymorphicObject< Composition< gko::default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Coo< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Csr< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Dense< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Diagonal< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Ell< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Fbcsr< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Fft, LinOp >, gko::EnableAbstractPolymorphicObject< Fft2, LinOp >, gko::EnableAbstractPolymorphicObject< Fft3, LinOp >, gko::EnableAbstractPolymorphicObject< Hybrid< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Identity< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Permutation< int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< RowGatherer< int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< ScaledPermutation< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Sellp< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< SparsityCsr< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< FixedCoarsening< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Pgm< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Ic< solver::LowerTrs<>, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Ilu< solver::LowerTrs<>, solver::UpperTrs<>, false, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Isai< IsaiType, ValueType, IndexType >, LinOp >, gko::EnableAbstractPolymorphicObject< Jacobi< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Bicg< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Bicgstab< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< CbGmres< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Cg< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Cgs< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Fcg< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Gcr< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Gmres< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Idr< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Ir< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< LowerTrs< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Minres< default_precision >, LinOp >, gko::EnableAbstractPolymorphicObject< Multigrid, LinOp >, gko::EnableAbstractPolymorphicObject< UpperTrs< default_precision, int32 >, LinOp >, gko::EnableAbstractPolymorphicObject< Dense< value_type >, LinOp >, and gko::EnableAbstractPolymorphicObject< Dense< ValueType >, LinOp >.

Public Member Functions

LinOpapply (ptr_param< const LinOp > b, ptr_param< LinOp > x)
 
const LinOpapply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const
 
LinOpapply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x)
 
const LinOpapply (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
 
virtual bool apply_uses_initial_guess () const
 
LinOpoperator= (const LinOp &)=default
 
LinOpoperator= (LinOp &&other)
 
 LinOp (const LinOp &)=default
 
 LinOp (LinOp &&other)
 
- 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)
 
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)
 
LinOpcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
LinOpmove_from (ptr_param< 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
 
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)
 

Protected Member Functions

 LinOp (std::shared_ptr< const Executor > exec, const dim< 2 > &size=dim< 2 >{})
 
void set_size (const dim< 2 > &value) noexcept
 
virtual void apply_impl (const LinOp *b, LinOp *x) const =0
 
virtual void apply_impl (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x) const =0
 
void validate_application_parameters (const LinOp *b, const LinOp *x) const
 
void validate_application_parameters (const LinOp *alpha, const LinOp *b, const LinOp *beta, const LinOp *x) const
 
- Protected Member Functions inherited from gko::PolymorphicObject
 PolymorphicObject (std::shared_ptr< const Executor > exec)
 
 PolymorphicObject (const PolymorphicObject &other)
 
virtual std::unique_ptr< PolymorphicObjectcreate_default_impl (std::shared_ptr< const Executor > exec) const =0
 
virtual PolymorphicObjectcopy_from_impl (const PolymorphicObject *other)=0
 
virtual PolymorphicObjectcopy_from_impl (std::unique_ptr< PolymorphicObject > other)=0
 
virtual PolymorphicObjectmove_from_impl (PolymorphicObject *other)=0
 
virtual PolymorphicObjectmove_from_impl (std::unique_ptr< PolymorphicObject > other)=0
 
virtual PolymorphicObjectclear_impl ()=0
 
- Protected Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void log (Params &&... params) const
 

Additional Inherited Members

- Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject >
std::vector< std::shared_ptr< const Logger > > loggers_
 

Constructor & Destructor Documentation

◆ LinOp() [1/3]

gko::LinOp::LinOp ( const LinOp )
default

Copy-constructs a LinOp. Inherits executor and size from the input.

◆ LinOp() [2/3]

gko::LinOp::LinOp ( LinOp &&  other)
inline

Move-constructs a LinOp. Inherits executor and size from the input, which will have size 0x0 and unchanged executor afterwards.

◆ LinOp() [3/3]

gko::LinOp::LinOp ( std::shared_ptr< const Executor exec,
const dim< 2 > &  size = dim<2>{} 
)
inlineexplicitprotected

Creates a linear operator.

Parameters
execthe executor where all the operations are performed
sizethe size of the operator

Member Function Documentation

◆ apply() [1/4]

LinOp * gko::LinOp::apply ( ptr_param< const LinOp alpha,
ptr_param< const LinOp b,
ptr_param< const LinOp beta,
ptr_param< LinOp x 
)
inline

Performs the operation x = alpha * op(b) + beta * x.

Parameters
alphascaling of the result of op(b)
bvector(s) on which the operator is applied
betascaling of the input x
xoutput vector(s)
Returns
this

References apply_impl(), gko::ptr_param< T >::get(), gko::PolymorphicObject::get_executor(), gko::make_temporary_clone(), and validate_application_parameters().

◆ apply() [2/4]

const LinOp * gko::LinOp::apply ( ptr_param< const LinOp alpha,
ptr_param< const LinOp b,
ptr_param< const LinOp beta,
ptr_param< LinOp x 
) const
inline

◆ apply() [3/4]

LinOp * gko::LinOp::apply ( ptr_param< const LinOp b,
ptr_param< LinOp x 
)
inline

Applies a linear operator to a vector (or a sequence of vectors).

Performs the operation x = op(b), where op is this linear operator.

Parameters
bthe input vector(s) on which the operator is applied
xthe output vector(s) where the result is stored
Returns
this

References apply_impl(), gko::ptr_param< T >::get(), gko::PolymorphicObject::get_executor(), gko::make_temporary_clone(), and validate_application_parameters().

◆ apply() [4/4]

◆ apply_impl() [1/2]

virtual void gko::LinOp::apply_impl ( const LinOp alpha,
const LinOp b,
const LinOp beta,
LinOp x 
) const
protectedpure virtual

Implementers of LinOp should override this function instead of apply(const LinOp *, const LinOp *, const LinOp *, LinOp *).

Parameters
alphascaling of the result of op(b)
bvector(s) on which the operator is applied
betascaling of the input x
xoutput vector(s)

◆ apply_impl() [2/2]

virtual void gko::LinOp::apply_impl ( const LinOp b,
LinOp x 
) const
protectedpure virtual

Implementers of LinOp should override this function instead of apply(const LinOp *, LinOp *).

Performs the operation x = op(b), where op is this linear operator.

Parameters
bthe input vector(s) on which the operator is applied
xthe output vector(s) where the result is stored

Referenced by apply(), apply(), apply(), and apply().

◆ apply_uses_initial_guess()

virtual bool gko::LinOp::apply_uses_initial_guess ( ) const
inlinevirtual

Returns true if the linear operator uses the data given in x as an initial guess. Returns false otherwise.

Returns
true if the linear operator uses the data given in x as an initial guess. Returns false otherwise.

◆ get_size()

const dim< 2 > & gko::LinOp::get_size ( ) const
inlinenoexcept

Returns the size of the operator.

Returns
size of the operator

Referenced by gko::experimental::reorder::ScaledReordered< ValueType, IndexType >::set_cache_to().

◆ operator=() [1/2]

LinOp & gko::LinOp::operator= ( const LinOp )
default

Copy-assigns a LinOp. Preserves the executor and copies the size.

◆ operator=() [2/2]

LinOp & gko::LinOp::operator= ( LinOp &&  other)
inline

Move-assigns a LinOp. Preserves the executor and moves the size. The moved-from object has size 0x0 afterwards, but its executor is unchanged.

References set_size().

◆ set_size()

void gko::LinOp::set_size ( const dim< 2 > &  value)
inlineprotectednoexcept

Sets the size of the operator.

Parameters
valuethe new size of the operator

Referenced by operator=().

◆ validate_application_parameters() [1/2]

void gko::LinOp::validate_application_parameters ( const LinOp alpha,
const LinOp b,
const LinOp beta,
const LinOp x 
) const
inlineprotected

Throws a DimensionMismatch exception if the parameters to apply are of the wrong size.

Parameters
alphascaling of the result of op(b)
bvector(s) on which the operator is applied
betascaling of the input x
xoutput vector(s)

◆ validate_application_parameters() [2/2]

void gko::LinOp::validate_application_parameters ( const LinOp b,
const LinOp x 
) const
inlineprotected

Throws a DimensionMismatch exception if the parameters to apply are of the wrong size.

Parameters
bvector(s) on which the operator is applied
xoutput vector(s)

Referenced by apply(), apply(), apply(), and apply().


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