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

This class is a utility which efficiently implements the diagonal matrix (a linear operator which scales a vector row wise). More...

#include <ginkgo/core/matrix/diagonal.hpp>

Collaboration diagram for gko::matrix::Diagonal< ValueType >:
[legend]

Public Types

using value_type = ValueType
 
using index_type = int64
 
using mat_data = gko::matrix_data< ValueType, int64 >
 
using mat_data32 = gko::matrix_data< ValueType, int32 >
 
using absolute_type = remove_complex< Diagonal >
 
- Public Types inherited from gko::EnablePolymorphicAssignment< Diagonal< ValueType > >
using result_type = Diagonal< ValueType >
 
- Public Types inherited from gko::ConvertibleTo< Diagonal< ValueType > >
using result_type = Diagonal< ValueType >
 
- Public Types inherited from gko::ConvertibleTo< Csr< ValueType, int32 > >
using result_type = Csr< ValueType, int32 >
 
- Public Types inherited from gko::ConvertibleTo< Csr< ValueType, int64 > >
using result_type = Csr< ValueType, int64 >
 
- Public Types inherited from gko::WritableToMatrixData< ValueType, int32 >
using value_type = ValueType
 
using index_type = int32
 
- Public Types inherited from gko::WritableToMatrixData< ValueType, int64 >
using value_type = ValueType
 
using index_type = int64
 
- Public Types inherited from gko::ReadableFromMatrixData< ValueType, int32 >
using value_type = ValueType
 
using index_type = int32
 
- Public Types inherited from gko::ReadableFromMatrixData< ValueType, int64 >
using value_type = ValueType
 
using index_type = int64
 
- Public Types inherited from gko::EnableAbsoluteComputation< remove_complex< Diagonal< ValueType > > >
using absolute_type = remove_complex< Diagonal< ValueType > >
 

Public Member Functions

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...
 
void convert_to (Csr< ValueType, int32 > *result) const override
 
void move_to (Csr< ValueType, int32 > *result) override
 
void convert_to (Csr< ValueType, int64 > *result) const override
 
void move_to (Csr< ValueType, int64 > *result) override
 
std::unique_ptr< absolute_type > compute_absolute () const override
 Gets the AbsoluteLinOp. More...
 
void compute_absolute_inplace () override
 Compute absolute inplace on each element.
 
value_type * get_values () noexcept
 Returns a pointer to the array of values of the matrix. More...
 
const value_type * get_const_values () const noexcept
 Returns a pointer to the array of values of the matrix. More...
 
void rapply (const LinOp *b, LinOp *x) const
 Applies the diagonal matrix from the right side to a matrix b, which means scales the columns of b with the according diagonal entries. More...
 
void read (const mat_data &data) override
 
void read (const mat_data32 &data) override
 
void write (mat_data &data) const override
 
void write (mat_data32 &data) const override
 
- Public Member Functions inherited from gko::EnableLinOp< Diagonal< ValueType > >
const Diagonal< ValueType > * apply (const LinOp *b, LinOp *x) const
 
Diagonal< ValueType > * apply (const LinOp *b, LinOp *x)
 
const Diagonal< ValueType > * apply (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x) const
 
Diagonal< ValueType > * apply (const LinOp *alpha, const LinOp *b, const LinOp *beta, LinOp *x)
 
- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< Diagonal< ValueType >, LinOp >
std::unique_ptr< Diagonal< ValueType > > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Diagonal< ValueType > > create_default () const
 
std::unique_ptr< Diagonal< ValueType > > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Diagonal< ValueType > > clone () const
 
Diagonal< ValueType > * copy_from (const PolymorphicObject *other)
 
Diagonal< ValueType > * copy_from (std::unique_ptr< PolymorphicObject > other)
 
Diagonal< ValueType > * 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< Diagonal< ValueType > >
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...
 
- Public Member Functions inherited from gko::ConvertibleTo< Csr< ValueType, int32 > >
virtual void convert_to (result_type *result) const=0
 Converts the implementer to an object of type result_type. More...
 
virtual void move_to (result_type *result)=0
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
- Public Member Functions inherited from gko::ConvertibleTo< Csr< ValueType, int64 > >
virtual void convert_to (result_type *result) const=0
 Converts the implementer to an object of type result_type. More...
 
virtual void move_to (result_type *result)=0
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
- Public Member Functions inherited from gko::WritableToMatrixData< ValueType, int32 >
virtual void write (matrix_data< ValueType, int32 > &data) const=0
 Writes a matrix to a matrix_data structure. More...
 
- Public Member Functions inherited from gko::WritableToMatrixData< ValueType, int64 >
virtual void write (matrix_data< ValueType, int64 > &data) const=0
 Writes a matrix to a matrix_data structure. More...
 
- Public Member Functions inherited from gko::ReadableFromMatrixData< ValueType, int32 >
virtual void read (const matrix_data< ValueType, int32 > &data)=0
 Reads a matrix from a matrix_data structure. More...
 
void read (const matrix_assembly_data< ValueType, int32 > &data)
 Reads a matrix from a matrix_assembly_data structure. More...
 
- Public Member Functions inherited from gko::ReadableFromMatrixData< ValueType, int64 >
virtual void read (const matrix_data< ValueType, int64 > &data)=0
 Reads a matrix from a matrix_data structure. More...
 
void read (const matrix_assembly_data< ValueType, int64 > &data)
 Reads a matrix from a matrix_assembly_data structure. More...
 
- Public Member Functions inherited from gko::EnableAbsoluteComputation< remove_complex< Diagonal< ValueType > > >
std::unique_ptr< LinOpcompute_absolute_linop () const override
 Gets the absolute LinOp. More...
 

Friends

class EnablePolymorphicObject< Diagonal, LinOp >
 
class EnableCreateMethod< Diagonal >
 
class Csr< ValueType, int32 >
 
class Csr< ValueType, int64 >
 
class Diagonal< to_complex< ValueType > >
 

Additional Inherited Members

- Static Public Member Functions inherited from gko::EnableCreateMethod< Diagonal< ValueType > >
static std::unique_ptr< Diagonal< ValueType > > create (Args &&... args)
 

Detailed Description

template<typename ValueType = default_precision>
class gko::matrix::Diagonal< ValueType >

This class is a utility which efficiently implements the diagonal matrix (a linear operator which scales a vector row wise).

Objects of the Diagonal class always represent a square matrix, and require one array to store their values.

Template Parameters
ValueTypeprecision of matrix elements
IndexTypeprecision of matrix indexes of a CSR matrix the diagonal is applied or converted to.

Member Function Documentation

◆ compute_absolute()

template<typename ValueType = default_precision>
std::unique_ptr<absolute_type> gko::matrix::Diagonal< ValueType >::compute_absolute ( ) const
overridevirtual

Gets the AbsoluteLinOp.

Returns
a pointer to the new absolute object

Implements gko::EnableAbsoluteComputation< remove_complex< Diagonal< ValueType > > >.

◆ conj_transpose()

template<typename ValueType = default_precision>
std::unique_ptr<LinOp> gko::matrix::Diagonal< ValueType >::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_const_values()

template<typename ValueType = default_precision>
const value_type* gko::matrix::Diagonal< ValueType >::get_const_values ( ) const
inlinenoexcept

Returns a pointer to the array of values of the matrix.

Returns
the pointer to the array of values
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.

References gko::Array< ValueType >::get_const_data().

◆ get_values()

template<typename ValueType = default_precision>
value_type* gko::matrix::Diagonal< ValueType >::get_values ( )
inlinenoexcept

Returns a pointer to the array of values of the matrix.

Returns
the pointer to the array of values

References gko::Array< ValueType >::get_data().

◆ rapply()

template<typename ValueType = default_precision>
void gko::matrix::Diagonal< ValueType >::rapply ( const LinOp b,
LinOp x 
) const
inline

Applies the diagonal matrix from the right side to a matrix b, which means scales the columns of b with the according diagonal entries.

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

◆ transpose()

template<typename ValueType = default_precision>
std::unique_ptr<LinOp> gko::matrix::Diagonal< ValueType >::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 files: