33#ifndef GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
34#define GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
37#include <initializer_list>
41#include <ginkgo/core/base/array.hpp>
42#include <ginkgo/core/base/exception_helpers.hpp>
43#include <ginkgo/core/base/executor.hpp>
44#include <ginkgo/core/base/lin_op.hpp>
45#include <ginkgo/core/base/range_accessors.hpp>
46#include <ginkgo/core/base/types.hpp>
47#include <ginkgo/core/base/utils.hpp>
48#include <ginkgo/core/matrix/permutation.hpp>
49#include <ginkgo/core/matrix/scaled_permutation.hpp>
53namespace experimental {
54namespace distributed {
57template <
typename ValueType>
68template <
typename ValueType,
typename IndexType>
71template <
typename ValueType,
typename IndexType>
74template <
typename ValueType>
77template <
typename ValueType,
typename IndexType>
80template <
typename ValueType,
typename IndexType>
83template <
typename ValueType,
typename IndexType>
86template <
typename ValueType,
typename IndexType>
89template <
typename ValueType,
typename IndexType>
108template <
typename ValueType = default_precision>
193 using value_type = ValueType;
194 using index_type =
int64;
201 using real_type = absolute_type;
219 return (*other).create_with_same_config();
238 return (*other).create_with_type_of_impl(exec, size, size[1]);
254 return (*other).create_with_type_of_impl(exec, size, stride);
272 return (*other).create_with_type_of_impl(exec, size, stride);
285 return other->create_view_of_impl();
298 return other->create_const_view_of_impl();
363 void read(
const mat_data& data)
override;
365 void read(
const mat_data32& data)
override;
367 void read(
const device_mat_data& data)
override;
369 void read(
const device_mat_data32& data)
override;
371 void read(device_mat_data&& data)
override;
373 void read(device_mat_data32&& data)
override;
375 void write(mat_data& data)
const override;
377 void write(mat_data32& data)
const override;
404 void fill(
const ValueType value);
462 bool invert =
false)
const;
471 bool invert =
false)
const;
546 bool invert =
false)
const;
556 bool invert =
false)
const;
899 return values_.
get_data()[linearize_index(row, col)];
1132 return this->create_submatrix_impl(
rows,
columns, stride);
1173 std::shared_ptr<const Executor> exec,
const dim<2>& size,
1174 gko::detail::const_array_view<ValueType>&& values,
size_type stride)
1178 return std::unique_ptr<const Dense>(
new Dense{
1179 exec, size, gko::detail::array_const_cast(std::move(values)),
1229 Dense(std::shared_ptr<const Executor> exec,
const dim<2>& size,
1232 values_(exec, size[0] * stride),
1252 template <
typename ValuesArray>
1253 Dense(std::shared_ptr<const Executor> exec,
const dim<2>& size,
1255 : EnableLinOp<
Dense>(exec, size),
1259 if (size[0] > 0 && size[1] > 0) {
1260 GKO_ENSURE_IN_BOUNDS((size[0] - 1) * stride + size[1] - 1,
1271 virtual std::unique_ptr<Dense> create_with_same_config()
const
1273 return Dense::create(this->
get_executor(), this->get_size(),
1284 virtual std::unique_ptr<Dense> create_with_type_of_impl(
1285 std::shared_ptr<const Executor> exec,
const dim<2>& size,
1288 return Dense::create(exec, size, stride);
1297 virtual std::unique_ptr<Dense> create_view_of_impl()
1300 return Dense::create(
1301 exec, this->get_size(),
1313 virtual std::unique_ptr<const Dense> create_const_view_of_impl()
const
1317 exec, this->get_size(),
1323 template <
typename IndexType>
1324 void convert_impl(Coo<ValueType, IndexType>*
result)
const;
1326 template <
typename IndexType>
1327 void convert_impl(Csr<ValueType, IndexType>*
result)
const;
1329 template <
typename IndexType>
1330 void convert_impl(Ell<ValueType, IndexType>*
result)
const;
1332 template <
typename IndexType>
1333 void convert_impl(Fbcsr<ValueType, IndexType>*
result)
const;
1335 template <
typename IndexType>
1336 void convert_impl(Hybrid<ValueType, IndexType>*
result)
const;
1338 template <
typename IndexType>
1339 void convert_impl(Sellp<ValueType, IndexType>*
result)
const;
1341 template <
typename IndexType>
1342 void convert_impl(SparsityCsr<ValueType, IndexType>*
result)
const;
1350 virtual void scale_impl(
const LinOp* alpha);
1358 virtual void inv_scale_impl(
const LinOp* alpha);
1366 virtual void add_scaled_impl(
const LinOp* alpha,
const LinOp* b);
1374 virtual void sub_scaled_impl(
const LinOp* alpha,
const LinOp* b);
1382 virtual void compute_dot_impl(
const LinOp* b, LinOp*
result)
const;
1390 virtual void compute_conj_dot_impl(
const LinOp* b, LinOp*
result)
const;
1398 virtual void compute_norm2_impl(LinOp*
result)
const;
1406 virtual void compute_norm1_impl(LinOp*
result)
const;
1414 virtual void compute_squared_norm2_impl(LinOp*
result)
const;
1419 virtual void compute_mean_impl(LinOp*
result)
const;
1438 virtual std::unique_ptr<Dense> create_submatrix_impl(
1441 void apply_impl(
const LinOp* b, LinOp* x)
const override;
1443 void apply_impl(
const LinOp* alpha,
const LinOp* b,
const LinOp* beta,
1444 LinOp* x)
const override;
1448 return row * stride_ + col;
1453 return linearize_index(
idx / this->get_size()[1],
1454 idx % this->get_size()[1]);
1457 template <
typename IndexType>
1461 template <
typename IndexType>
1466 template <
typename IndexType>
1467 void scale_permute_impl(
1471 template <
typename IndexType>
1472 void scale_permute_impl(
1477 template <
typename OutputType,
typename IndexType>
1478 void row_gather_impl(
const array<IndexType>* row_idxs,
1481 template <
typename OutputType,
typename IndexType>
1482 void row_gather_impl(
const Dense<ValueType>* alpha,
1483 const array<IndexType>* row_idxs,
1484 const Dense<ValueType>* beta,
1488 array<value_type> values_;
1491 void add_scaled_identity_impl(
const LinOp*
a,
const LinOp* b)
override;
1501template <
typename ValueType>
1502struct temporary_clone_helper<matrix::Dense<ValueType>> {
1503 static std::unique_ptr<matrix::Dense<ValueType>> create(
1504 std::shared_ptr<const Executor> exec, matrix::Dense<ValueType>* ptr,
1510 return matrix::Dense<ValueType>::create(exec, ptr->get_size());
1526template <
typename VecPtr>
1527std::unique_ptr<matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1530 using value_type =
typename detail::pointee<VecPtr>::value_type;
1542template <
typename VecPtr>
1544 const matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1547 using value_type =
typename detail::pointee<VecPtr>::value_type;
1572template <
typename Matrix,
typename...
TArgs>
1574 size_type stride, std::initializer_list<typename Matrix::value_type>
vals,
1575 std::shared_ptr<const Executor> exec,
TArgs&&... create_args)
1579 auto tmp = dense::create(exec->get_master(),
dim<2>{num_rows, 1}, stride);
1585 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1610template <
typename Matrix,
typename...
TArgs>
1612 std::initializer_list<typename Matrix::value_type>
vals,
1613 std::shared_ptr<const Executor> exec,
TArgs&&... create_args)
1616 std::forward<TArgs>(create_args)...);
1640template <
typename Matrix,
typename...
TArgs>
1643 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1645 std::shared_ptr<const Executor> exec,
TArgs&&... create_args)
1651 dense::create(exec->get_master(),
dim<2>{num_rows, num_cols}, stride);
1653 for (
const auto& row :
vals) {
1655 for (
const auto&
elem : row) {
1661 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1688template <
typename Matrix,
typename...
TArgs>
1690 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1692 std::shared_ptr<const Executor> exec,
TArgs&&... create_args)
1696 std::forward<TArgs>(create_args)...);
ConvertibleTo interface is used to mark that the implementer can be converted to the object of Result...
Definition polymorphic_object.hpp:499
The EnableAbsoluteComputation mixin provides the default implementations of compute_absolute_linop an...
Definition lin_op.hpp:823
This mixin implements a static create() method on ConcreteType that dynamically allocates the memory,...
Definition polymorphic_object.hpp:776
The EnableLinOp mixin can be used to provide sensible default implementations of the majority of the ...
Definition lin_op.hpp:908
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
Definition lin_op.hpp:146
Linear operators which support permutation should implement the Permutable interface.
Definition lin_op.hpp:513
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition polymorphic_object.hpp:263
A LinOp implementing this interface can read its data from a matrix_data structure.
Definition lin_op.hpp:634
Adds the operation M <- a I + b M for matrix M, identity operator I and scalars a and b,...
Definition lin_op.hpp:847
Linear operators which support transposition should implement the Transposable interface.
Definition lin_op.hpp:462
A LinOp implementing this interface can write its data to a matrix_data structure.
Definition lin_op.hpp:689
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:187
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition array.hpp:646
const value_type * get_const_data() const noexcept
Returns a constant pointer to the block of memory used to store the elements of the array.
Definition array.hpp:655
size_type get_num_elems() const noexcept
Returns the number of elements in the array.
Definition array.hpp:637
This type is a device-side equivalent to matrix_data.
Definition device_matrix_data.hpp:63
Vector is a format which explicitly stores (multiple) distributed column vectors in a dense storage f...
Definition vector.hpp:92
COO stores a matrix in the coordinate matrix format.
Definition coo.hpp:87
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition csr.hpp:146
Dense is a matrix format which explicitly stores all values of the matrix.
Definition dense.hpp:136
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
value_type & at(size_type row, size_type col) noexcept
Returns a single element of the matrix.
Definition dense.hpp:897
void compute_norm1(ptr_param< LinOp > result) const
Computes the column-wise (L^1) norm of this matrix.
void compute_absolute(ptr_param< absolute_type > output) const
Writes the absolute values of this matrix into an existing matrix.
void compute_norm2(ptr_param< LinOp > result, array< char > &tmp) const
Computes the column-wise Euclidean (L^2) norm of this matrix.
std::unique_ptr< LinOp > row_permute(const array< int64 > *permutation_indices) const override
Returns a LinOp representing the row permutation of the Permutable object.
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.
Definition dense.hpp:212
std::unique_ptr< Dense > permute(ptr_param< const Permutation< int64 > > row_permutation, ptr_param< const Permutation< int64 > > column_permutation, bool invert=false) const
Dense & operator=(const Dense &)
Copy-assigns a Dense matrix.
void get_imag(ptr_param< real_type > result) const
Extracts the imaginary part of the original matrix into a given real matrix.
void row_permute(const array< int32 > *permutation_indices, ptr_param< Dense > output) const
Writes the row-permuted matrix into the given output matrix.
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< LinOp > column_permute(const array< int64 > *permutation_indices) const override
Returns a LinOp representing the column permutation of the Permutable object.
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)
Definition dense.hpp:267
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 sub_scaled(ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
Subtracts b scaled by alpha from the matrix (aka: BLAS axpy).
std::unique_ptr< Dense > permute(ptr_param< const Permutation< int64 > > permutation, permute_mode mode=permute_mode::symmetric) const
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.
ValueType at(size_type idx) const noexcept
Returns a single element of the matrix.
Definition dense.hpp:932
std::unique_ptr< Dense > row_gather(const array< int64 > *gather_indices) const
Create a Dense matrix consisting of the given rows from this matrix.
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 objec...
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...
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 column_permute(const array< int32 > *permutation_indices, ptr_param< Dense > output) const
Writes the column-permuted matrix into the given output matrix.
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.
Dense(const Dense &)
Copy-constructs a Dense matrix.
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 .
void inverse_permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) const
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.
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 wit...
Definition dense.hpp:233
void permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) const
void scale(ptr_param< const LinOp > alpha)
Scales the matrix with a scalar (aka: BLAS scal).
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.
void conj_transpose(ptr_param< Dense > output) const
Writes the conjugate-transposed matrix into the given output matrix.
std::unique_ptr< Dense > create_submatrix(const span &rows, const span &columns)
Create a submatrix from the original matrix.
Definition dense.hpp:1141
void row_permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) 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< Dense > create_submatrix(const span &rows, const span &columns, const size_type stride)
Create a submatrix from the original matrix.
Definition dense.hpp:1128
void compute_squared_norm2(ptr_param< LinOp > result) const
Computes the square of the column-wise Euclidean (L^2) norm of this matrix.
std::unique_ptr< LinOp > row_permute(const array< int32 > *permutation_indices) const override
Returns a LinOp representing the row permutation of the Permutable object.
void permute(ptr_param< const Permutation< int64 > > permutation, ptr_param< Dense > output, permute_mode mode) const
void inverse_permute(const array< int32 > *permutation_indices, ptr_param< Dense > output) const
Writes the inverse symmetrically permuted matrix into the given output matrix.
std::unique_ptr< Dense > row_gather(const array< int32 > *gather_indices) const
Create a Dense matrix consisting of the given rows from this matrix.
void extract_diagonal(ptr_param< Diagonal< ValueType > > output) const
Writes the diagonal of this matrix into an existing diagonal 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< absolute_type > compute_absolute() const override
Gets the AbsoluteLinOp.
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 Scal...
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 ...
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.
const value_type * get_const_values() const noexcept
Returns a pointer to the array of values of the matrix.
Definition dense.hpp:865
size_type get_num_stored_elements() const noexcept
Returns the number of elements explicitly stored in the matrix.
Definition dense.hpp:882
void compute_mean(ptr_param< LinOp > result, array< char > &tmp) const
Computes the column-wise arithmetic mean of this matrix.
ValueType & at(size_type idx) noexcept
Returns a single element of the matrix.
Definition dense.hpp:924
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.
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
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_mean(ptr_param< LinOp > result) const
Computes the column-wise arithmetic mean of this matrix.
size_type get_stride() const noexcept
Returns the stride of the matrix.
Definition dense.hpp:875
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 objec...
void permute(const array< int32 > *permutation_indices, ptr_param< Dense > output) const
Writes the symmetrically permuted matrix into the given output matrix.
void scale_permute(ptr_param< const ScaledPermutation< value_type, int64 > > permutation, ptr_param< Dense > output, permute_mode mode) const
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_column_permute(const array< int32 > *permutation_indices, ptr_param< Dense > output) const
Writes the inverse column-permuted matrix into the given output matrix.
void add_scaled(ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
Adds b scaled by alpha to the matrix (aka: BLAS axpy).
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.
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.
Definition dense.hpp:283
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>>,...
void compute_norm1(ptr_param< LinOp > result, array< char > &tmp) const
Computes the column-wise (L^1) norm of this matrix.
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.
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.
void transpose(ptr_param< Dense > output) const
Writes the transposed matrix into the given output matrix.
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.
std::unique_ptr< real_type > get_real() const
Creates a new real matrix and extracts the real part of the original matrix into that.
std::unique_ptr< Dense > scale_permute(ptr_param< const ScaledPermutation< value_type, int64 > > permutation, permute_mode mode=permute_mode::symmetric) const
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...
Definition dense.hpp:295
std::unique_ptr< LinOp > conj_transpose() const override
Returns a LinOp representing the conjugate transpose of the Transposable object.
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 > transpose() const override
Returns a LinOp representing the transpose of the Transposable object.
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 w...
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.
std::unique_ptr< const real_type > create_real_view() const
Create a real view of the (potentially) complex original matrix.
void column_permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) const
Dense(Dense &&)
Move-constructs a Dense matrix.
void inverse_row_permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) const
value_type at(size_type row, size_type col) const noexcept
Returns a single element of the matrix.
Definition dense.hpp:905
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.
Definition dense.hpp:1172
void permute(ptr_param< const Permutation< int64 > > row_permutation, ptr_param< const Permutation< int64 > > column_permutation, ptr_param< Dense > output, bool invert=false) const
void inv_scale(ptr_param< const LinOp > alpha)
Scales the matrix with the inverse of a scalar.
Dense & operator=(Dense &&)
Move-assigns a Dense matrix.
value_type * get_values() noexcept
Returns a pointer to the array of values of the matrix.
Definition dense.hpp:856
void inverse_column_permute(const array< int64 > *permutation_indices, ptr_param< Dense > output) const
void compute_norm2(ptr_param< LinOp > result) const
Computes the column-wise Euclidean (L^2) norm of this matrix.
void row_gather(const array< int64 > *gather_indices, ptr_param< LinOp > row_collection) const
std::unique_ptr< real_type > get_imag() const
Creates a new real matrix and extracts the imaginary part of the original matrix into that.
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)
Definition dense.hpp:249
std::unique_ptr< real_type > create_real_view()
Create a real view of the (potentially) complex original matrix.
std::unique_ptr< Diagonal< ValueType > > extract_diagonal() const override
Extracts the diagonal entries of the matrix into a vector.
void fill(const ValueType value)
Fill the dense matrix with a given value.
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 row_gather(ptr_param< const LinOp > alpha, const array< int64 > *gather_indices, ptr_param< const LinOp > beta, ptr_param< LinOp > row_collection) const
This class is a utility which efficiently implements the diagonal matrix (a linear operator which sca...
Definition diagonal.hpp:79
ELL is a matrix format where stride with explicit zeros is used such that all rows have the same numb...
Definition ell.hpp:89
Fixed-block compressed sparse row storage matrix format.
Definition fbcsr.hpp:138
HYBRID is a matrix format which splits the matrix into ELLPACK and COO format.
Definition hybrid.hpp:81
Permutation is a matrix format that represents a permutation matrix, i.e.
Definition permutation.hpp:142
ScaledPermutation is a matrix combining a permutation with scaling factors.
Definition scaled_permutation.hpp:67
SELL-P is a matrix format similar to ELL format.
Definition sellp.hpp:80
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition sparsity_csr.hpp:87
This class is used for function parameters in the place of raw pointers.
Definition utils_helper.hpp:71
A range is a multidimensional view of the memory.
Definition range.hpp:326
std::unique_ptr< Matrix > initialize(size_type stride, std::initializer_list< typename Matrix::value_type > vals, std::shared_ptr< const Executor > exec, TArgs &&... create_args)
Creates and initializes a column-vector.
Definition dense.hpp:1573
permute_mode
Specifies how a permutation will be applied to a matrix.
Definition permutation.hpp:71
@ columns
The columns will be permuted.
@ rows
The rows will be permuted.
@ symmetric
The rows and columns will be permuted.
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition math.hpp:354
std::int32_t int32
32-bit signed integral type.
Definition types.hpp:137
std::unique_ptr< const matrix::Dense< typename detail::pointee< VecPtr >::value_type > > make_const_dense_view(VecPtr &&vector)
Creates a view of a given Dense vector.
Definition dense.hpp:1545
typename detail::next_precision_impl< T >::type next_precision
Obtains the next type in the singly-linked precision list.
Definition math.hpp:490
typename detail::to_complex_s< T >::type to_complex
Obtain the type which adds the complex of complex/scalar type or the template parameter of class by a...
Definition math.hpp:373
detail::const_array_view< ValueType > make_const_array_view(std::shared_ptr< const Executor > exec, size_type size, const ValueType *data)
Helper function to create a const array view deducing the value type.
Definition array.hpp:779
std::unique_ptr< matrix::Dense< typename detail::pointee< VecPtr >::value_type > > make_dense_view(VecPtr &&vector)
Creates a view of a given Dense vector.
Definition dense.hpp:1528
array< ValueType > make_array_view(std::shared_ptr< const Executor > exec, size_type size, ValueType *data)
Helper function to create an array view deducing the value type.
Definition array.hpp:760
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:143
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:120
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition utils_helper.hpp:203
A type representing the dimensions of a multidimensional object.
Definition dim.hpp:55
This structure is used as an intermediate data type to store a sparse matrix.
Definition matrix_data.hpp:155
A span is a lightweight structure used to create sub-ranges from other ranges.
Definition range.hpp:75