Diagonal< ValueType > Class Template Reference#
|
Reference API
|
#include <ginkgo/core/matrix/diagonal.hpp>
Public Types | |
| using | value_type = ValueType |
| using | index_type = int64 |
| using | mat_data = matrix_data< ValueType, int64 > |
| using | mat_data32 = matrix_data< ValueType, int32 > |
| using | device_mat_data = device_matrix_data< ValueType, int64 > |
| using | device_mat_data32 = device_matrix_data< ValueType, int32 > |
| using | absolute_type = remove_complex< Diagonal > |
Public Types inherited from gko::EnablePolymorphicAssignment< ConcreteLinOp > | |
| using | result_type = ConcreteLinOp |
Public Types inherited from gko::ConvertibleTo< ResultType > | |
| using | result_type = ResultType |
Public Types inherited from gko::WritableToMatrixData< ValueType, IndexType > | |
| using | value_type = ValueType |
| using | index_type = IndexType |
Public Types inherited from gko::ReadableFromMatrixData< ValueType, IndexType > | |
| using | value_type = ValueType |
| using | index_type = IndexType |
Public Types inherited from gko::EnableAbsoluteComputation< AbsoluteLinOp > | |
| using | absolute_type = AbsoluteLinOp |
Public Member Functions | |
| std::unique_ptr< LinOp > | transpose () const override |
| std::unique_ptr< LinOp > | conj_transpose () const override |
| void | convert_to (Diagonal< next_precision< ValueType > > *result) const override |
| void | move_to (Diagonal< next_precision< ValueType > > *result) override |
| void | convert_to (Diagonal< next_precision< next_precision< ValueType > > > *result) const override |
| void | move_to (Diagonal< next_precision< next_precision< ValueType > > > *result) override |
| 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 |
| void | compute_absolute_inplace () override |
| value_type * | get_values () noexcept |
| const value_type * | get_const_values () const noexcept |
| void | rapply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const |
| void | inverse_apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const |
| void | read (const mat_data &data) override |
| void | read (const mat_data32 &data) override |
| void | read (const device_mat_data &data) override |
| void | read (const device_mat_data32 &data) override |
| void | read (device_mat_data &&data) override |
| void | read (device_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< 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 | |
| PolymorphicObject & | operator= (const PolymorphicObject &) |
| std::unique_ptr< PolymorphicObject > | create_default (std::shared_ptr< const Executor > exec) const |
| std::unique_ptr< PolymorphicObject > | create_default () const |
| std::unique_ptr< PolymorphicObject > | clone (std::shared_ptr< const Executor > exec) const |
| std::unique_ptr< PolymorphicObject > | clone () const |
| PolymorphicObject * | copy_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) |
| PolymorphicObject * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
| PolymorphicObject * | move_from (ptr_param< PolymorphicObject > other) |
| PolymorphicObject * | clear () |
| std::shared_ptr< const Executor > | get_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) |
Public Member Functions inherited from gko::WritableToMatrixData< ValueType, IndexType > | |
| virtual void | write (matrix_data< ValueType, IndexType > &data) const =0 |
Public Member Functions inherited from gko::ReadableFromMatrixData< ValueType, IndexType > | |
| virtual void | read (const matrix_data< ValueType, IndexType > &data)=0 |
| void | read (const matrix_assembly_data< ValueType, IndexType > &data) |
| virtual void | read (const device_matrix_data< ValueType, IndexType > &data) |
| virtual void | read (device_matrix_data< ValueType, IndexType > &&data) |
Public Member Functions inherited from gko::EnableAbsoluteComputation< AbsoluteLinOp > | |
| std::unique_ptr< LinOp > | compute_absolute_linop () const override |
Static Public Member Functions | |
| static std::unique_ptr< Diagonal > | create (std::shared_ptr< const Executor > exec, size_type size=0) |
| static std::unique_ptr< Diagonal > | create (std::shared_ptr< const Executor > exec, const size_type size, array< value_type > values) |
| template<typename InputValueType > | |
| static std::unique_ptr< Diagonal > | create (std::shared_ptr< const Executor > exec, const size_type size, std::initializer_list< InputValueType > values) |
| create(std::shared_ptr<constExecutor>, const size_type, array<value_type>) | |
| static std::unique_ptr< const Diagonal > | create_const (std::shared_ptr< const Executor > exec, size_type size, gko::detail::const_array_view< ValueType > &&values) |
Protected Member Functions | |
| Diagonal (std::shared_ptr< const Executor > exec, size_type size=0) | |
| Diagonal (std::shared_ptr< const Executor > exec, const size_type size, array< value_type > values) | |
| 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 | rapply_impl (const LinOp *b, LinOp *x) const |
| void | inverse_apply_impl (const LinOp *b, LinOp *x) const |
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< PolymorphicObject > | create_default_impl (std::shared_ptr< const Executor > exec) const override |
| PolymorphicObject * | copy_from_impl (const PolymorphicObject *other) override |
| PolymorphicObject * | copy_from_impl (std::unique_ptr< PolymorphicObject > other) override |
| PolymorphicObject * | move_from_impl (PolymorphicObject *other) override |
| PolymorphicObject * | move_from_impl (std::unique_ptr< PolymorphicObject > other) override |
| PolymorphicObject * | clear_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 |
Additional Inherited Members | |
Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject > | |
| std::vector< std::shared_ptr< const Logger > > | loggers_ |
Detailed Description
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
-
ValueType precision of matrix elements IndexType precision of matrix indexes of a CSR matrix the diagonal is applied or converted to.
Member Function Documentation
◆ compute_absolute()
|
overridevirtual |
Gets the AbsoluteLinOp
- Returns
- a pointer to the new absolute object
Implements gko::EnableAbsoluteComputation< AbsoluteLinOp >.
◆ compute_absolute_inplace()
|
overridevirtual |
Compute absolute inplace on each element.
Implements gko::AbsoluteComputable.
◆ conj_transpose()
|
overridevirtual |
Returns a LinOp representing the conjugate transpose of the Transposable object.
- Returns
- a pointer to the new conjugate transposed object
Implements gko::Transposable.
◆ create() [1/3]
|
static |
Creates a Diagonal matrix from an already allocated (and initialized) array.
- Parameters
-
exec Executor associated to the matrix size size of the matrix values array of matrix values
- Note
- If
valuesis not an rvalue, not an array of ValueType, or is on the wrong executor, an internal copy will be created, and the original array data will not be used in the matrix.
- Returns
- A smart pointer to the newly created matrix.
◆ create() [2/3]
|
inlinestatic |
create(std::shared_ptr<constExecutor>, const size_type, array<value_type>)
create(std::shared_ptr<constExecutor>, const size_type, array<value_type>)
References gko::matrix::Diagonal< ValueType >::create().
◆ create() [3/3]
|
static |
Creates an Diagonal matrix of the specified size.
- Parameters
-
exec Executor associated to the matrix size size of the matrix
- Returns
- A smart pointer to the newly created matrix.
Referenced by gko::matrix::Diagonal< ValueType >::create().
◆ create_const()
|
static |
Creates a constant (immutable) Diagonal matrix from a constant array.
- Parameters
-
exec the executor to create the matrix on size the size of the square matrix values the value array of the matrix
- Returns
- A smart pointer to the constant matrix wrapping the input array (if it resides on the same executor as the matrix) or a copy of the array on the correct executor.
◆ get_const_values()
|
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()
|
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().
◆ inverse_apply()
|
inline |
Applies the inverse of the diagonal matrix to a matrix b, which means scales the columns of b with the inverse of the according diagonal entries.
- Parameters
-
b the input vector(s) on which the inverse of the diagonal matrix is applied x the output vector(s) where the result is stored
References gko::ptr_param< T >::get().
◆ rapply()
|
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
-
b the input vector(s) on which the diagonal matrix is applied x the output vector(s) where the result is stored
References gko::ptr_param< T >::get().
◆ transpose()
|
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:
- ginkgo/core/base/lin_op.hpp
- ginkgo/core/matrix/diagonal.hpp
Generated by
Public Types inherited from