![]() |
Ginkgo Generated from branch based on main. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
|
Ell is a sparse matrix format that stores the same number of nonzeros in each row, enabling coalesced accesses. More...
#include <ginkgo/core/matrix/batch_ell.hpp>
Public Types | |
using | value_type = ValueType |
using | index_type = IndexType |
using | unbatch_type = gko::matrix::Ell<value_type, index_type> |
using | absolute_type = remove_complex<Ell> |
using | complex_type = to_complex<Ell> |
Public Types inherited from gko::EnablePolymorphicAssignment< Ell< default_precision, int32 > > | |
using | result_type |
Public Types inherited from gko::ConvertibleTo< Ell< default_precision, int32 > > | |
using | result_type |
Public Types inherited from gko::ConvertibleTo< Ell< next_precision< default_precision >, int32 > > | |
using | result_type |
Public Member Functions | |
void | convert_to (Ell< next_precision< ValueType >, IndexType > *result) const override |
void | move_to (Ell< next_precision< ValueType >, IndexType > *result) override |
std::unique_ptr< unbatch_type > | create_view_for_item (size_type item_id) |
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object. | |
std::unique_ptr< const unbatch_type > | create_const_view_for_item (size_type item_id) const |
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object. | |
value_type * | get_values () noexcept |
Returns a pointer to the array of values of the matrix. | |
const value_type * | get_const_values () const noexcept |
Returns a pointer to the array of values of the matrix. | |
index_type * | get_col_idxs () noexcept |
Returns a pointer to the array of column indices of the matrix. | |
const index_type * | get_const_col_idxs () const noexcept |
Returns a pointer to the array of column indices of the matrix. | |
index_type | get_num_stored_elements_per_row () const noexcept |
Returns the number of elements per row explicitly stored. | |
size_type | get_num_stored_elements () const noexcept |
Returns the number of elements explicitly stored in the batch matrix, cumulative across all the batch items. | |
size_type | get_num_elements_per_item () const noexcept |
Returns the number of stored elements in each batch item. | |
index_type * | get_col_idxs_for_item (size_type batch_id) noexcept |
Returns a pointer to the array of col_idxs of the matrix. | |
const index_type * | get_const_col_idxs_for_item (size_type batch_id) const noexcept |
Returns a pointer to the array of col_idxs of the matrix. | |
value_type * | get_values_for_item (size_type batch_id) noexcept |
Returns a pointer to the array of values of the matrix for a specific batch item. | |
const value_type * | get_const_values_for_item (size_type batch_id) const noexcept |
Returns a pointer to the array of values of the matrix for a specific batch item. | |
Ell * | apply (ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x) |
Apply the matrix to a multi-vector. | |
Ell * | apply (ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x) |
Apply the matrix to a multi-vector with a linear combination of the given input vector. | |
const Ell * | apply (ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x) const |
const Ell * | apply (ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x) const |
void | scale (const array< value_type > &row_scale, const array< value_type > &col_scale) |
Performs in-place row and column scaling for this matrix. | |
void | add_scaled_identity (ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > beta) |
Performs the operation this = alpha*I + beta*this. | |
Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< Ell< default_precision, int32 >, BatchLinOp > | |
std::unique_ptr< Ell< default_precision, int32 > > | create_default (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< Ell< default_precision, int32 > > | clone (std::shared_ptr< const Executor > exec) const |
Ell< default_precision, int32 > * | copy_from (const PolymorphicObject *other) |
Ell< default_precision, int32 > * | move_from (ptr_param< PolymorphicObject > other) |
Ell< default_precision, int32 > * | clear () |
Public Member Functions inherited from gko::EnablePolymorphicAssignment< Ell< default_precision, int32 > > | |
void | convert_to (result_type *result) const override |
void | move_to (result_type *result) override |
Public Member Functions inherited from gko::ConvertibleTo< Ell< next_precision< default_precision >, int32 > > | |
virtual void | convert_to (result_type *result) const=0 |
Converts the implementer to an object of type result_type. | |
virtual void | move_to (result_type *result)=0 |
Converts the implementer to an object of type result_type by moving data from this object. |
Static Public Member Functions | |
static std::unique_ptr< Ell > | create (std::shared_ptr< const Executor > exec, const batch_dim< 2 > &size=batch_dim< 2 >{}, const IndexType num_elems_per_row=0) |
Creates an uninitialized Ell matrix of the specified size. | |
static std::unique_ptr< Ell > | create (std::shared_ptr< const Executor > exec, const batch_dim< 2 > &size, const IndexType num_elems_per_row, array< value_type > values, array< index_type > col_idxs) |
Creates a Ell matrix from an already allocated (and initialized) array. | |
template<typename InputValueType, typename ColIndexType> | |
static std::unique_ptr< Ell > | create (std::shared_ptr< const Executor > exec, const batch_dim< 2 > &size, const IndexType num_elems_per_row, std::initializer_list< InputValueType > values, std::initializer_list< ColIndexType > col_idxs) |
create(std::shared_ptr<const Executor>,const batch_dim<2>&, const IndexType, array<value_type>,array<index_type>) | |
static std::unique_ptr< const Ell > | create_const (std::shared_ptr< const Executor > exec, const batch_dim< 2 > &sizes, const index_type num_elems_per_row, gko::detail::const_array_view< value_type > &&values, gko::detail::const_array_view< index_type > &&col_idxs) |
Creates a constant (immutable) batch ell matrix from a constant array. |
Friends | |
class | EnablePolymorphicObject< Ell, BatchLinOp > |
class | Ell< to_complex< ValueType >, IndexType > |
class | Ell< previous_precision< ValueType >, IndexType > |
Ell is a sparse matrix format that stores the same number of nonzeros in each row, enabling coalesced accesses.
It is suitable for sparsity patterns that have a similar number of nonzeros in every row. The values are stored in a column-major fashion similar to the monolithic gko::matrix::Ell class.
Similar to the monolithic gko::matrix::Ell class, invalid_index<IndexType> is used as the column index for padded zero entries.
ValueType | value precision of matrix elements |
IndexType | index precision of matrix elements |
void gko::batch::matrix::Ell< ValueType, IndexType >::add_scaled_identity | ( | ptr_param< const MultiVector< value_type > > | alpha, |
ptr_param< const MultiVector< value_type > > | beta ) |
Performs the operation this = alpha*I + beta*this.
alpha | the scalar for identity |
beta | the scalar to multiply this matrix |
Ell * gko::batch::matrix::Ell< ValueType, IndexType >::apply | ( | ptr_param< const MultiVector< value_type > > | alpha, |
ptr_param< const MultiVector< value_type > > | b, | ||
ptr_param< const MultiVector< value_type > > | beta, | ||
ptr_param< MultiVector< value_type > > | x ) |
Apply the matrix to a multi-vector with a linear combination of the given input vector.
Represents the matrix vector multiplication, x = alpha * A
alpha | the scalar to scale the matrix-vector product with |
b | the multi-vector to be applied to |
beta | the scalar to scale the x vector with |
x | the output multi-vector |
const Ell * gko::batch::matrix::Ell< ValueType, IndexType >::apply | ( | ptr_param< const MultiVector< value_type > > | alpha, |
ptr_param< const MultiVector< value_type > > | b, | ||
ptr_param< const MultiVector< value_type > > | beta, | ||
ptr_param< MultiVector< value_type > > | x ) const |
Ell * gko::batch::matrix::Ell< ValueType, IndexType >::apply | ( | ptr_param< const MultiVector< value_type > > | b, |
ptr_param< MultiVector< value_type > > | x ) |
Apply the matrix to a multi-vector.
Represents the matrix vector multiplication, x = A * b, where x and b are both multi-vectors.
b | the multi-vector to be applied to |
x | the output multi-vector |
const Ell * gko::batch::matrix::Ell< ValueType, IndexType >::apply | ( | ptr_param< const MultiVector< value_type > > | b, |
ptr_param< MultiVector< value_type > > | x ) const |
|
static |
Creates a Ell matrix from an already allocated (and initialized) array.
The column indices array needs to be the same for all batch items.
exec | Executor associated to the matrix |
size | size of the matrix |
num_elems_per_row | the number of elements to be stored in each row |
values | array of matrix values |
col_idxs | the col_idxs array of a single batch item of the matrix. |
|
inlinestatic |
|
static |
|
static |
Creates a constant (immutable) batch ell matrix from a constant array.
The column indices array needs to be the same for all batch items.
exec | the executor to create the matrix on |
size | the dimensions of the matrix |
num_elems_per_row | the number of elements to be stored in each row |
values | the value array of the matrix |
col_idxs | the col_idxs array of a single batch item of the matrix. |
std::unique_ptr< const unbatch_type > gko::batch::matrix::Ell< ValueType, IndexType >::create_const_view_for_item | ( | size_type | item_id | ) | const |
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object.
Does not perform any deep copies, but only returns a view of the data.
item_id | The index of the batch item |
std::unique_ptr< unbatch_type > gko::batch::matrix::Ell< ValueType, IndexType >::create_view_for_item | ( | size_type | item_id | ) |
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object.
Does not perform any deep copies, but only returns a view of the data.
item_id | The index of the batch item |
|
inlinenoexcept |
Returns a pointer to the array of column indices of the matrix.
|
inlinenoexcept |
Returns a pointer to the array of col_idxs of the matrix.
This is shared across all batch items.
batch_id | the id of the batch item. |
|
inlinenoexcept |
Returns a pointer to the array of column indices of the matrix.
|
inlinenoexcept |
Returns a pointer to the array of col_idxs of the matrix.
This is shared across all batch items.
batch_id | the id of the batch item. |
|
inlinenoexcept |
Returns a pointer to the array of values of the matrix.
|
inlinenoexcept |
Returns a pointer to the array of values of the matrix for a specific batch item.
batch_id | the id of the batch item. |
References get_num_elements_per_item().
|
inlinenoexcept |
Returns the number of stored elements in each batch item.
References get_num_stored_elements().
Referenced by get_const_values_for_item(), and get_values_for_item().
|
inlinenoexcept |
Returns the number of elements explicitly stored in the batch matrix, cumulative across all the batch items.
Referenced by get_num_elements_per_item().
|
inlinenoexcept |
Returns the number of elements per row explicitly stored.
|
inlinenoexcept |
Returns a pointer to the array of values of the matrix.
|
inlinenoexcept |
Returns a pointer to the array of values of the matrix for a specific batch item.
batch_id | the id of the batch item. |
References get_num_elements_per_item().
void gko::batch::matrix::Ell< ValueType, IndexType >::scale | ( | const array< value_type > & | row_scale, |
const array< value_type > & | col_scale ) |
Performs in-place row and column scaling for this matrix.
row_scale | the row scalars |
col_scale | the column scalars |