Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
dense.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
7
8
9#include <initializer_list>
10#include <type_traits>
11
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/permutation.hpp>
20#include <ginkgo/core/matrix/scaled_permutation.hpp>
21
22
23namespace gko {
24namespace experimental {
25namespace distributed {
26
27
28template <typename ValueType>
29class Vector;
30
31
32namespace detail {
33
34
35template <typename ValueType>
36class VectorCache;
37
38
39} // namespace detail
40} // namespace distributed
41} // namespace experimental
42
43
44namespace matrix {
45
46
47template <typename ValueType, typename IndexType>
48class Coo;
49
50template <typename ValueType, typename IndexType>
51class Csr;
52
53template <typename ValueType>
54class Diagonal;
55
56template <typename ValueType, typename IndexType>
57class Ell;
58
59template <typename ValueType, typename IndexType>
60class Fbcsr;
61
62template <typename ValueType, typename IndexType>
63class Hybrid;
64
65template <typename ValueType, typename IndexType>
66class Sellp;
67
68template <typename ValueType, typename IndexType>
69class SparsityCsr;
70
71
87template <typename ValueType = default_precision>
88class Dense
89 : public EnableLinOp<Dense<ValueType>>,
90 public ConvertibleTo<Dense<next_precision<ValueType>>>,
91#if GINKGO_ENABLE_HALF
92 public ConvertibleTo<Dense<next_precision<next_precision<ValueType>>>>,
93#endif
94 public ConvertibleTo<Coo<ValueType, int32>>,
95 public ConvertibleTo<Coo<ValueType, int64>>,
96 public ConvertibleTo<Csr<ValueType, int32>>,
97 public ConvertibleTo<Csr<ValueType, int64>>,
98 public ConvertibleTo<Ell<ValueType, int32>>,
99 public ConvertibleTo<Ell<ValueType, int64>>,
100 public ConvertibleTo<Fbcsr<ValueType, int32>>,
101 public ConvertibleTo<Fbcsr<ValueType, int64>>,
102 public ConvertibleTo<Hybrid<ValueType, int32>>,
103 public ConvertibleTo<Hybrid<ValueType, int64>>,
104 public ConvertibleTo<Sellp<ValueType, int32>>,
105 public ConvertibleTo<Sellp<ValueType, int64>>,
106 public ConvertibleTo<SparsityCsr<ValueType, int32>>,
107 public ConvertibleTo<SparsityCsr<ValueType, int64>>,
108 public DiagonalExtractable<ValueType>,
109 public ReadableFromMatrixData<ValueType, int32>,
110 public ReadableFromMatrixData<ValueType, int64>,
111 public WritableToMatrixData<ValueType, int32>,
112 public WritableToMatrixData<ValueType, int64>,
113 public Transposable,
114 public Permutable<int32>,
115 public Permutable<int64>,
116 public EnableAbsoluteComputation<remove_complex<Dense<ValueType>>>,
117 public ScaledIdentityAddable {
118 friend class EnablePolymorphicObject<Dense, LinOp>;
119 friend class Coo<ValueType, int32>;
120 friend class Coo<ValueType, int64>;
121 friend class Csr<ValueType, int32>;
122 friend class Csr<ValueType, int64>;
123 friend class Diagonal<ValueType>;
124 friend class Ell<ValueType, int32>;
125 friend class Ell<ValueType, int64>;
126 friend class Fbcsr<ValueType, int32>;
127 friend class Fbcsr<ValueType, int64>;
128 friend class Hybrid<ValueType, int32>;
129 friend class Hybrid<ValueType, int64>;
130 friend class Sellp<ValueType, int32>;
131 friend class Sellp<ValueType, int64>;
132 friend class SparsityCsr<ValueType, int32>;
133 friend class SparsityCsr<ValueType, int64>;
134 friend class Dense<to_complex<ValueType>>;
135 friend class experimental::distributed::Vector<ValueType>;
136 friend class experimental::distributed::detail::VectorCache<ValueType>;
137
138public:
139 using EnableLinOp<Dense>::convert_to;
140 using EnableLinOp<Dense>::move_to;
143 using ConvertibleTo<Coo<ValueType, int32>>::convert_to;
144 using ConvertibleTo<Coo<ValueType, int32>>::move_to;
145 using ConvertibleTo<Coo<ValueType, int64>>::convert_to;
146 using ConvertibleTo<Coo<ValueType, int64>>::move_to;
147 using ConvertibleTo<Csr<ValueType, int32>>::convert_to;
148 using ConvertibleTo<Csr<ValueType, int32>>::move_to;
149 using ConvertibleTo<Csr<ValueType, int64>>::convert_to;
150 using ConvertibleTo<Csr<ValueType, int64>>::move_to;
151 using ConvertibleTo<Ell<ValueType, int32>>::convert_to;
152 using ConvertibleTo<Ell<ValueType, int32>>::move_to;
153 using ConvertibleTo<Ell<ValueType, int64>>::convert_to;
154 using ConvertibleTo<Ell<ValueType, int64>>::move_to;
155 using ConvertibleTo<Fbcsr<ValueType, int32>>::convert_to;
156 using ConvertibleTo<Fbcsr<ValueType, int32>>::move_to;
157 using ConvertibleTo<Fbcsr<ValueType, int64>>::convert_to;
158 using ConvertibleTo<Fbcsr<ValueType, int64>>::move_to;
159 using ConvertibleTo<Hybrid<ValueType, int32>>::convert_to;
160 using ConvertibleTo<Hybrid<ValueType, int32>>::move_to;
161 using ConvertibleTo<Hybrid<ValueType, int64>>::convert_to;
162 using ConvertibleTo<Hybrid<ValueType, int64>>::move_to;
163 using ConvertibleTo<Sellp<ValueType, int32>>::convert_to;
164 using ConvertibleTo<Sellp<ValueType, int32>>::move_to;
165 using ConvertibleTo<Sellp<ValueType, int64>>::convert_to;
166 using ConvertibleTo<Sellp<ValueType, int64>>::move_to;
167 using ConvertibleTo<SparsityCsr<ValueType, int32>>::convert_to;
168 using ConvertibleTo<SparsityCsr<ValueType, int32>>::move_to;
169 using ConvertibleTo<SparsityCsr<ValueType, int64>>::convert_to;
170 using ConvertibleTo<SparsityCsr<ValueType, int64>>::move_to;
171 using ReadableFromMatrixData<ValueType, int32>::read;
172 using ReadableFromMatrixData<ValueType, int64>::read;
173
174 using value_type = ValueType;
175 using index_type = int64;
176 using transposed_type = Dense<ValueType>;
177 using mat_data = matrix_data<ValueType, int64>;
178 using mat_data32 = matrix_data<ValueType, int32>;
179 using device_mat_data = device_matrix_data<ValueType, int64>;
180 using device_mat_data32 = device_matrix_data<ValueType, int32>;
181 using absolute_type = remove_complex<Dense>;
182 using real_type = absolute_type;
183 using complex_type = to_complex<Dense>;
184
186
193 static std::unique_ptr<Dense> create_with_config_of(
195 {
196 // De-referencing `other` before calling the functions (instead of
197 // using operator `->`) is currently required to be compatible with
198 // CUDA 10.1.
199 // Otherwise, it results in a compile error.
200 return (*other).create_with_same_config();
201 }
202
214 static std::unique_ptr<Dense> create_with_type_of(
215 ptr_param<const Dense> other, std::shared_ptr<const Executor> exec,
216 const dim<2>& size = dim<2>{})
217 {
218 // See create_with_config_of()
219 return (*other).create_with_type_of_impl(exec, size, size[1]);
220 }
221
230 static std::unique_ptr<Dense> create_with_type_of(
231 ptr_param<const Dense> other, std::shared_ptr<const Executor> exec,
232 const dim<2>& size, size_type stride)
233 {
234 // See create_with_config_of()
235 return (*other).create_with_type_of_impl(exec, size, stride);
236 }
237
248 static std::unique_ptr<Dense> create_with_type_of(
249 ptr_param<const Dense> other, std::shared_ptr<const Executor> exec,
250 const dim<2>& size, const dim<2>& local_size, size_type stride)
251 {
252 // See create_with_config_of()
253 return (*other).create_with_type_of_impl(exec, size, stride);
254 }
255
264 static std::unique_ptr<Dense> create_view_of(ptr_param<Dense> other)
265 {
266 return other->create_view_of_impl();
267 }
268
276 static std::unique_ptr<const Dense> create_const_view_of(
278 {
279 return other->create_const_view_of_impl();
280 }
281
282 friend class Dense<previous_precision<ValueType>>;
283
284 void convert_to(Dense<next_precision<ValueType>>* result) const override;
285
286 void move_to(Dense<next_precision<ValueType>>* result) override;
287
288#if GINKGO_ENABLE_HALF
289 friend class Dense<previous_precision<previous_precision<ValueType>>>;
290 using ConvertibleTo<
292 using ConvertibleTo<
294
295 void convert_to(Dense<next_precision<next_precision<ValueType>>>* result)
296 const override;
297
298 void move_to(
300#endif
301
302 void convert_to(Coo<ValueType, int32>* result) const override;
303
304 void move_to(Coo<ValueType, int32>* result) override;
305
306 void convert_to(Coo<ValueType, int64>* result) const override;
307
308 void move_to(Coo<ValueType, int64>* result) override;
309
310 void convert_to(Csr<ValueType, int32>* result) const override;
311
312 void move_to(Csr<ValueType, int32>* result) override;
313
314 void convert_to(Csr<ValueType, int64>* result) const override;
315
316 void move_to(Csr<ValueType, int64>* result) override;
317
318 void convert_to(Ell<ValueType, int32>* result) const override;
319
320 void move_to(Ell<ValueType, int32>* result) override;
321
322 void convert_to(Ell<ValueType, int64>* result) const override;
323
324 void move_to(Ell<ValueType, int64>* result) override;
325
326 void convert_to(Fbcsr<ValueType, int32>* result) const override;
327
328 void move_to(Fbcsr<ValueType, int32>* result) override;
329
330 void convert_to(Fbcsr<ValueType, int64>* result) const override;
331
332 void move_to(Fbcsr<ValueType, int64>* result) override;
333
334 void convert_to(Hybrid<ValueType, int32>* result) const override;
335
336 void move_to(Hybrid<ValueType, int32>* result) override;
337
338 void convert_to(Hybrid<ValueType, int64>* result) const override;
339
340 void move_to(Hybrid<ValueType, int64>* result) override;
341
342 void convert_to(Sellp<ValueType, int32>* result) const override;
343
344 void move_to(Sellp<ValueType, int32>* result) override;
345
346 void convert_to(Sellp<ValueType, int64>* result) const override;
347
348 void move_to(Sellp<ValueType, int64>* result) override;
349
350 void convert_to(SparsityCsr<ValueType, int32>* result) const override;
351
352 void move_to(SparsityCsr<ValueType, int32>* result) override;
353
354 void convert_to(SparsityCsr<ValueType, int64>* result) const override;
355
356 void move_to(SparsityCsr<ValueType, int64>* result) override;
357
358 void read(const mat_data& data) override;
359
360 void read(const mat_data32& data) override;
361
362 void read(const device_mat_data& data) override;
363
364 void read(const device_mat_data32& data) override;
365
366 void read(device_mat_data&& data) override;
367
368 void read(device_mat_data32&& data) override;
369
370 void write(mat_data& data) const override;
371
372 void write(mat_data32& data) const override;
373
374 std::unique_ptr<LinOp> transpose() const override;
375
376 std::unique_ptr<LinOp> conj_transpose() const override;
377
384 void transpose(ptr_param<Dense> output) const;
385
393
399 void fill(const ValueType value);
400
415 std::unique_ptr<Dense> permute(
416 ptr_param<const Permutation<int32>> permutation,
418
422 std::unique_ptr<Dense> permute(
423 ptr_param<const Permutation<int64>> permutation,
425
431 void permute(ptr_param<const Permutation<int32>> permutation,
432 ptr_param<Dense> output, permute_mode mode) const;
433
438 void permute(ptr_param<const Permutation<int64>> permutation,
439 ptr_param<Dense> output, permute_mode mode) const;
440
454 std::unique_ptr<Dense> permute(
455 ptr_param<const Permutation<int32>> row_permutation,
456 ptr_param<const Permutation<int32>> column_permutation,
457 bool invert = false) const;
458
463 std::unique_ptr<Dense> permute(
464 ptr_param<const Permutation<int64>> row_permutation,
465 ptr_param<const Permutation<int64>> column_permutation,
466 bool invert = false) const;
467
474 void permute(ptr_param<const Permutation<int32>> row_permutation,
475 ptr_param<const Permutation<int32>> column_permutation,
476 ptr_param<Dense> output, bool invert = false) const;
477
482 void permute(ptr_param<const Permutation<int64>> row_permutation,
483 ptr_param<const Permutation<int64>> column_permutation,
484 ptr_param<Dense> output, bool invert = false) const;
485
495 std::unique_ptr<Dense> scale_permute(
498
503 std::unique_ptr<Dense> scale_permute(
506
515 ptr_param<Dense> output, permute_mode mode) const;
516
523 ptr_param<Dense> output, permute_mode mode) const;
524
537 std::unique_ptr<Dense> scale_permute(
538 ptr_param<const ScaledPermutation<value_type, int32>> row_permutation,
540 column_permutation,
541 bool invert = false) const;
542
547 std::unique_ptr<Dense> scale_permute(
548 ptr_param<const ScaledPermutation<value_type, int64>> row_permutation,
550 column_permutation,
551 bool invert = false) const;
552
560 ptr_param<const ScaledPermutation<value_type, int32>> row_permutation,
562 column_permutation,
563 ptr_param<Dense> output, bool invert = false) const;
564
571 ptr_param<const ScaledPermutation<value_type, int64>> row_permutation,
573 column_permutation,
574 ptr_param<Dense> output, bool invert = false) const;
575
576 std::unique_ptr<LinOp> permute(
577 const array<int32>* permutation_indices) const override;
578
579 std::unique_ptr<LinOp> permute(
580 const array<int64>* permutation_indices) const override;
581
591 void permute(const array<int32>* permutation_indices,
592 ptr_param<Dense> output) const;
593
597 void permute(const array<int64>* permutation_indices,
598 ptr_param<Dense> output) const;
599
600 std::unique_ptr<LinOp> inverse_permute(
601 const array<int32>* permutation_indices) const override;
602
603 std::unique_ptr<LinOp> inverse_permute(
604 const array<int64>* permutation_indices) const override;
605
616 void inverse_permute(const array<int32>* permutation_indices,
617 ptr_param<Dense> output) const;
618
622 void inverse_permute(const array<int64>* permutation_indices,
623 ptr_param<Dense> output) const;
624
625 std::unique_ptr<LinOp> row_permute(
626 const array<int32>* permutation_indices) const override;
627
628 std::unique_ptr<LinOp> row_permute(
629 const array<int64>* permutation_indices) const override;
630
640 void row_permute(const array<int32>* permutation_indices,
641 ptr_param<Dense> output) const;
642
646 void row_permute(const array<int64>* permutation_indices,
647 ptr_param<Dense> output) const;
648
659 std::unique_ptr<Dense> row_gather(const array<int32>* gather_indices) const;
660
664 std::unique_ptr<Dense> row_gather(const array<int64>* gather_indices) const;
665
678 void row_gather(const array<int32>* gather_indices,
679 ptr_param<LinOp> row_collection) const;
680
684 void row_gather(const array<int64>* gather_indices,
685 ptr_param<LinOp> row_collection) const;
686
701 const array<int32>* gather_indices,
703 ptr_param<LinOp> row_collection) const;
704
710 const array<int64>* gather_indices,
712 ptr_param<LinOp> row_collection) const;
713
714 std::unique_ptr<LinOp> column_permute(
715 const array<int32>* permutation_indices) const override;
716
717 std::unique_ptr<LinOp> column_permute(
718 const array<int64>* permutation_indices) const override;
719
729 void column_permute(const array<int32>* permutation_indices,
730 ptr_param<Dense> output) const;
731
735 void column_permute(const array<int64>* permutation_indices,
736 ptr_param<Dense> output) const;
737
738 std::unique_ptr<LinOp> inverse_row_permute(
739 const array<int32>* permutation_indices) const override;
740
741 std::unique_ptr<LinOp> inverse_row_permute(
742 const array<int64>* permutation_indices) const override;
743
753 void inverse_row_permute(const array<int32>* permutation_indices,
754 ptr_param<Dense> output) const;
755
759 void inverse_row_permute(const array<int64>* permutation_indices,
760 ptr_param<Dense> output) const;
761
762 std::unique_ptr<LinOp> inverse_column_permute(
763 const array<int32>* permutation_indices) const override;
764
765 std::unique_ptr<LinOp> inverse_column_permute(
766 const array<int64>* permutation_indices) const override;
767
777 void inverse_column_permute(const array<int32>* permutation_indices,
778 ptr_param<Dense> output) const;
779
783 void inverse_column_permute(const array<int64>* permutation_indices,
784 ptr_param<Dense> output) const;
785
786 std::unique_ptr<Diagonal<ValueType>> extract_diagonal() const override;
787
796
797 std::unique_ptr<absolute_type> compute_absolute() const override;
798
807
809
814 std::unique_ptr<complex_type> make_complex() const;
815
822
827 std::unique_ptr<real_type> get_real() const;
828
832 void get_real(ptr_param<real_type> result) const;
833
838 std::unique_ptr<real_type> get_imag() const;
839
844 void get_imag(ptr_param<real_type> result) const;
845
851 value_type* get_values() noexcept { return values_.get_data(); }
852
860 const value_type* get_const_values() const noexcept
861 {
862 return values_.get_const_data();
863 }
864
870 size_type get_stride() const noexcept { return stride_; }
871
878 {
879 return values_.get_size();
880 }
881
892 value_type& at(size_type row, size_type col) noexcept
893 {
894 return values_.get_data()[linearize_index(row, col)];
895 }
896
900 value_type at(size_type row, size_type col) const noexcept
901 {
902 return values_.get_const_data()[linearize_index(row, col)];
903 }
904
919 ValueType& at(size_type idx) noexcept
920 {
921 return values_.get_data()[linearize_index(idx)];
922 }
923
927 ValueType at(size_type idx) const noexcept
928 {
929 return values_.get_const_data()[linearize_index(idx)];
930 }
931
942
953
965
977
987
1000 array<char>& tmp) const;
1001
1011 ptr_param<LinOp> result) const;
1012
1025 array<char>& tmp) const;
1026
1035
1047
1056
1068
1078
1091
1099 void compute_mean(ptr_param<LinOp> result) const;
1100
1112
1123 std::unique_ptr<Dense> create_submatrix(const span& rows,
1124 const span& columns,
1125 const size_type stride)
1126 {
1127 return this->create_submatrix_impl(rows, columns, stride);
1128 }
1129
1136 std::unique_ptr<Dense> create_submatrix(const span& rows,
1137 const span& columns)
1138 {
1139 return create_submatrix(rows, columns, this->get_stride());
1140 }
1141
1149 std::unique_ptr<real_type> create_real_view();
1150
1154 std::unique_ptr<const real_type> create_real_view() const;
1155
1168 static std::unique_ptr<Dense> create(std::shared_ptr<const Executor> exec,
1169 const dim<2>& size = {},
1170 size_type stride = 0);
1171
1188 static std::unique_ptr<Dense> create(std::shared_ptr<const Executor> exec,
1189 const dim<2>& size,
1190 array<value_type> values,
1191 size_type stride);
1192
1197 template <typename InputValueType>
1198 GKO_DEPRECATED(
1199 "explicitly construct the gko::array argument instead of passing an"
1200 "initializer list")
1201 static std::unique_ptr<Dense> create(
1202 std::shared_ptr<const Executor> exec, const dim<2>& size,
1203 std::initializer_list<InputValueType> values, size_type stride)
1204 {
1205 return create(exec, size, array<value_type>{exec, std::move(values)},
1206 stride);
1207 }
1208
1220 static std::unique_ptr<const Dense> create_const(
1221 std::shared_ptr<const Executor> exec, const dim<2>& size,
1222 gko::detail::const_array_view<ValueType>&& values, size_type stride);
1223
1230
1237
1242 Dense(const Dense&);
1243
1249
1250protected:
1251 Dense(std::shared_ptr<const Executor> exec, const dim<2>& size = {},
1252 size_type stride = 0);
1253
1254 Dense(std::shared_ptr<const Executor> exec, const dim<2>& size,
1255 array<value_type> values, size_type stride);
1256
1263 virtual std::unique_ptr<Dense> create_with_same_config() const
1264 {
1265 return Dense::create(this->get_executor(), this->get_size(),
1266 this->get_stride());
1267 }
1268
1276 virtual std::unique_ptr<Dense> create_with_type_of_impl(
1277 std::shared_ptr<const Executor> exec, const dim<2>& size,
1278 size_type stride) const
1279 {
1280 return Dense::create(exec, size, stride);
1281 }
1282
1289 virtual std::unique_ptr<Dense> create_view_of_impl()
1290 {
1291 auto exec = this->get_executor();
1292 return Dense::create(
1293 exec, this->get_size(),
1295 this->get_values()),
1296 this->get_stride());
1297 }
1298
1305 virtual std::unique_ptr<const Dense> create_const_view_of_impl() const
1306 {
1307 auto exec = this->get_executor();
1308 return Dense::create_const(
1309 exec, this->get_size(),
1311 this->get_const_values()),
1312 this->get_stride());
1313 }
1314
1315 template <typename IndexType>
1316 void convert_impl(Coo<ValueType, IndexType>* result) const;
1317
1318 template <typename IndexType>
1319 void convert_impl(Csr<ValueType, IndexType>* result) const;
1320
1321 template <typename IndexType>
1322 void convert_impl(Ell<ValueType, IndexType>* result) const;
1323
1324 template <typename IndexType>
1325 void convert_impl(Fbcsr<ValueType, IndexType>* result) const;
1326
1327 template <typename IndexType>
1328 void convert_impl(Hybrid<ValueType, IndexType>* result) const;
1329
1330 template <typename IndexType>
1331 void convert_impl(Sellp<ValueType, IndexType>* result) const;
1332
1333 template <typename IndexType>
1334 void convert_impl(SparsityCsr<ValueType, IndexType>* result) const;
1335
1342 virtual void scale_impl(const LinOp* alpha);
1343
1350 virtual void inv_scale_impl(const LinOp* alpha);
1351
1358 virtual void add_scaled_impl(const LinOp* alpha, const LinOp* b);
1359
1366 virtual void sub_scaled_impl(const LinOp* alpha, const LinOp* b);
1367
1374 virtual void compute_dot_impl(const LinOp* b, LinOp* result) const;
1375
1382 virtual void compute_conj_dot_impl(const LinOp* b, LinOp* result) const;
1383
1390 virtual void compute_norm2_impl(LinOp* result) const;
1391
1398 virtual void compute_norm1_impl(LinOp* result) const;
1399
1406 virtual void compute_squared_norm2_impl(LinOp* result) const;
1407
1411 virtual void compute_mean_impl(LinOp* result) const;
1412
1421 void resize(gko::dim<2> new_size);
1422
1430 virtual std::unique_ptr<Dense> create_submatrix_impl(
1431 const span& rows, const span& columns, const size_type stride);
1432
1433 void apply_impl(const LinOp* b, LinOp* x) const override;
1434
1435 void apply_impl(const LinOp* alpha, const LinOp* b, const LinOp* beta,
1436 LinOp* x) const override;
1437
1438 size_type linearize_index(size_type row, size_type col) const noexcept
1439 {
1440 return row * stride_ + col;
1441 }
1442
1443 size_type linearize_index(size_type idx) const noexcept
1444 {
1445 return linearize_index(idx / this->get_size()[1],
1446 idx % this->get_size()[1]);
1447 }
1448
1449 template <typename IndexType>
1450 void permute_impl(const Permutation<IndexType>* permutation,
1451 permute_mode mode, Dense* output) const;
1452
1453 template <typename IndexType>
1454 void permute_impl(const Permutation<IndexType>* row_permutation,
1455 const Permutation<IndexType>* col_permutation,
1456 bool invert, Dense* output) const;
1457
1458 template <typename IndexType>
1459 void scale_permute_impl(
1460 const ScaledPermutation<ValueType, IndexType>* permutation,
1461 permute_mode mode, Dense* output) const;
1462
1463 template <typename IndexType>
1464 void scale_permute_impl(
1465 const ScaledPermutation<ValueType, IndexType>* row_permutation,
1466 const ScaledPermutation<ValueType, IndexType>* column_permutation,
1467 bool invert, Dense* output) const;
1468
1469 template <typename OutputType, typename IndexType>
1470 void row_gather_impl(const array<IndexType>* row_idxs,
1471 Dense<OutputType>* row_collection) const;
1472
1473 template <typename OutputType, typename IndexType>
1474 void row_gather_impl(const Dense<ValueType>* alpha,
1475 const array<IndexType>* row_idxs,
1476 const Dense<ValueType>* beta,
1477 Dense<OutputType>* row_collection) const;
1478
1479private:
1480 size_type stride_;
1481 array<value_type> values_;
1482
1483 void add_scaled_identity_impl(const LinOp* a, const LinOp* b) override;
1484};
1485
1486
1487} // namespace matrix
1488
1489
1490namespace detail {
1491
1492
1493template <typename ValueType>
1494struct temporary_clone_helper<matrix::Dense<ValueType>> {
1495 static std::unique_ptr<matrix::Dense<ValueType>> create(
1496 std::shared_ptr<const Executor> exec, matrix::Dense<ValueType>* ptr,
1497 bool copy_data)
1498 {
1499 if (copy_data) {
1500 return gko::clone(std::move(exec), ptr);
1501 } else {
1502 return matrix::Dense<ValueType>::create(exec, ptr->get_size());
1503 }
1504 }
1505};
1506
1507
1508} // namespace detail
1509
1510
1518template <typename VecPtr>
1519std::unique_ptr<matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1520make_dense_view(VecPtr&& vector)
1521{
1522 using value_type = typename detail::pointee<VecPtr>::value_type;
1524}
1525
1526
1534template <typename VecPtr>
1535std::unique_ptr<
1536 const matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
1538{
1539 using value_type = typename detail::pointee<VecPtr>::value_type;
1541}
1542
1543
1564template <typename Matrix, typename... TArgs>
1565std::unique_ptr<Matrix> initialize(
1566 size_type stride, std::initializer_list<typename Matrix::value_type> vals,
1567 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1568{
1570 size_type num_rows = vals.size();
1571 auto tmp = dense::create(exec->get_master(), dim<2>{num_rows, 1}, stride);
1572 size_type idx = 0;
1573 for (const auto& elem : vals) {
1574 tmp->at(idx) = elem;
1575 ++idx;
1576 }
1577 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1578 tmp->move_to(mtx);
1579 return mtx;
1580}
1581
1602template <typename Matrix, typename... TArgs>
1603std::unique_ptr<Matrix> initialize(
1604 std::initializer_list<typename Matrix::value_type> vals,
1605 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1606{
1607 return initialize<Matrix>(1, vals, std::move(exec),
1608 std::forward<TArgs>(create_args)...);
1609}
1610
1611
1632template <typename Matrix, typename... TArgs>
1633std::unique_ptr<Matrix> initialize(
1634 size_type stride,
1635 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1636 vals,
1637 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1638{
1640 size_type num_rows = vals.size();
1641 size_type num_cols = num_rows > 0 ? begin(vals)->size() : 1;
1642 auto tmp =
1643 dense::create(exec->get_master(), dim<2>{num_rows, num_cols}, stride);
1644 size_type ridx = 0;
1645 for (const auto& row : vals) {
1646 size_type cidx = 0;
1647 for (const auto& elem : row) {
1648 tmp->at(ridx, cidx) = elem;
1649 ++cidx;
1650 }
1651 ++ridx;
1652 }
1653 auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
1654 tmp->move_to(mtx);
1655 return mtx;
1656}
1657
1658
1680template <typename Matrix, typename... TArgs>
1681std::unique_ptr<Matrix> initialize(
1682 std::initializer_list<std::initializer_list<typename Matrix::value_type>>
1683 vals,
1684 std::shared_ptr<const Executor> exec, TArgs&&... create_args)
1685{
1686 return initialize<Matrix>(vals.size() > 0 ? begin(vals)->size() : 0, vals,
1687 std::move(exec),
1688 std::forward<TArgs>(create_args)...);
1689}
1690
1691
1692} // namespace gko
1693
1694
1695#endif // GKO_PUBLIC_CORE_MATRIX_DENSE_HPP_
ConvertibleTo interface is used to mark that the implementer can be converted to the object of Result...
Definition polymorphic_object.hpp:470
The diagonal of a LinOp implementing this interface can be extracted.
Definition lin_op.hpp:743
The EnableAbsoluteComputation mixin provides the default implementations of compute_absolute_linop an...
Definition lin_op.hpp:794
The EnableLinOp mixin can be used to provide sensible default implementations of the majority of the ...
Definition lin_op.hpp:879
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:662
The first step in using the Ginkgo library consists of creating an executor.
Definition executor.hpp:615
Definition lin_op.hpp:117
LinOp(const LinOp &)=default
Copy-constructs a LinOp.
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition lin_op.hpp:210
Linear operators which support permutation should implement the Permutable interface.
Definition lin_op.hpp:484
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition polymorphic_object.hpp:234
A LinOp implementing this interface can read its data from a matrix_data structure.
Definition lin_op.hpp:605
Adds the operation M <- a I + b M for matrix M, identity operator I and scalars a and b,...
Definition lin_op.hpp:818
Linear operators which support transposition should implement the Transposable interface.
Definition lin_op.hpp:433
A LinOp implementing this interface can write its data to a matrix_data structure.
Definition lin_op.hpp:660
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition logger.hpp:25
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition array.hpp:673
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:682
size_type get_size() const noexcept
Returns the number of elements in the array.
Definition array.hpp:656
This type is a device-side equivalent to matrix_data.
Definition device_matrix_data.hpp:36
Vector is a format which explicitly stores (multiple) distributed column vectors in a dense storage f...
Definition dense.hpp:29
COO stores a matrix in the coordinate matrix format.
Definition ell.hpp:21
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition sparsity_csr.hpp:21
Dense is a matrix format which explicitly stores all values of the matrix.
Definition sparsity_csr.hpp:25
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:892
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:193
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:248
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:927
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:214
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:1136
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:1123
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 Scale...
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:860
size_type get_num_stored_elements() const noexcept
Returns the number of elements explicitly stored in the matrix.
Definition dense.hpp:877
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:919
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.
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.
size_type get_stride() const noexcept
Returns the stride of the matrix.
Definition dense.hpp:870
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:264
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<constPermutation<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:276
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 wr...
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:900
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< 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.
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:851
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:230
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:53
ELL is a matrix format where stride with explicit zeros is used such that all rows have the same numb...
Definition ell.hpp:64
Fixed-block compressed sparse row storage matrix format.
Definition sparsity_csr.hpp:29
HYBRID is a matrix format which splits the matrix into ELLPACK and COO format.
Definition hybrid.hpp:55
Permutation is a matrix format that represents a permutation matrix, i.e.
Definition permutation.hpp:112
ScaledPermutation is a matrix combining a permutation with scaling factors.
Definition scaled_permutation.hpp:38
SELL-P is a matrix format similar to ELL format.
Definition sellp.hpp:55
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition sparsity_csr.hpp:56
This class is used for function parameters in the place of raw pointers.
Definition utils_helper.hpp:41
A range is a multidimensional view of the memory.
Definition range.hpp:297
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:1565
permute_mode
Specifies how a permutation will be applied to a matrix.
Definition permutation.hpp:42
@ 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:20
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:260
std::int32_t int32
32-bit signed integral type.
Definition types.hpp:106
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:1537
typename detail::next_precision_impl< T >::type next_precision
Obtains the next type in the singly-linked precision list with half.
Definition math.hpp:438
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:279
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:806
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:1520
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:787
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:112
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:89
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition utils_helper.hpp:173
STL namespace.
A type representing the dimensions of a multidimensional object.
Definition dim.hpp:26
This structure is used as an intermediate data type to store a sparse matrix.
Definition matrix_data.hpp:126
A span is a lightweight structure used to create sub-ranges from other ranges.
Definition range.hpp:46