 |
Ginkgo
Generated from pipelines/2662685947 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
6 #define GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
9 #include <initializer_list>
10 #include <type_traits>
12 #include <ginkgo/core/base/array.hpp>
13 #include <ginkgo/core/base/exception_helpers.hpp>
14 #include <ginkgo/core/base/executor.hpp>
15 #include <ginkgo/core/base/lin_op.hpp>
16 #include <ginkgo/core/base/range_accessors.hpp>
17 #include <ginkgo/core/base/types.hpp>
18 #include <ginkgo/core/base/utils.hpp>
19 #include <ginkgo/core/matrix/device_views.hpp>
20 #include <ginkgo/core/matrix/permutation.hpp>
21 #include <ginkgo/core/matrix/scaled_permutation.hpp>
25 namespace experimental {
26 namespace distributed {
29 template <
typename ValueType>
36 template <
typename ValueType>
48 template <
typename ValueType,
typename IndexType>
51 template <
typename ValueType,
typename IndexType>
54 template <
typename ValueType>
57 template <
typename ValueType,
typename IndexType>
60 template <
typename ValueType,
typename IndexType>
63 template <
typename ValueType,
typename IndexType>
66 template <
typename ValueType,
typename IndexType>
69 template <
typename ValueType,
typename IndexType>
88 template <
typename ValueType = default_precision>
91 public EnableCloneable<Dense<ValueType>>,
92 public ConvertibleTo<Dense<next_precision<ValueType>>>,
93 #if GINKGO_ENABLE_HALF || GINKGO_ENABLE_BFLOAT16
94 public ConvertibleTo<Dense<next_precision<ValueType, 2>>>,
96 #if GINKGO_ENABLE_HALF && GINKGO_ENABLE_BFLOAT16
97 public ConvertibleTo<Dense<next_precision<ValueType, 3>>>,
99 public ConvertibleTo<Coo<ValueType, int32>>,
100 public ConvertibleTo<Coo<ValueType, int64>>,
101 public ConvertibleTo<Csr<ValueType, int32>>,
102 public ConvertibleTo<Csr<ValueType, int64>>,
103 public ConvertibleTo<Ell<ValueType, int32>>,
104 public ConvertibleTo<Ell<ValueType, int64>>,
105 public ConvertibleTo<Fbcsr<ValueType, int32>>,
106 public ConvertibleTo<Fbcsr<ValueType, int64>>,
107 public ConvertibleTo<Hybrid<ValueType, int32>>,
108 public ConvertibleTo<Hybrid<ValueType, int64>>,
109 public ConvertibleTo<Sellp<ValueType, int32>>,
110 public ConvertibleTo<Sellp<ValueType, int64>>,
111 public ConvertibleTo<SparsityCsr<ValueType, int32>>,
112 public ConvertibleTo<SparsityCsr<ValueType, int64>>,
113 public DiagonalExtractable<ValueType>,
114 public ReadableFromMatrixData<ValueType, int32>,
115 public ReadableFromMatrixData<ValueType, int64>,
116 public WritableToMatrixData<ValueType, int32>,
117 public WritableToMatrixData<ValueType, int64>,
119 public Permutable<int32>,
120 public Permutable<int64>,
121 public EnableAbsoluteComputation<remove_complex<Dense<ValueType>>>,
122 public ScaledIdentityAddable {
123 friend class EnableCloneable<
Dense>;
124 friend class Coo<ValueType,
int32>;
125 friend class Coo<ValueType,
int64>;
126 friend class Csr<ValueType,
int32>;
127 friend class Csr<ValueType,
int64>;
128 friend class Diagonal<ValueType>;
129 friend class Ell<ValueType,
int32>;
130 friend class Ell<ValueType,
int64>;
131 friend class Fbcsr<ValueType,
int32>;
132 friend class Fbcsr<ValueType,
int64>;
133 friend class Hybrid<ValueType,
int32>;
134 friend class Hybrid<ValueType,
int64>;
135 friend class Sellp<ValueType,
int32>;
136 friend class Sellp<ValueType,
int64>;
137 friend class SparsityCsr<ValueType,
int32>;
138 friend class SparsityCsr<ValueType,
int64>;
140 friend class experimental::distributed::Vector<ValueType>;
141 friend class experimental::distributed::detail::VectorCache<ValueType>;
142 GKO_ASSERT_SUPPORTED_VALUE_TYPE;
147 using ConvertibleTo<Dense<next_precision<ValueType>>>::convert_to;
148 using ConvertibleTo<Dense<next_precision<ValueType>>>::move_to;
149 using ConvertibleTo<Coo<ValueType, int32>>::convert_to;
150 using ConvertibleTo<Coo<ValueType, int32>>::move_to;
151 using ConvertibleTo<Coo<ValueType, int64>>::convert_to;
152 using ConvertibleTo<Coo<ValueType, int64>>::move_to;
153 using ConvertibleTo<Csr<ValueType, int32>>::convert_to;
154 using ConvertibleTo<Csr<ValueType, int32>>::move_to;
155 using ConvertibleTo<Csr<ValueType, int64>>::convert_to;
156 using ConvertibleTo<Csr<ValueType, int64>>::move_to;
157 using ConvertibleTo<Ell<ValueType, int32>>::convert_to;
158 using ConvertibleTo<Ell<ValueType, int32>>::move_to;
159 using ConvertibleTo<Ell<ValueType, int64>>::convert_to;
160 using ConvertibleTo<Ell<ValueType, int64>>::move_to;
161 using ConvertibleTo<Fbcsr<ValueType, int32>>::convert_to;
162 using ConvertibleTo<Fbcsr<ValueType, int32>>::move_to;
163 using ConvertibleTo<Fbcsr<ValueType, int64>>::convert_to;
164 using ConvertibleTo<Fbcsr<ValueType, int64>>::move_to;
165 using ConvertibleTo<Hybrid<ValueType, int32>>::convert_to;
166 using ConvertibleTo<Hybrid<ValueType, int32>>::move_to;
167 using ConvertibleTo<Hybrid<ValueType, int64>>::convert_to;
168 using ConvertibleTo<Hybrid<ValueType, int64>>::move_to;
169 using ConvertibleTo<Sellp<ValueType, int32>>::convert_to;
170 using ConvertibleTo<Sellp<ValueType, int32>>::move_to;
171 using ConvertibleTo<Sellp<ValueType, int64>>::convert_to;
172 using ConvertibleTo<Sellp<ValueType, int64>>::move_to;
173 using ConvertibleTo<SparsityCsr<ValueType, int32>>::convert_to;
174 using ConvertibleTo<SparsityCsr<ValueType, int32>>::move_to;
175 using ConvertibleTo<SparsityCsr<ValueType, int64>>::convert_to;
176 using ConvertibleTo<SparsityCsr<ValueType, int64>>::move_to;
180 using value_type = ValueType;
181 using index_type =
int64;
182 using transposed_type = Dense<value_type>;
183 using mat_data = matrix_data<value_type, int64>;
184 using mat_data32 = matrix_data<value_type, int32>;
185 using device_mat_data = device_matrix_data<value_type, int64>;
186 using device_mat_data32 = device_matrix_data<value_type, int32>;
187 using absolute_type = remove_complex<Dense>;
188 using real_type = absolute_type;
189 using complex_type = to_complex<Dense>;
190 using device_view = matrix::view::dense<value_type>;
191 using const_device_view = matrix::view::dense<const value_type>;
208 return (*other).create_with_same_config();
227 return (*other).create_with_type_of_impl(exec, size, size[1]);
243 return (*other).create_with_type_of_impl(exec, size, stride);
261 return (*other).create_with_type_of_impl(exec, size, stride);
274 return other->create_view_of_impl();
287 return other->create_const_view_of_impl();
296 #if GINKGO_ENABLE_HALF || GINKGO_ENABLE_BFLOAT16
306 #if GINKGO_ENABLE_HALF && GINKGO_ENABLE_BFLOAT16
372 void read(
const mat_data& data)
override;
374 void read(
const mat_data32& data)
override;
376 void read(
const device_mat_data& data)
override;
378 void read(
const device_mat_data32& data)
override;
380 void read(device_mat_data&& data)
override;
382 void read(device_mat_data32&& data)
override;
384 void write(mat_data& data)
const override;
386 void write(mat_data32& data)
const override;
388 std::unique_ptr<LinOp>
transpose()
const override;
413 void fill(
const ValueType value);
429 std::unique_ptr<Dense>
permute(
436 std::unique_ptr<Dense>
permute(
468 std::unique_ptr<Dense>
permute(
471 bool invert =
false)
const;
477 std::unique_ptr<Dense>
permute(
480 bool invert =
false)
const;
555 bool invert =
false)
const;
565 bool invert =
false)
const;
590 std::unique_ptr<LinOp>
permute(
591 const array<int32>* permutation_indices)
const override;
593 std::unique_ptr<LinOp>
permute(
594 const array<int64>* permutation_indices)
const override;
615 const array<int32>* permutation_indices)
const override;
618 const array<int64>* permutation_indices)
const override;
640 const array<int32>* permutation_indices)
const override;
643 const array<int64>* permutation_indices)
const override;
729 const array<int32>* permutation_indices)
const override;
732 const array<int64>* permutation_indices)
const override;
753 const array<int32>* permutation_indices)
const override;
756 const array<int64>* permutation_indices)
const override;
777 const array<int32>* permutation_indices)
const override;
780 const array<int64>* permutation_indices)
const override;
841 std::unique_ptr<real_type>
get_real()
const;
852 std::unique_ptr<real_type>
get_imag()
const;
896 device_view get_device_view();
898 const_device_view get_const_device_view()
const;
912 return values_.
get_data()[linearize_index(row, col)];
939 return values_.
get_data()[linearize_index(idx)];
1145 return this->create_submatrix_impl(
rows,
columns, stride);
1174 GKO_ASSERT_EQUAL_DIMENSIONS(deduced_size, size);
1204 static std::unique_ptr<Dense>
create(std::shared_ptr<const Executor> exec,
1224 static std::unique_ptr<Dense>
create(std::shared_ptr<const Executor> exec,
1233 template <
typename InputValueType>
1235 "explicitly construct the gko::array argument instead of passing an"
1238 std::shared_ptr<const
Executor> exec, const
dim<2>& size,
1239 std::initializer_list<InputValueType> values,
size_type stride)
1257 std::shared_ptr<const Executor> exec,
const dim<2>& size,
1258 gko::detail::const_array_view<ValueType>&& values,
size_type stride);
1287 Dense(std::shared_ptr<const Executor> exec,
const dim<2>& size = {},
1290 Dense(std::shared_ptr<const Executor> exec,
const dim<2>& size,
1299 virtual std::unique_ptr<Dense> create_with_same_config()
const
1312 virtual std::unique_ptr<Dense> create_with_type_of_impl(
1313 std::shared_ptr<const Executor> exec,
const dim<2>& size,
1325 virtual std::unique_ptr<Dense> create_view_of_impl()
1341 virtual std::unique_ptr<const Dense> create_const_view_of_impl()
const
1351 template <
typename IndexType>
1352 void convert_impl(Coo<ValueType, IndexType>* result)
const;
1354 template <
typename IndexType>
1355 void convert_impl(Csr<ValueType, IndexType>* result)
const;
1357 template <
typename IndexType>
1358 void convert_impl(Ell<ValueType, IndexType>* result)
const;
1360 template <
typename IndexType>
1361 void convert_impl(Fbcsr<ValueType, IndexType>* result)
const;
1363 template <
typename IndexType>
1364 void convert_impl(Hybrid<ValueType, IndexType>* result)
const;
1366 template <
typename IndexType>
1367 void convert_impl(Sellp<ValueType, IndexType>* result)
const;
1369 template <
typename IndexType>
1370 void convert_impl(SparsityCsr<ValueType, IndexType>* result)
const;
1378 virtual void scale_impl(
const LinOp* alpha);
1386 virtual void inv_scale_impl(
const LinOp* alpha);
1394 virtual void add_scaled_impl(
const LinOp* alpha,
const LinOp* b);
1402 virtual void sub_scaled_impl(
const LinOp* alpha,
const LinOp* b);
1410 virtual void compute_dot_impl(
const LinOp* b,
LinOp* result)
const;
1418 virtual void compute_conj_dot_impl(
const LinOp* b,
LinOp* result)
const;
1426 virtual void compute_norm2_impl(
LinOp* result)
const;
1434 virtual void compute_norm1_impl(
LinOp* result)
const;
1442 virtual void compute_squared_norm2_impl(
LinOp* result)
const;
1447 virtual void compute_mean_impl(
LinOp* result)
const;
1466 virtual std::unique_ptr<Dense> create_submatrix_impl(
1469 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
1471 void apply_impl(
const LinOp* alpha,
const LinOp* b,
const LinOp* beta,
1472 LinOp* x)
const override;
1476 return row * stride_ + col;
1481 return linearize_index(idx / this->
get_size()[1],
1485 template <
typename IndexType>
1486 void permute_impl(
const Permutation<IndexType>* permutation,
1489 template <
typename IndexType>
1490 void permute_impl(
const Permutation<IndexType>* row_permutation,
1491 const Permutation<IndexType>* col_permutation,
1492 bool invert,
Dense* output)
const;
1494 template <
typename IndexType>
1495 void scale_permute_impl(
1496 const ScaledPermutation<ValueType, IndexType>* permutation,
1499 template <
typename IndexType>
1500 void scale_permute_impl(
1501 const ScaledPermutation<ValueType, IndexType>* row_permutation,
1502 const ScaledPermutation<ValueType, IndexType>* column_permutation,
1503 bool invert,
Dense* output)
const;
1505 template <
typename OutputType,
typename IndexType>
1506 void row_gather_impl(
const array<IndexType>* row_idxs,
1507 Dense<OutputType>* row_collection)
const;
1509 template <
typename OutputType,
typename IndexType>
1510 void row_gather_impl(
const Dense<ValueType>* alpha,
1511 const array<IndexType>* row_idxs,
1512 const Dense<ValueType>* beta,
1513 Dense<OutputType>* row_collection)
const;
1517 array<value_type> values_;
1519 void add_scaled_identity_impl(
const LinOp* a,
const LinOp* b)
override;
1529 template <
typename ValueType>
1530 struct temporary_clone_helper<matrix::Dense<ValueType>> {
1531 static std::unique_ptr<matrix::Dense<ValueType>> create(
1532 std::shared_ptr<const Executor> exec, matrix::Dense<ValueType>* ptr,
1554 template <
typename VecPtr>
1555 std::unique_ptr<matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1558 using value_type =
typename detail::pointee<VecPtr>::value_type;
1570 template <
typename VecPtr>
1572 const matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1575 using value_type =
typename detail::pointee<VecPtr>::value_type;
1600 template <
typename Matrix,
typename... TArgs>
1602 size_type stride, std::initializer_list<typename Matrix::value_type> vals,
1603 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1607 auto tmp = dense::create(exec->get_master(),
dim<2>{num_rows, 1}, stride);
1609 for (
const auto& elem : vals) {
1610 tmp->
at(idx) = elem;
1613 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1638 template <
typename Matrix,
typename... TArgs>
1640 std::initializer_list<typename Matrix::value_type> vals,
1641 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1643 return initialize<Matrix>(1, vals, std::move(exec),
1644 std::forward<TArgs>(create_args)...);
1668 template <
typename Matrix,
typename... TArgs>
1671 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1673 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1677 size_type num_cols = num_rows > 0 ? begin(vals)->size() : 1;
1679 dense::create(exec->get_master(),
dim<2>{num_rows, num_cols}, stride);
1681 for (
const auto& row : vals) {
1683 for (
const auto& elem : row) {
1684 tmp->
at(ridx, cidx) = elem;
1689 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1716 template <
typename Matrix,
typename... TArgs>
1718 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1720 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1722 return initialize<Matrix>(vals.size() > 0 ? begin(vals)->size() : 0, vals,
1724 std::forward<TArgs>(create_args)...);
1731 #endif // GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
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< LinOp > inverse_column_permute(const array< int32 > *permutation_indices) const override
Returns a LinOp representing the row permutation of the inverse permuted object.
void add_scaled(ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
Adds b scaled by alpha to the matrix (aka: BLAS axpy).
Fixed-block compressed sparse row storage matrix format.
Definition: csr.hpp:46
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition: matrix.hpp:30
The rows will be permuted.
std::unique_ptr< LinOp > transpose() const override
Returns a LinOp representing the transpose of the Transposable object.
The columns will be permuted.
virtual void read(const matrix_data< ValueType, int32 > &data)=0
Reads a matrix from a matrix_data structure.
Dense is a matrix format which explicitly stores all values of the matrix.
Definition: dense_cache.hpp:28
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition: csr.hpp:40
ValueType at(size_type idx) const noexcept
Returns a single element of the matrix.
Definition: dense.hpp:945
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< complex_type > make_complex() const
Creates a complex copy of the original matrix.
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_with_type_of(ptr_param< const Dense > other, std::shared_ptr< const Executor > exec, const dim< 2 > &size, size_type stride)
Definition: dense.hpp:238
void scale(ptr_param< const LinOp > alpha)
Scales the matrix with a scalar (aka: BLAS scal).
ScaledPermutation is a matrix combining a permutation with scaling factors.
Definition: scaled_permutation.hpp:36
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:90
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 inv_scale(ptr_param< const LinOp > alpha)
Scales the matrix with the inverse of a scalar.
Permutation is a matrix format that represents a permutation matrix, i.e.
Definition: csr.hpp:52
void fill(const ValueType value)
Fill the dense matrix with a given value.
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:820
void compute_dot(ptr_param< const LinOp > b, ptr_param< LinOp > result) const
Computes the column-wise dot product of this matrix and b.
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:1141
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:201
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:1601
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition: utils_helper.hpp:425
value_type & at(size_type row, size_type col) noexcept
Returns a single element of the matrix.
Definition: dense.hpp:910
size_type get_stride() const noexcept
Returns the stride of the matrix.
Definition: dense.hpp:884
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:272
A range is a multidimensional view of the memory.
Definition: range.hpp:304
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
size_type get_num_stored_elements() const noexcept
Returns the number of elements explicitly stored in the matrix.
Definition: dense.hpp:891
void sub_scaled(ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
Subtracts b scaled by alpha from the matrix (aka: BLAS axpy).
value_type * get_values() noexcept
Returns a pointer to the array of values of the matrix.
Definition: dense.hpp:865
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition: array.hpp:26
void compute_norm2(ptr_param< LinOp > result) const
Computes 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.
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:222
A span is a lightweight structure used to create sub-ranges from other ranges.
Definition: range.hpp:46
This class is a utility which efficiently implements the diagonal matrix (a linear operator which sca...
Definition: lin_op.hpp:31
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.
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:43
value_type at(size_type row, size_type col) const noexcept
Returns a single element of the matrix.
Definition: dense.hpp:918
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition: array.hpp:687
void compute_mean(ptr_param< LinOp > result) const
Computes the column-wise arithmetic mean of this 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.
The rows and columns will be permuted.
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 compute_squared_norm2(ptr_param< LinOp > result) const
Computes the square of the column-wise Euclidean (L^2) norm of this matrix.
Dense & operator=(const Dense &)
Copy-assigns a Dense matrix.
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...
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:256
mode
The mode for the residual norm criterion.
Definition: residual_norm.hpp:37
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 compute_norm1(ptr_param< LinOp > result) const
Computes the column-wise (L^1) norm of this matrix.
const value_type * get_const_values() const noexcept
Returns a pointer to the array of values of the matrix.
Definition: dense.hpp:874
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:801
std::unique_ptr< Diagonal< ValueType > > extract_diagonal() const override
Extracts the diagonal entries of the matrix into a vector.
typename detail::find_precision_impl< T, step >::type next_precision
Obtains the next move type of T in the singly-linked precision corresponding bfloat16/half.
Definition: math.hpp:466
void compute_absolute_inplace() override
Compute absolute inplace on each element.
std::unique_ptr< LinOp > column_permute(const array< int32 > *permutation_indices) const override
Returns a LinOp representing the column permutation of the Permutable object.
void convert_to(result_type *result) const override
Converts the implementer to an object of type result_type.
Definition: polymorphic_object.hpp:404
typename detail::find_precision_impl< T, -step >::type previous_precision
Obtains the previous move type of T in the singly-linked precision corresponding bfloat16/half.
Definition: math.hpp:473
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:284
ValueType & at(size_type idx) noexcept
Returns a single element of the matrix.
Definition: dense.hpp:937
std::unique_ptr< LinOp > conj_transpose() const override
Returns a LinOp representing the conjugate transpose of the Transposable object.
std::int64_t int64
64-bit signed integral type.
Definition: types.hpp:113
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.
ELL is a matrix format where stride with explicit zeros is used such that all rows have the same numb...
Definition: csr.hpp:31
ConvertibleTo interface is used to mark that the implementer can be converted to the object of Result...
Definition: polymorphic_object.hpp:140
std::unique_ptr< Dense > create_submatrix(const span &rows, const span &columns)
Create a submatrix from the original matrix.
Definition: dense.hpp:1154
std::int32_t int32
32-bit signed integral type.
Definition: types.hpp:107
std::unique_ptr< absolute_type > compute_absolute() const override
Gets the AbsoluteLinOp.
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:1556
The first step in using the Ginkgo library consists of creating an executor.
Definition: executor.hpp:616
HYBRID is a matrix format which splits the matrix into ELLPACK and COO format.
Definition: coo.hpp:33
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:696
permute_mode
Specifies how a permutation will be applied to a matrix.
Definition: permutation.hpp:42
Dense(const Dense &)
Copy-constructs a Dense matrix.
SELL-P is a matrix format similar to ELL format.
Definition: csr.hpp:37
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:1573
void move_to(result_type *result) override
Converts the implementer to an object of type result_type by moving data from this object.
Definition: polymorphic_object.hpp:406
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition: polymorphic_object.hpp:62
size_type get_size() const noexcept
Returns the number of elements in the array.
Definition: array.hpp:670
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition: lin_op.hpp:169
A span that is used exclusively for local numbering.
Definition: range.hpp:138
std::unique_ptr< Dense > create_submatrix(const local_span &rows, const local_span &columns, dim< 2 > size)
Create a submatrix from the original matrix.
Definition: dense.hpp:1169
std::unique_ptr< real_type > create_real_view()
Create a real view of the (potentially) complex original matrix.
LinOp(const LinOp &)=default
Copy-constructs a LinOp.
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:283
COO stores a matrix in the coordinate matrix format.
Definition: coo.hpp:51