Ginkgo: gko::matrix::Dense< ValueType > Class Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::matrix::Dense< ValueType > Class Template Reference
Linear Operators » SpMV employing different Matrix formats | Linear Operators

Dense is a matrix format which explicitly stores all values of the matrix. More...

`#include <ginkgo/core/matrix/dense.hpp>`

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

## Public Types
using | value_type = ValueType
using | index_type = int64
using | transposed_type = Dense<ValueType>
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<Dense>
using | real_type = absolute_type
using | complex_type = to_complex<Dense>
using | row_major_range = gko::range<gko::accessor::row_major<ValueType, 2>>
Public Types inherited from gko::EnablePolymorphicAssignment< Dense< default_precision > >
using | result_type
Public Types inherited from gko::DiagonalExtractable< default_precision >
using | value_type
Public Types inherited from gko::ReadableFromMatrixData< default_precision, int32 >
using | value_type
using | index_type
Public Types inherited from gko::ReadableFromMatrixData< default_precision, int64 >
using | value_type
using | index_type
Public Types inherited from gko::WritableToMatrixData< default_precision, int32 >
using | value_type
using | index_type
Public Types inherited from gko::WritableToMatrixData< default_precision, int64 >
using | value_type
using | index_type
Public Types inherited from gko::EnableAbsoluteComputation< remove_complex< Dense< default_precision > > >
using | absolute_type

## Public Member Functions
void | convert_to (Dense< next_precision< ValueType > > *result) const override
void | move_to (Dense< next_precision< ValueType > > *result) override
void | convert_to (Coo< ValueType, int32 > *result) const override
void | move_to (Coo< ValueType, int32 > *result) override
void | convert_to (Coo< ValueType, int64 > *result) const override
void | move_to (Coo< ValueType, int64 > *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
void | convert_to (Ell< ValueType, int32 > *result) const override
void | move_to (Ell< ValueType, int32 > *result) override
void | convert_to (Ell< ValueType, int64 > *result) const override
void | move_to (Ell< ValueType, int64 > *result) override
void | convert_to (Fbcsr< ValueType, int32 > *result) const override
void | move_to (Fbcsr< ValueType, int32 > *result) override
void | convert_to (Fbcsr< ValueType, int64 > *result) const override
void | move_to (Fbcsr< ValueType, int64 > *result) override
void | convert_to (Hybrid< ValueType, int32 > *result) const override
void | move_to (Hybrid< ValueType, int32 > *result) override
void | convert_to (Hybrid< ValueType, int64 > *result) const override
void | move_to (Hybrid< ValueType, int64 > *result) override
void | convert_to (Sellp< ValueType, int32 > *result) const override
void | move_to (Sellp< ValueType, int32 > *result) override
void | convert_to (Sellp< ValueType, int64 > *result) const override
void | move_to (Sellp< ValueType, int64 > *result) override
void | convert_to (SparsityCsr< ValueType, int32 > *result) const override
void | move_to (SparsityCsr< ValueType, int32 > *result) override
void | convert_to (SparsityCsr< ValueType, int64 > *result) const override
void | move_to (SparsityCsr< ValueType, int64 > *result) override
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
std::unique_ptr< LinOp > | transpose () const override
| Returns a LinOp representing the transpose of the Transposable object.
std::unique_ptr< LinOp > | conj_transpose () const override
| Returns a LinOp representing the conjugate transpose of the Transposable object.
void | transpose (ptr_param< Dense > output) const
| Writes the transposed matrix into the given output matrix.
void | conj_transpose (ptr_param< Dense > output) const
| Writes the conjugate-transposed matrix into the given output matrix.
void | fill (const ValueType value)
| Fill the dense matrix with a given value.
std::unique_ptr< Dense > | permute (ptr_param< const Permutation< int32 > > permutation, permute_mode mode=permute_mode::symmetric) const
| Creates a permuted copy of this matrix with the given permutation .
std::unique_ptr< Dense > | permute (ptr_param< const Permutation< int64 > > permutation, permute_mode mode=permute_mode::symmetric) const
void | permute (ptr_param< const Permutation< int32 > > permutation, ptr_param< Dense > output, permute_mode mode) const
| Overload of permute(ptr_param<const Permutation<int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.
void | permute (ptr_param< const Permutation< int64 > > permutation, ptr_param< Dense > output, permute_mode mode) const
std::unique_ptr< Dense > | permute (ptr_param< const Permutation< int32 > > row_permutation, ptr_param< const Permutation< int32 > > column_permutation, bool invert=false) const
| Creates a non-symmetrically permuted copy of this matrix with the given row and column permutations and .
std::unique_ptr< Dense > | permute (ptr_param< const Permutation< int64 > > row_permutation, ptr_param< const Permutation< int64 > > column_permutation, bool invert=false) const
void | permute (ptr_param< const Permutation< int32 > > row_permutation, ptr_param< const Permutation< int32 > > column_permutation, ptr_param< Dense > output, bool invert=false) const
| Overload of permute(ptr_param<const Permutation<int32>>, ptr_param<const Permutation<int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.
void | permute (ptr_param< const Permutation< int64 > > row_permutation, ptr_param< const Permutation< int64 > > column_permutation, ptr_param< Dense > output, bool invert=false) const
std::unique_ptr< Dense > | scale_permute (ptr_param< const ScaledPermutation< value_type, int32 > > permutation, permute_mode mode=permute_mode::symmetric) const
| Creates a scaled and permuted copy of this matrix.
std::unique_ptr< Dense > | scale_permute (ptr_param< const ScaledPermutation< value_type, int64 > > permutation, permute_mode mode=permute_mode::symmetric) const
void | scale_permute (ptr_param< const ScaledPermutation< value_type, int32 > > permutation, ptr_param< Dense > output, permute_mode mode) const
| Overload of scale_permute(ptr_param<const ScaledPermutation<value_type, int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.
void | scale_permute (ptr_param< const ScaledPermutation< value_type, int64 > > permutation, ptr_param< Dense > output, permute_mode mode) const
std::unique_ptr< Dense > | scale_permute (ptr_param< const ScaledPermutation< value_type, int32 > > row_permutation, ptr_param< const ScaledPermutation< value_type, int32 > > column_permutation, bool invert=false) const
| Creates a scaled and permuted copy of this matrix.
std::unique_ptr< Dense > | scale_permute (ptr_param< const ScaledPermutation< value_type, int64 > > row_permutation, ptr_param< const ScaledPermutation< value_type, int64 > > column_permutation, bool invert=false) const
void | scale_permute (ptr_param< const ScaledPermutation< value_type, int32 > > row_permutation, ptr_param< const ScaledPermutation< value_type, int32 > > column_permutation, ptr_param< Dense > output, bool invert=false) const
| Overload of scale_permute(ptr_param<const ScaledPermutation<value_type, int32>>, ptr_param<const ScaledPermutation<value_type, int32>>, bool) that writes the permuted copy into an existing Dense matrix.
void | scale_permute (ptr_param< const ScaledPermutation< value_type, int64 > > row_permutation, ptr_param< const ScaledPermutation< value_type, int64 > > column_permutation, ptr_param< Dense > output, bool invert=false) const
std::unique_ptr< LinOp > | permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the symmetric row and column permutation of the Permutable object.
std::unique_ptr< LinOp > | permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the symmetric row and column permutation of the Permutable object.
void | permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the symmetrically permuted matrix into the given output matrix.
void | permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< LinOp > | inverse_permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the symmetric inverse row and column permutation of the Permutable object.
std::unique_ptr< LinOp > | inverse_permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the symmetric inverse row and column permutation of the Permutable object.
void | inverse_permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the inverse symmetrically permuted matrix into the given output matrix.
void | inverse_permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< LinOp > | row_permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the Permutable object.
std::unique_ptr< LinOp > | row_permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the Permutable object.
void | row_permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the row-permuted matrix into the given output matrix.
void | row_permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< Dense > | row_gather (const array< int32 > *gather_indices) const
| Create a Dense matrix consisting of the given rows from this matrix.
std::unique_ptr< Dense > | row_gather (const array< int64 > *gather_indices) const
| Create a Dense matrix consisting of the given rows from this matrix.
void | row_gather (const array< int32 > *gather_indices, ptr_param< LinOp > row_collection) const
| Copies the given rows from this matrix into row_collection.
void | row_gather (const array< int64 > *gather_indices, ptr_param< LinOp > row_collection) const
void | row_gather (ptr_param< const LinOp > alpha, const array< int32 > *gather_indices, ptr_param< const LinOp > beta, ptr_param< LinOp > row_collection) const
| Copies the given rows from this matrix into row_collection with scaling.
void | row_gather (ptr_param< const LinOp > alpha, const array< int64 > *gather_indices, ptr_param< const LinOp > beta, ptr_param< LinOp > row_collection) const
std::unique_ptr< LinOp > | column_permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the column permutation of the Permutable object.
std::unique_ptr< LinOp > | column_permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the column permutation of the Permutable object.
void | column_permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the column-permuted matrix into the given output matrix.
void | column_permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< LinOp > | inverse_row_permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the inverse permuted object.
std::unique_ptr< LinOp > | inverse_row_permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the inverse permuted object.
void | inverse_row_permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the inverse row-permuted matrix into the given output matrix.
void | inverse_row_permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< LinOp > | inverse_column_permute (const array< int32 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the inverse permuted object.
std::unique_ptr< LinOp > | inverse_column_permute (const array< int64 > *permutation_indices) const override
| Returns a LinOp representing the row permutation of the inverse permuted object.
void | inverse_column_permute (const array< int32 > *permutation_indices, ptr_param< Dense > output) const
| Writes the inverse column-permuted matrix into the given output matrix.
void | inverse_column_permute (const array< int64 > *permutation_indices, ptr_param< Dense > output) const
std::unique_ptr< Diagonal< ValueType > > | extract_diagonal () const override
| Extracts the diagonal entries of the matrix into a vector.
void | extract_diagonal (ptr_param< Diagonal< ValueType > > output) const
| Writes the diagonal of this matrix into an existing diagonal matrix.
std::unique_ptr< absolute_type > | compute_absolute () const override
| Gets the AbsoluteLinOp.
void | compute_absolute (ptr_param< absolute_type > output) const
| Writes the absolute values of this matrix into an existing matrix.
void | compute_absolute_inplace () override
| Compute absolute inplace on each element.
std::unique_ptr< complex_type > | make_complex () const
| Creates a complex copy of the original matrix.
void | make_complex (ptr_param< complex_type > result) const
| Writes a complex copy of the original matrix to a given complex matrix.
std::unique_ptr< real_type > | get_real () const
| Creates a new real matrix and extracts the real part of the original matrix into that.
void | get_real (ptr_param< real_type > result) const
| Extracts the real part of the original matrix into a given real matrix.
std::unique_ptr< real_type > | get_imag () const
| Creates a new real matrix and extracts the imaginary part of the original matrix into that.
void | get_imag (ptr_param< real_type > result) const
| Extracts the imaginary part of the original matrix into a given real matrix.
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.
size_type | get_stride () const noexcept
| Returns the stride of the matrix.
size_type | get_num_stored_elements () const noexcept
| Returns the number of elements explicitly stored in the matrix.
value_type & | at (size_type row, size_type col) noexcept
| Returns a single element of the matrix.
value_type | at (size_type row, size_type col) const noexcept
| Returns a single element of the matrix.
ValueType & | at (size_type idx) noexcept
| Returns a single element of the matrix.
ValueType | at (size_type idx) const noexcept
| Returns a single element of the matrix.
void | scale (ptr_param< const LinOp > alpha)
| Scales the matrix with a scalar (aka: BLAS scal).
void | inv_scale (ptr_param< const LinOp > alpha)
| Scales the matrix with the inverse of a scalar.
void | add_scaled (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
| Adds b scaled by alpha to the matrix (aka: BLAS axpy).
void | sub_scaled (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
| Subtracts b scaled by alpha from the matrix (aka: BLAS axpy).
void | compute_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result) const
| Computes the column-wise dot product of this matrix and b.
void | compute_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result, array< char > &tmp) const
| Computes the column-wise dot product of this matrix and b.
void | compute_conj_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result) const
| Computes the column-wise dot product of conj(this matrix) and b.
void | compute_conj_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result, array< char > &tmp) const
| Computes the column-wise dot product of conj(this matrix) and b.
void | compute_norm2 (ptr_param< LinOp > result) const
| Computes the column-wise Euclidean (L^2) norm of this matrix.
void | compute_norm2 (ptr_param< LinOp > result, array< char > &tmp) const
| Computes the column-wise Euclidean (L^2) norm of this matrix.
void | compute_norm1 (ptr_param< LinOp > result) const
| Computes the column-wise (L^1) norm of this matrix.
void | compute_norm1 (ptr_param< LinOp > result, array< char > &tmp) const
| Computes the column-wise (L^1) norm of this matrix.
void | compute_squared_norm2 (ptr_param< LinOp > result) const
| Computes the square of the column-wise Euclidean (L^2) norm of this matrix.
void | compute_squared_norm2 (ptr_param< LinOp > result, array< char > &tmp) const
| Computes the square of the column-wise Euclidean (L^2) norm of this matrix.
void | compute_mean (ptr_param< LinOp > result) const
| Computes the column-wise arithmetic mean of this matrix.
void | compute_mean (ptr_param< LinOp > result, array< char > &tmp) const
| Computes the column-wise arithmetic mean of this matrix.
std::unique_ptr< Dense > | create_submatrix (const span &rows, const span &columns, const size_type stride)
| Create a submatrix from the original matrix.
std::unique_ptr< Dense > | create_submatrix (const span &rows, const span &columns)
| Create a submatrix from the original matrix.
std::unique_ptr< Dense > | create_submatrix (const local_span &rows, const local_span &columns, dim< 2 > size)
| Create a submatrix from the original matrix.
std::unique_ptr< real_type > | create_real_view ()
| Create a real view of the (potentially) complex original matrix.
std::unique_ptr< const real_type > | create_real_view () const
| Create a real view of the (potentially) complex original matrix.
Dense & | operator= (const Dense &)
| Copy-assigns a Dense matrix.
Dense & | operator= (Dense &&)
| Move-assigns a Dense matrix.
| Dense (const Dense &)
| Copy-constructs a Dense matrix.
| Dense (Dense &&)
| Move-constructs a Dense matrix.
Public Member Functions inherited from gko::EnableLinOp< Dense< default_precision > >
const Dense< default_precision > * | apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Public Member Functions inherited from gko::EnablePolymorphicAssignment< Dense< default_precision > >
void | convert_to (result_type *result) const override
void | move_to (result_type *result) override
Public Member Functions inherited from gko::DiagonalExtractable< default_precision >
std::unique_ptr< LinOp > | extract_diagonal_linop () const override
| Extracts the diagonal entries of the matrix into a vector.
Public Member Functions inherited from gko::ReadableFromMatrixData< default_precision, int32 >
virtual void | read (const matrix_data< default_precision, int32 > &data)=0
| Reads a matrix from a matrix_data structure.
Public Member Functions inherited from gko::ReadableFromMatrixData< default_precision, int64 >
virtual void | read (const matrix_data< default_precision, int64 > &data)=0
| Reads a matrix from a matrix_data structure.
Public Member Functions inherited from gko::WritableToMatrixData< default_precision, int32 >
virtual void | write (matrix_data< default_precision, int32 > &data) const=0
| Writes a matrix to a matrix_data structure.
Public Member Functions inherited from gko::WritableToMatrixData< default_precision, int64 >
virtual void | write (matrix_data< default_precision, int64 > &data) const=0
| Writes a matrix to a matrix_data structure.
Public Member Functions inherited from gko::EnableAbsoluteComputation< remove_complex< Dense< default_precision > > >
std::unique_ptr< LinOp > | compute_absolute_linop () const override
| Gets the absolute LinOp.
Public Member Functions inherited from gko::ScaledIdentityAddable
void | add_scaled_identity (ptr_param< const LinOp > const a, ptr_param< const LinOp > const b)
| Scales this and adds another scalar times the identity to it.

## Static Public Member Functions
static std::unique_ptr< Dense > | create_with_config_of (ptr_param< const Dense > other)
| Creates a Dense matrix with the same size and stride as another Dense matrix.
static std::unique_ptr< Dense > | create_with_type_of (ptr_param< const Dense > other, std::shared_ptr< const Executor > exec, const dim< 2 > &size=dim< 2 >{})
| Creates a Dense matrix with the same type as another Dense matrix but on a different executor and with a different size.
static std::unique_ptr< Dense > | create_with_type_of (ptr_param< const Dense > other, std::shared_ptr< const Executor > exec, const dim< 2 > &size, size_type stride)
static std::unique_ptr< Dense > | create_with_type_of (ptr_param< const Dense > other, std::shared_ptr< const Executor > exec, const dim< 2 > &size, const dim< 2 > &local_size, size_type stride)
static std::unique_ptr< Dense > | create_view_of (ptr_param< Dense > other)
| Creates a Dense matrix, where the underlying array is a view of another Dense matrix' array.
static std::unique_ptr< const Dense > | create_const_view_of (ptr_param< const Dense > other)
| Creates a immutable Dense matrix, where the underlying array is a view of another Dense matrix' array.
static std::unique_ptr< Dense > | create (std::shared_ptr< const Executor > exec, const dim< 2 > &size={}, size_type stride=0)
| Creates an uninitialized Dense matrix of the specified size.
static std::unique_ptr< Dense > | create (std::shared_ptr< const Executor > exec, const dim< 2 > &size, array< value_type > values, size_type stride)
| Creates a Dense matrix from an already allocated (and initialized) array.
template<typename InputValueType>
static std::unique_ptr< Dense > | create (std::shared_ptr< const Executor > exec, const dim< 2 > &size, std::initializer_list< InputValueType > values, size_type stride)
| create(std::shared_ptr<const Executor>,const dim<2>&, array<value_type>, size_type)
static std::unique_ptr< const Dense > | create_const (std::shared_ptr< const Executor > exec, const dim< 2 > &size, gko::detail::const_array_view< ValueType > &&values, size_type stride)
| Creates a constant (immutable) Dense matrix from a constant array.

## Friends
class | EnablePolymorphicObject< Dense, LinOp >
class | Coo< ValueType, int32 >
class | Coo< ValueType, int64 >
class | Csr< ValueType, int32 >
class | Csr< ValueType, int64 >
class | Diagonal< ValueType >
class | Ell< ValueType, int32 >
class | Ell< ValueType, int64 >
class | Fbcsr< ValueType, int32 >
class | Fbcsr< ValueType, int64 >
class | Hybrid< ValueType, int32 >
class | Hybrid< ValueType, int64 >
class | Sellp< ValueType, int32 >
class | Sellp< ValueType, int64 >
class | SparsityCsr< ValueType, int32 >
class | SparsityCsr< ValueType, int64 >
class | Dense< to_complex< ValueType > >
class | experimental::distributed::Vector< ValueType >
class | Dense< previous_precision< ValueType > >

## Detailed Description

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

Dense is a matrix format which explicitly stores all values of the matrix.

The values are stored in row-major format (values belonging to the same row appear consecutive in the memory). Optionally, rows can be padded for better memory access.

Template Parameters

  ValueType | precision of matrix elements

Note
  While this format is not very useful for storing sparse matrices, it is often suitable to store vectors, and sets of vectors.

## Constructor & Destructor Documentation

## ◆ Dense() [1/2]

template<typename ValueType = default_precision>

gko::matrix::Dense< ValueType >::Dense | ( | const Dense< ValueType > & |  | ) |

Copy-constructs a Dense matrix.

Inherits executor and dimensions, but copies data without padding.

## ◆ Dense() [2/2]

template<typename ValueType = default_precision>

gko::matrix::Dense< ValueType >::Dense | ( | Dense< ValueType > && |  | ) |

Move-constructs a Dense matrix.

Inherits executor, dimensions and data with padding. The moved-from object is empty (0x0 with empty Array).

## Member Function Documentation

## ◆ add_scaled()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::add_scaled | ( | ptr_param< const LinOp > | alpha,
|  | ptr_param< const LinOp > | b )

Adds b scaled by alpha to the matrix (aka: BLAS axpy).

Parameters

  alpha | If alpha is 1x1 Dense matrix, the entire matrix is scaled by alpha. If it is a Dense row vector of values, then i-th column of the matrix is scaled with the i-th element of alpha (the number of columns of alpha has to match the number of columns of the matrix).
  b | a matrix of the same dimension as this

## ◆ at() [1/4]

template<typename ValueType = default_precision>

ValueType gko::matrix::Dense< ValueType >::at | ( | size_type | idx | ) | const
| inlinenoexcept

Returns a single element of the matrix.

Useful for iterating across all elements of the matrix. However, it is less efficient than the two-parameter variant of this method.

Parameters

  idx | a linear index of the requested element (ignoring the stride)

Note
  the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

## ◆ at() [2/4]

template<typename ValueType = default_precision>

ValueType & gko::matrix::Dense< ValueType >::at | ( | size_type | idx | ) |
| inlinenoexcept

Returns a single element of the matrix.

Useful for iterating across all elements of the matrix. However, it is less efficient than the two-parameter variant of this method.

Parameters

  idx | a linear index of the requested element (ignoring the stride)

Note
  the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

## ◆ at() [3/4]

template<typename ValueType = default_precision>

value_type gko::matrix::Dense< ValueType >::at | ( | size_type | row,
|  | size_type | col ) const
| inlinenoexcept

Returns a single element of the matrix.

Parameters

  row | the row of the requested element
  col | the column of the requested element

Note
  the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

## ◆ at() [4/4]

template<typename ValueType = default_precision>

value_type & gko::matrix::Dense< ValueType >::at | ( | size_type | row,
|  | size_type | col )
| inlinenoexcept

Returns a single element of the matrix.

Parameters

  row | the row of the requested element
  col | the column of the requested element

Note
  the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

## ◆ column_permute() [1/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::column_permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the column permutation of the Permutable object.

In the resulting LinOp, the column i contains the input column perm[i].

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new column permuted object

Implements gko::Permutable< int32 >.

## ◆ column_permute() [2/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::column_permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the column-permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[1] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::column_permute(const array<int32>*)

## ◆ column_permute() [3/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::column_permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the column permutation of the Permutable object.

In the resulting LinOp, the column i contains the input column perm[i].

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new column permuted object

Implements gko::Permutable< int64 >.

## ◆ column_permute() [4/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::column_permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ compute_absolute() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< absolute_type > gko::matrix::Dense< ValueType >::compute_absolute | ( |  | ) | const
| overridevirtual

Gets the AbsoluteLinOp.

Returns
  a pointer to the new absolute object

Implements gko::EnableAbsoluteComputation< remove_complex< Dense< default_precision > > >.

## ◆ compute_absolute() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_absolute | ( | ptr_param< absolute_type > | output | ) | const

Writes the absolute values of this matrix into an existing matrix.

Parameters

  output | The output matrix. Its size must match the size of this matrix.

See also
  Dense::compute_absolute()

## ◆ compute_absolute_inplace()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_absolute_inplace | ( |  | ) |
| overridevirtual

Compute absolute inplace on each element.

Implements gko::AbsoluteComputable.

## ◆ compute_conj_dot() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_conj_dot | ( | ptr_param< const LinOp > | b,
|  | ptr_param< LinOp > | result ) const

Computes the column-wise dot product of conj(this matrix) and b.

Parameters

  b | a Dense matrix of same dimension as this
  result | a Dense row vector, used to store the dot product (the number of column in the vector must match the number of columns of this)

## ◆ compute_conj_dot() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_conj_dot | ( | ptr_param< const LinOp > | b,
|  | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the column-wise dot product of conj(this matrix) and b.

Parameters

  b | a Dense matrix of same dimension as this
  result | a Dense row vector, used to store the dot product (the number of column in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ compute_dot() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_dot | ( | ptr_param< const LinOp > | b,
|  | ptr_param< LinOp > | result ) const

Computes the column-wise dot product of this matrix and b.

Parameters

  b | a Dense matrix of same dimension as this
  result | a Dense row vector, used to store the dot product (the number of column in the vector must match the number of columns of this)

## ◆ compute_dot() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_dot | ( | ptr_param< const LinOp > | b,
|  | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the column-wise dot product of this matrix and b.

Parameters

  b | a Dense matrix of same dimension as this
  result | a Dense row vector, used to store the dot product (the number of column in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ compute_mean() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_mean | ( | ptr_param< LinOp > | result | ) | const

Computes the column-wise arithmetic mean of this matrix.

Parameters

  result | a Dense row vector, used to store the mean (the number of columns in the vector must match the number of columns of this)

## ◆ compute_mean() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_mean | ( | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the column-wise arithmetic mean of this matrix.

Parameters

  result | a Dense row vector, used to store the mean (the number of columns in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ compute_norm1() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_norm1 | ( | ptr_param< LinOp > | result | ) | const

Computes the column-wise (L^1) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)

## ◆ compute_norm1() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_norm1 | ( | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the column-wise (L^1) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ compute_norm2() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_norm2 | ( | ptr_param< LinOp > | result | ) | const

Computes the column-wise Euclidean (L^2) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)

## ◆ compute_norm2() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_norm2 | ( | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the column-wise Euclidean (L^2) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ compute_squared_norm2() [1/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_squared_norm2 | ( | ptr_param< LinOp > | result | ) | const

Computes the square of the column-wise Euclidean (L^2) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)

## ◆ compute_squared_norm2() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::compute_squared_norm2 | ( | ptr_param< LinOp > | result,
|  | array< char > & | tmp ) const

Computes the square of the column-wise Euclidean (L^2) norm of this matrix.

Parameters

  result | a Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)
  tmp | the temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

## ◆ conj_transpose() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< 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.

## ◆ conj_transpose() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::conj_transpose | ( | ptr_param< Dense< ValueType > > | output | ) | const

Writes the conjugate-transposed matrix into the given output matrix.

Parameters

  output | The output matrix. It must have the dimensions gko::transpose(this->get_size())

## ◆ create() [1/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create | ( | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size,
|  | array< value_type > | values,
|  | size_type | stride )
| static

Creates a Dense 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
  stride | stride of the rows (i.e. offset between the first elements of two consecutive rows, expressed as the number of matrix elements)

Note
  If values is 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]

template<typename ValueType = default_precision>
template<typename InputValueType>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create | ( | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size,
|  | std::initializer_list< InputValueType > | values,
|  | size_type | stride )
| inlinestatic

create(std::shared_ptr<const Executor>,const dim<2>&, array<value_type>, size_type)

create(std::shared_ptr<const Executor>,const dim<2>&, array<value_type>, size_type)

## ◆ create() [3/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create | ( | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size = {},
|  | size_type | stride = 0 )
| static

Creates an uninitialized Dense matrix of the specified size.

Parameters

  exec | Executor associated to the matrix
  size | size of the matrix
  stride | stride of the rows (i.e. offset between the first elements of two consecutive rows, expressed as the number of matrix elements). If it is set to 0, size[1] will be used instead.

Returns
  A smart pointer to the newly created matrix.

Referenced by create().

## ◆ create_const()

template<typename ValueType = default_precision>

std::unique_ptr< const Dense > gko::matrix::Dense< ValueType >::create_const | ( | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size,
|  | gko::detail::const_array_view< ValueType > && | values,
|  | size_type | stride )
| static

Creates a constant (immutable) Dense matrix from a constant array.

Parameters

  exec | the executor to create the matrix on
  size | the dimensions of the matrix
  values | the value array of the matrix
  stride | the row-stride 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.

## ◆ create_const_view_of()

template<typename ValueType = default_precision>

std::unique_ptr< const Dense > gko::matrix::Dense< ValueType >::create_const_view_of | ( | ptr_param< const Dense< ValueType > > | other | ) |
| inlinestatic

Creates a immutable Dense matrix, where the underlying array is a view of another Dense matrix' array.

Parameters

  other | The other matrix on which to create the view

Returns
  A immutable Dense matrix that is a view of other

Referenced by gko::make_const_dense_view().

## ◆ create_real_view() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< real_type > gko::matrix::Dense< ValueType >::create_real_view | ( |  | ) |

Create a real view of the (potentially) complex original matrix.

If the original matrix is real, nothing changes. If the original matrix is complex, the result is created by viewing the complex matrix with as real with a reinterpret_cast with twice the number of columns and double the stride.

## ◆ create_real_view() [2/2]

template<typename ValueType = default_precision>

std::unique_ptr< const real_type > gko::matrix::Dense< ValueType >::create_real_view | ( |  | ) | const

Create a real view of the (potentially) complex original matrix.

If the original matrix is real, nothing changes. If the original matrix is complex, the result is created by viewing the complex matrix with as real with a reinterpret_cast with twice the number of columns and double the stride.

## ◆ create_submatrix() [1/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_submatrix | ( | const local_span & | rows,
|  | const local_span & | columns,
|  | dim< 2 > | size )
| inline

Create a submatrix from the original matrix.

Parameters

  rows | row span
  columns | column span
  size | size of the submatrix (only used for consistency with distributed::Vector)

## ◆ create_submatrix() [2/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_submatrix | ( | const span & | rows,
|  | const span & | columns )
| inline

Create a submatrix from the original matrix.

Parameters

  rows | row span
  columns | column span

## ◆ create_submatrix() [3/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_submatrix | ( | const span & | rows,
|  | const span & | columns,
|  | const size_type | stride )
| inline

Create a submatrix from the original matrix.

Warning: defining stride for this create_submatrix method might cause wrong memory access. Better use the create_submatrix(rows, columns) method instead.

Parameters

  rows | row span
  columns | column span
  stride | stride of the new submatrix.

Referenced by create_submatrix(), and create_submatrix().

## ◆ create_view_of()

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_view_of | ( | ptr_param< Dense< ValueType > > | other | ) |
| inlinestatic

Creates a Dense matrix, where the underlying array is a view of another Dense matrix' array.

Parameters

  other | The other matrix on which to create the view

Returns
  A Dense matrix that is a view of other

Referenced by gko::make_dense_view().

## ◆ create_with_config_of()

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_with_config_of | ( | ptr_param< const Dense< ValueType > > | other | ) |
| inlinestatic

Creates a Dense matrix with the same size and stride as another Dense matrix.

Parameters

  other | The other matrix whose configuration needs to copied.

## ◆ create_with_type_of() [1/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_with_type_of | ( | ptr_param< const Dense< ValueType > > | other,
|  | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size,
|  | const dim< 2 > & | local_size,
|  | size_type | stride )
| inlinestatic

Parameters

  local_size | Unused
  stride | The stride of the new matrix.

Note
  This is an overload to stay consistent with gko::experimental::distributed::Vector

## ◆ create_with_type_of() [2/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_with_type_of | ( | ptr_param< const Dense< ValueType > > | other,
|  | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size,
|  | size_type | stride )
| inlinestatic

Parameters

  stride | The stride of the new matrix.

Note
  This is an overload which allows full parameter specification.

## ◆ create_with_type_of() [3/3]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::create_with_type_of | ( | ptr_param< const Dense< ValueType > > | other,
|  | std::shared_ptr< const Executor > | exec,
|  | const dim< 2 > & | size = dim<2>{} )
| inlinestatic

Creates a Dense matrix with the same type as another Dense matrix but on a different executor and with a different size.

Parameters

  other | The other matrix whose type we target.
  exec | The executor of the new matrix.
  size | The size of the new matrix.
  stride | The stride of the new matrix.

Returns
  a Dense matrix with the type of other.

## ◆ extract_diagonal() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< Diagonal< ValueType > > gko::matrix::Dense< ValueType >::extract_diagonal | ( |  | ) | const
| overridevirtual

Extracts the diagonal entries of the matrix into a vector.

Parameters

  diag | the vector into which the diagonal will be written

Implements gko::DiagonalExtractable< default_precision >.

## ◆ extract_diagonal() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::extract_diagonal | ( | ptr_param< Diagonal< ValueType > > | output | ) | const

Writes the diagonal of this matrix into an existing diagonal matrix.

Parameters

  output | The output matrix. Its size must match the size of this matrix's diagonal.

See also
  Dense::extract_diagonal()

## ◆ fill()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::fill | ( | const ValueType | value | ) |

Fill the dense matrix with a given value.

Parameters

  value | the value to be filled

## ◆ get_const_values()

template<typename ValueType = default_precision>

const value_type * gko::matrix::Dense< 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.

## ◆ get_num_stored_elements()

template<typename ValueType = default_precision>

size_type gko::matrix::Dense< ValueType >::get_num_stored_elements | ( |  | ) | const
| inlinenoexcept

Returns the number of elements explicitly stored in the matrix.

Returns
  the number of elements explicitly stored in the matrix

## ◆ get_stride()

template<typename ValueType = default_precision>

size_type gko::matrix::Dense< ValueType >::get_stride | ( |  | ) | const
| inlinenoexcept

Returns the stride of the matrix.

Returns
  the stride of the matrix.

Referenced by create_submatrix(), and create_submatrix().

## ◆ get_values()

template<typename ValueType = default_precision>

value_type * gko::matrix::Dense< ValueType >::get_values | ( |  | ) |
| inlinenoexcept

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

Returns
  the pointer to the array of values

## ◆ inv_scale()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inv_scale | ( | ptr_param< const LinOp > | alpha | ) |

Scales the matrix with the inverse of a scalar.

Parameters

  alpha | If alpha is 1x1 Dense matrix, the entire matrix is scaled by 1 / alpha. If it is a Dense row vector of values, then i-th column of the matrix is scaled with the inverse of the i-th element of alpha (the number of columns of alpha has to match the number of columns of the matrix).

## ◆ inverse_column_permute() [1/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_column_permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the inverse permuted object.

In the resulting LinOp, the column perm[i] contains the input column i.

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new inverse permuted object

Implements gko::Permutable< int32 >.

## ◆ inverse_column_permute() [2/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_column_permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the inverse column-permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[1] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::inverse_column_permute(const array<int32>*)

## ◆ inverse_column_permute() [3/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_column_permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the inverse permuted object.

In the resulting LinOp, the column perm[i] contains the input column i.

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new inverse permuted object

Implements gko::Permutable< int64 >.

## ◆ inverse_column_permute() [4/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_column_permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ inverse_permute() [1/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the symmetric inverse row and column permutation of the Permutable object.

In the resulting LinOp, the entry at location (perm[i],perm[j]) contains the input value (i,j).

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Reimplemented from gko::Permutable< int32 >.

## ◆ inverse_permute() [2/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the inverse symmetrically permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[0] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::inverse_permute(const array<int32>*)

## ◆ inverse_permute() [3/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the symmetric inverse row and column permutation of the Permutable object.

In the resulting LinOp, the entry at location (perm[i],perm[j]) contains the input value (i,j).

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Reimplemented from gko::Permutable< int64 >.

## ◆ inverse_permute() [4/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ inverse_row_permute() [1/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_row_permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the inverse permuted object.

In the resulting LinOp, the row perm[i] contains the input row i.

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new inverse permuted object

Implements gko::Permutable< int32 >.

## ◆ inverse_row_permute() [2/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_row_permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the inverse row-permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[0] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::inverse_row_permute(const array<int32>*)

## ◆ inverse_row_permute() [3/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::inverse_row_permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the inverse permuted object.

In the resulting LinOp, the row perm[i] contains the input row i.

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order perm.

Returns
  a pointer to the new inverse permuted object

Implements gko::Permutable< int64 >.

## ◆ inverse_row_permute() [4/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::inverse_row_permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ make_complex() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< complex_type > gko::matrix::Dense< ValueType >::make_complex | ( |  | ) | const

Creates a complex copy of the original matrix.

If the original matrix was real, the imaginary part of the result will be zero.

## ◆ make_complex() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::make_complex | ( | ptr_param< complex_type > | result | ) | const

Writes a complex copy of the original matrix to a given complex matrix.

If the original matrix was real, the imaginary part of the result will be zero.

## ◆ operator=() [1/2]

template<typename ValueType = default_precision>

Dense & gko::matrix::Dense< ValueType >::operator= | ( | const Dense< ValueType > & |  | ) |

Copy-assigns a Dense matrix.

Preserves the executor, reallocates the matrix with minimal stride if the dimensions don't match, then copies the data over, ignoring padding.

## ◆ operator=() [2/2]

template<typename ValueType = default_precision>

Dense & gko::matrix::Dense< ValueType >::operator= | ( | Dense< ValueType > && |  | ) |

Move-assigns a Dense matrix.

Preserves the executor, moves the data over preserving size and stride. Leaves the moved-from object in an empty state (0x0 with empty Array).

## ◆ permute() [1/12]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the symmetric row and column permutation of the Permutable object.

In the resulting LinOp, the entry at location (i,j) contains the input value (perm[i],perm[j]).

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Reimplemented from gko::Permutable< int32 >.

## ◆ permute() [2/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the symmetrically permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[0] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::permute(const array<int32>*)

## ◆ permute() [3/12]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the symmetric row and column permutation of the Permutable object.

In the resulting LinOp, the entry at location (i,j) contains the input value (perm[i],perm[j]).

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Reimplemented from gko::Permutable< int64 >.

## ◆ permute() [4/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ permute() [5/12]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int32 > > | permutation,
|  | permute_mode | mode = permute_mode::symmetric ) const

Creates a permuted copy of this matrix with the given permutation .

By default, this computes a symmetric permutation (permute_mode::symmetric). For the effect of the different permutation modes, see permute_mode.

Parameters

  permutation | The input permutation.
  mode | The permutation mode. If permute_mode::inverse is set, we use the inverse permutation instead of . If permute_mode::rows is set, the rows will be permuted. If permute_mode::columns is set, the columns will be permuted.

Returns
  The permuted matrix.

## ◆ permute() [6/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int32 > > | permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | permute_mode | mode ) const

Overload of permute(ptr_param<const Permutation<int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.

Parameters

  output | the output matrix.

## ◆ permute() [7/12]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int32 > > | row_permutation,
|  | ptr_param< const Permutation< int32 > > | column_permutation,
|  | bool | invert = false ) const

Creates a non-symmetrically permuted copy of this matrix with the given row and column permutations and .

The operation will compute , or if invert is false, and , or if invert is true.

Parameters

  row_permutation | The permutation to apply to the rows
  column_permutation | The permutation to apply to the columns
  invert | If set to false, uses the input permutations, otherwise uses their inverses

Returns
  The permuted matrix.

## ◆ permute() [8/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int32 > > | row_permutation,
|  | ptr_param< const Permutation< int32 > > | column_permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | bool | invert = false ) const

Overload of permute(ptr_param<const Permutation<int32>>, ptr_param<const Permutation<int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.

Parameters

  output | the output matrix.

## ◆ permute() [9/12]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int64 > > | permutation,
|  | permute_mode | mode = permute_mode::symmetric ) const

## ◆ permute() [10/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int64 > > | permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | permute_mode | mode ) const

## ◆ permute() [11/12]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int64 > > | row_permutation,
|  | ptr_param< const Permutation< int64 > > | column_permutation,
|  | bool | invert = false ) const

## ◆ permute() [12/12]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::permute | ( | ptr_param< const Permutation< int64 > > | row_permutation,
|  | ptr_param< const Permutation< int64 > > | column_permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | bool | invert = false ) const

## ◆ row_gather() [1/6]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::row_gather | ( | const array< int32 > * | gather_indices | ) | const

Create a Dense matrix consisting of the given rows from this matrix.

Parameters

  gather_indices | pointer to an array containing row indices from this matrix. It may contain duplicates.

Returns
  Dense matrix on the same executor with the same number of columns and gather_indices->get_size() rows containing the gathered rows from this matrix: output(i,j) = input(gather_indices(i), j)

## ◆ row_gather() [2/6]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_gather | ( | const array< int32 > * | gather_indices,
|  | ptr_param< LinOp > | row_collection ) const

Copies the given rows from this matrix into row_collection.

Parameters

  gather_indices | pointer to an array containing row indices from this matrix. It may contain duplicates.
  row_collection | pointer to a LinOp that will store the gathered rows: row_collection(i,j) = input(gather_indices(i), j) It must have the same number of columns as this matrix and gather_indices->get_size() rows.

## ◆ row_gather() [3/6]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::row_gather | ( | const array< int64 > * | gather_indices | ) | const

Create a Dense matrix consisting of the given rows from this matrix.

Parameters

  gather_indices | pointer to an array containing row indices from this matrix. It may contain duplicates.

Returns
  Dense matrix on the same executor with the same number of columns and gather_indices->get_size() rows containing the gathered rows from this matrix: output(i,j) = input(gather_indices(i), j)

## ◆ row_gather() [4/6]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_gather | ( | const array< int64 > * | gather_indices,
|  | ptr_param< LinOp > | row_collection ) const

## ◆ row_gather() [5/6]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_gather | ( | ptr_param< const LinOp > | alpha,
|  | const array< int32 > * | gather_indices,
|  | ptr_param< const LinOp > | beta,
|  | ptr_param< LinOp > | row_collection ) const

Copies the given rows from this matrix into row_collection with scaling.

Parameters

  alpha | scaling the result of row gathering
  gather_indices | pointer to an array containing row indices from this matrix. It may contain duplicates.
  beta | scaling the input row_collection
  row_collection | pointer to a LinOp that will store the gathered rows: row_collection(i,j) = input(gather_indices(i), j) It must have the same number of columns as this matrix and gather_indices->get_size() rows.

## ◆ row_gather() [6/6]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_gather | ( | ptr_param< const LinOp > | alpha,
|  | const array< int64 > * | gather_indices,
|  | ptr_param< const LinOp > | beta,
|  | ptr_param< LinOp > | row_collection ) const

## ◆ row_permute() [1/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::row_permute | ( | const array< int32 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the Permutable object.

In the resulting LinOp, the row i contains the input row perm[i].

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Implements gko::Permutable< int32 >.

## ◆ row_permute() [2/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_permute | ( | const array< int32 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

Writes the row-permuted matrix into the given output matrix.

Parameters

  permutation_indices | The array containing permutation indices. It must have this->get_size()[0] elements.
  output | The output matrix. It must have the dimensions this->get_size()

See also
  Dense::row_permute(const array<int32>*)

## ◆ row_permute() [3/4]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< ValueType >::row_permute | ( | const array< int64 > * | permutation_indices | ) | const
| overridevirtual

Returns a LinOp representing the row permutation of the Permutable object.

In the resulting LinOp, the row i contains the input row perm[i].

From the linear algebra perspective, with , this represents the operation .

Parameters

  permutation_indices | the array of indices containing the permutation order.

Returns
  a pointer to the new permuted object

Implements gko::Permutable< int64 >.

## ◆ row_permute() [4/4]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::row_permute | ( | const array< int64 > * | permutation_indices,
|  | ptr_param< Dense< ValueType > > | output ) const

## ◆ scale()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::scale | ( | ptr_param< const LinOp > | alpha | ) |

Scales the matrix with a scalar (aka: BLAS scal).

Parameters

  alpha | If alpha is 1x1 Dense matrix, the entire matrix is scaled by alpha. If it is a Dense row vector of values, then i-th column of the matrix is scaled with the i-th element of alpha (the number of columns of alpha has to match the number of columns of the matrix).

## ◆ scale_permute() [1/8]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int32 > > | permutation,
|  | permute_mode | mode = permute_mode::symmetric ) const

Creates a scaled and permuted copy of this matrix.

For an explanation of the permutation modes, see permute(ptr_param<const Permutation<index_type>>, permute_mode)

Parameters

  permutation | The scaled permutation.
  mode | The permutation mode.

Returns
  The permuted matrix.

## ◆ scale_permute() [2/8]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int32 > > | permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | permute_mode | mode ) const

Overload of scale_permute(ptr_param<const ScaledPermutation<value_type, int32>>, permute_mode) that writes the permuted copy into an existing Dense matrix.

Parameters

  output | the output matrix.

## ◆ scale_permute() [3/8]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int32 > > | row_permutation,
|  | ptr_param< const ScaledPermutation< value_type, int32 > > | column_permutation,
|  | bool | invert = false ) const

Creates a scaled and permuted copy of this matrix.

For an explanation of the parameters, see permute(ptr_param<const Permutation<index_type>>, ptr_param<const Permutation<index_type>>, permute_mode)

Parameters

  row_permutation | The scaled row permutation.
  column_permutation | The scaled column permutation.
  invert | If set to false, uses the input permutations, otherwise uses their inverses

Returns
  The permuted matrix.

## ◆ scale_permute() [4/8]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int32 > > | row_permutation,
|  | ptr_param< const ScaledPermutation< value_type, int32 > > | column_permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | bool | invert = false ) const

Overload of scale_permute(ptr_param<const ScaledPermutation<value_type, int32>>, ptr_param<const ScaledPermutation<value_type, int32>>, bool) that writes the permuted copy into an existing Dense matrix.

Parameters

  output | the output matrix.

## ◆ scale_permute() [5/8]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int64 > > | permutation,
|  | permute_mode | mode = permute_mode::symmetric ) const

## ◆ scale_permute() [6/8]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int64 > > | permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | permute_mode | mode ) const

## ◆ scale_permute() [7/8]

template<typename ValueType = default_precision>

std::unique_ptr< Dense > gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int64 > > | row_permutation,
|  | ptr_param< const ScaledPermutation< value_type, int64 > > | column_permutation,
|  | bool | invert = false ) const

## ◆ scale_permute() [8/8]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::scale_permute | ( | ptr_param< const ScaledPermutation< value_type, int64 > > | row_permutation,
|  | ptr_param< const ScaledPermutation< value_type, int64 > > | column_permutation,
|  | ptr_param< Dense< ValueType > > | output,
|  | bool | invert = false ) const

## ◆ sub_scaled()

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::sub_scaled | ( | ptr_param< const LinOp > | alpha,
|  | ptr_param< const LinOp > | b )

Subtracts b scaled by alpha from the matrix (aka: BLAS axpy).

Parameters

  alpha | If alpha is 1x1 Dense matrix, b is scaled by alpha. If it is a Dense row vector of values, then i-th column of b is scaled with the i-th element of alpha (the number of columns of alpha has to match the number of columns of the matrix).
  b | a matrix of the same dimension as this

## ◆ transpose() [1/2]

template<typename ValueType = default_precision>

std::unique_ptr< LinOp > gko::matrix::Dense< 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.

## ◆ transpose() [2/2]

template<typename ValueType = default_precision>

void gko::matrix::Dense< ValueType >::transpose | ( | ptr_param< Dense< ValueType > > | output | ) | const

Writes the transposed matrix into the given output matrix.

Parameters

  output | The output matrix. It must have the dimensions gko::transpose(this->get_size())

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

- ginkgo/core/base/dense_cache.hpp
- ginkgo/core/matrix/dense.hpp