  | 
  
    Ginkgo
    Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.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> 
   13 #include <ginkgo/core/base/array.hpp> 
   14 #include <ginkgo/core/base/exception_helpers.hpp> 
   15 #include <ginkgo/core/base/executor.hpp> 
   16 #include <ginkgo/core/base/lin_op.hpp> 
   17 #include <ginkgo/core/base/range_accessors.hpp> 
   18 #include <ginkgo/core/base/types.hpp> 
   19 #include <ginkgo/core/base/utils.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>
 
   40 template <
typename ValueType, 
typename IndexType>
 
   43 template <
typename ValueType, 
typename IndexType>
 
   46 template <
typename ValueType>
 
   49 template <
typename ValueType, 
typename IndexType>
 
   52 template <
typename ValueType, 
typename IndexType>
 
   55 template <
typename ValueType, 
typename IndexType>
 
   58 template <
typename ValueType, 
typename IndexType>
 
   61 template <
typename ValueType, 
typename IndexType>
 
   80 template <
typename ValueType = default_precision>
 
   82     : 
public EnableLinOp<Dense<ValueType>>,
 
   83       public ConvertibleTo<Dense<next_precision<ValueType>>>,
 
   84       public ConvertibleTo<Coo<ValueType, int32>>,
 
   85       public ConvertibleTo<Coo<ValueType, int64>>,
 
   86       public ConvertibleTo<Csr<ValueType, int32>>,
 
   87       public ConvertibleTo<Csr<ValueType, int64>>,
 
   88       public ConvertibleTo<Ell<ValueType, int32>>,
 
   89       public ConvertibleTo<Ell<ValueType, int64>>,
 
   90       public ConvertibleTo<Fbcsr<ValueType, int32>>,
 
   91       public ConvertibleTo<Fbcsr<ValueType, int64>>,
 
   92       public ConvertibleTo<Hybrid<ValueType, int32>>,
 
   93       public ConvertibleTo<Hybrid<ValueType, int64>>,
 
   94       public ConvertibleTo<Sellp<ValueType, int32>>,
 
   95       public ConvertibleTo<Sellp<ValueType, int64>>,
 
   96       public ConvertibleTo<SparsityCsr<ValueType, int32>>,
 
   97       public ConvertibleTo<SparsityCsr<ValueType, int64>>,
 
   98       public DiagonalExtractable<ValueType>,
 
   99       public ReadableFromMatrixData<ValueType, int32>,
 
  100       public ReadableFromMatrixData<ValueType, int64>,
 
  101       public WritableToMatrixData<ValueType, int32>,
 
  102       public WritableToMatrixData<ValueType, int64>,
 
  104       public Permutable<int32>,
 
  105       public Permutable<int64>,
 
  106       public EnableAbsoluteComputation<remove_complex<Dense<ValueType>>>,
 
  107       public ScaledIdentityAddable {
 
  108     friend class EnablePolymorphicObject<
Dense, 
LinOp>;
 
  109     friend class Coo<ValueType, 
int32>;
 
  110     friend class Coo<ValueType, 
int64>;
 
  111     friend class Csr<ValueType, 
int32>;
 
  112     friend class Csr<ValueType, 
int64>;
 
  113     friend class Diagonal<ValueType>;
 
  114     friend class Ell<ValueType, 
int32>;
 
  115     friend class Ell<ValueType, 
int64>;
 
  116     friend class Fbcsr<ValueType, 
int32>;
 
  117     friend class Fbcsr<ValueType, 
int64>;
 
  118     friend class Hybrid<ValueType, 
int32>;
 
  119     friend class Hybrid<ValueType, 
int64>;
 
  120     friend class Sellp<ValueType, 
int32>;
 
  121     friend class Sellp<ValueType, 
int64>;
 
  122     friend class SparsityCsr<ValueType, 
int32>;
 
  123     friend class SparsityCsr<ValueType, 
int64>;
 
  125     friend class experimental::distributed::Vector<ValueType>;
 
  130     using ConvertibleTo<Dense<next_precision<ValueType>>>::convert_to;
 
  131     using ConvertibleTo<Dense<next_precision<ValueType>>>::move_to;
 
  132     using ConvertibleTo<Coo<ValueType, int32>>::convert_to;
 
  133     using ConvertibleTo<Coo<ValueType, int32>>::move_to;
 
  134     using ConvertibleTo<Coo<ValueType, int64>>::convert_to;
 
  135     using ConvertibleTo<Coo<ValueType, int64>>::move_to;
 
  136     using ConvertibleTo<Csr<ValueType, int32>>::convert_to;
 
  137     using ConvertibleTo<Csr<ValueType, int32>>::move_to;
 
  138     using ConvertibleTo<Csr<ValueType, int64>>::convert_to;
 
  139     using ConvertibleTo<Csr<ValueType, int64>>::move_to;
 
  140     using ConvertibleTo<Ell<ValueType, int32>>::convert_to;
 
  141     using ConvertibleTo<Ell<ValueType, int32>>::move_to;
 
  142     using ConvertibleTo<Ell<ValueType, int64>>::convert_to;
 
  143     using ConvertibleTo<Ell<ValueType, int64>>::move_to;
 
  144     using ConvertibleTo<Fbcsr<ValueType, int32>>::convert_to;
 
  145     using ConvertibleTo<Fbcsr<ValueType, int32>>::move_to;
 
  146     using ConvertibleTo<Fbcsr<ValueType, int64>>::convert_to;
 
  147     using ConvertibleTo<Fbcsr<ValueType, int64>>::move_to;
 
  148     using ConvertibleTo<Hybrid<ValueType, int32>>::convert_to;
 
  149     using ConvertibleTo<Hybrid<ValueType, int32>>::move_to;
 
  150     using ConvertibleTo<Hybrid<ValueType, int64>>::convert_to;
 
  151     using ConvertibleTo<Hybrid<ValueType, int64>>::move_to;
 
  152     using ConvertibleTo<Sellp<ValueType, int32>>::convert_to;
 
  153     using ConvertibleTo<Sellp<ValueType, int32>>::move_to;
 
  154     using ConvertibleTo<Sellp<ValueType, int64>>::convert_to;
 
  155     using ConvertibleTo<Sellp<ValueType, int64>>::move_to;
 
  156     using ConvertibleTo<SparsityCsr<ValueType, int32>>::convert_to;
 
  157     using ConvertibleTo<SparsityCsr<ValueType, int32>>::move_to;
 
  158     using ConvertibleTo<SparsityCsr<ValueType, int64>>::convert_to;
 
  159     using ConvertibleTo<SparsityCsr<ValueType, int64>>::move_to;
 
  163     using value_type = ValueType;
 
  164     using index_type = 
int64;
 
  165     using transposed_type = Dense<ValueType>;
 
  166     using mat_data = matrix_data<ValueType, int64>;
 
  167     using mat_data32 = matrix_data<ValueType, int32>;
 
  168     using device_mat_data = device_matrix_data<ValueType, int64>;
 
  169     using device_mat_data32 = device_matrix_data<ValueType, int32>;
 
  170     using absolute_type = remove_complex<Dense>;
 
  171     using real_type = absolute_type;
 
  172     using complex_type = to_complex<Dense>;
 
  189         return (*other).create_with_same_config();
 
  208         return (*other).create_with_type_of_impl(exec, size, size[1]);
 
  224         return (*other).create_with_type_of_impl(exec, size, stride);
 
  242         return (*other).create_with_type_of_impl(exec, size, stride);
 
  255         return other->create_view_of_impl();
 
  268         return other->create_const_view_of_impl();
 
  333     void read(
const mat_data& data) 
override;
 
  335     void read(
const mat_data32& data) 
override;
 
  337     void read(
const device_mat_data& data) 
override;
 
  339     void read(
const device_mat_data32& data) 
override;
 
  341     void read(device_mat_data&& data) 
override;
 
  343     void read(device_mat_data32&& data) 
override;
 
  345     void write(mat_data& data) 
const override;
 
  347     void write(mat_data32& data) 
const override;
 
  349     std::unique_ptr<LinOp> 
transpose() 
const override;
 
  374     void fill(
const ValueType value);
 
  390     std::unique_ptr<Dense> 
permute(
 
  397     std::unique_ptr<Dense> 
permute(
 
  429     std::unique_ptr<Dense> 
permute(
 
  432         bool invert = 
false) 
const;
 
  438     std::unique_ptr<Dense> 
permute(
 
  441         bool invert = 
false) 
const;
 
  516         bool invert = 
false) 
const;
 
  526         bool invert = 
false) 
const;
 
  551     std::unique_ptr<LinOp> 
permute(
 
  552         const array<int32>* permutation_indices) 
const override;
 
  554     std::unique_ptr<LinOp> 
permute(
 
  555         const array<int64>* permutation_indices) 
const override;
 
  576         const array<int32>* permutation_indices) 
const override;
 
  579         const array<int64>* permutation_indices) 
const override;
 
  601         const array<int32>* permutation_indices) 
const override;
 
  604         const array<int64>* permutation_indices) 
const override;
 
  690         const array<int32>* permutation_indices) 
const override;
 
  693         const array<int64>* permutation_indices) 
const override;
 
  714         const array<int32>* permutation_indices) 
const override;
 
  717         const array<int64>* permutation_indices) 
const override;
 
  738         const array<int32>* permutation_indices) 
const override;
 
  741         const array<int64>* permutation_indices) 
const override;
 
  802     std::unique_ptr<real_type> 
get_real() 
const;
 
  813     std::unique_ptr<real_type> 
get_imag() 
const;
 
  869         return values_.
get_data()[linearize_index(row, col)];
 
  896         return values_.
get_data()[linearize_index(idx)];
 
 1102         return this->create_submatrix_impl(
rows, 
columns, stride);
 
 1143     static std::unique_ptr<Dense> 
create(std::shared_ptr<const Executor> exec,
 
 1163     static std::unique_ptr<Dense> 
create(std::shared_ptr<const Executor> exec,
 
 1172     template <
typename InputValueType>
 
 1174         "explicitly construct the gko::array argument instead of passing an" 
 1177         std::shared_ptr<const 
Executor> exec, const 
dim<2>& size,
 
 1178         std::initializer_list<InputValueType> values, 
size_type stride)
 
 1196         std::shared_ptr<const Executor> exec, 
const dim<2>& size,
 
 1197         gko::detail::const_array_view<ValueType>&& values, 
size_type stride);
 
 1226     Dense(std::shared_ptr<const Executor> exec, 
const dim<2>& size = {},
 
 1229     Dense(std::shared_ptr<const Executor> exec, 
const dim<2>& size,
 
 1238     virtual std::unique_ptr<Dense> create_with_same_config()
 const 
 1251     virtual std::unique_ptr<Dense> create_with_type_of_impl(
 
 1252         std::shared_ptr<const Executor> exec, 
const dim<2>& size,
 
 1264     virtual std::unique_ptr<Dense> create_view_of_impl()
 
 1280     virtual std::unique_ptr<const Dense> create_const_view_of_impl()
 const 
 1290     template <
typename IndexType>
 
 1291     void convert_impl(Coo<ValueType, IndexType>* result) 
const;
 
 1293     template <
typename IndexType>
 
 1294     void convert_impl(Csr<ValueType, IndexType>* result) 
const;
 
 1296     template <
typename IndexType>
 
 1297     void convert_impl(Ell<ValueType, IndexType>* result) 
const;
 
 1299     template <
typename IndexType>
 
 1300     void convert_impl(Fbcsr<ValueType, IndexType>* result) 
const;
 
 1302     template <
typename IndexType>
 
 1303     void convert_impl(Hybrid<ValueType, IndexType>* result) 
const;
 
 1305     template <
typename IndexType>
 
 1306     void convert_impl(Sellp<ValueType, IndexType>* result) 
const;
 
 1308     template <
typename IndexType>
 
 1309     void convert_impl(SparsityCsr<ValueType, IndexType>* result) 
const;
 
 1317     virtual void scale_impl(
const LinOp* alpha);
 
 1325     virtual void inv_scale_impl(
const LinOp* alpha);
 
 1333     virtual void add_scaled_impl(
const LinOp* alpha, 
const LinOp* b);
 
 1341     virtual void sub_scaled_impl(
const LinOp* alpha, 
const LinOp* b);
 
 1349     virtual void compute_dot_impl(
const LinOp* b, 
LinOp* result) 
const;
 
 1357     virtual void compute_conj_dot_impl(
const LinOp* b, 
LinOp* result) 
const;
 
 1365     virtual void compute_norm2_impl(
LinOp* result) 
const;
 
 1373     virtual void compute_norm1_impl(
LinOp* result) 
const;
 
 1381     virtual void compute_squared_norm2_impl(
LinOp* result) 
const;
 
 1386     virtual void compute_mean_impl(
LinOp* result) 
const;
 
 1405     virtual std::unique_ptr<Dense> create_submatrix_impl(
 
 1408     void apply_impl(
const LinOp* b, 
LinOp* x) 
const override;
 
 1410     void apply_impl(
const LinOp* alpha, 
const LinOp* b, 
const LinOp* beta,
 
 1411                     LinOp* x) 
const override;
 
 1415         return row * stride_ + col;
 
 1420         return linearize_index(idx / this->
get_size()[1],
 
 1424     template <
typename IndexType>
 
 1425     void permute_impl(
const Permutation<IndexType>* permutation,
 
 1428     template <
typename IndexType>
 
 1429     void permute_impl(
const Permutation<IndexType>* row_permutation,
 
 1430                       const Permutation<IndexType>* col_permutation,
 
 1431                       bool invert, 
Dense* output) 
const;
 
 1433     template <
typename IndexType>
 
 1434     void scale_permute_impl(
 
 1435         const ScaledPermutation<ValueType, IndexType>* permutation,
 
 1438     template <
typename IndexType>
 
 1439     void scale_permute_impl(
 
 1440         const ScaledPermutation<ValueType, IndexType>* row_permutation,
 
 1441         const ScaledPermutation<ValueType, IndexType>* column_permutation,
 
 1442         bool invert, 
Dense* output) 
const;
 
 1444     template <
typename OutputType, 
typename IndexType>
 
 1445     void row_gather_impl(
const array<IndexType>* row_idxs,
 
 1446                          Dense<OutputType>* row_collection) 
const;
 
 1448     template <
typename OutputType, 
typename IndexType>
 
 1449     void row_gather_impl(
const Dense<ValueType>* alpha,
 
 1450                          const array<IndexType>* row_idxs,
 
 1451                          const Dense<ValueType>* beta,
 
 1452                          Dense<OutputType>* row_collection) 
const;
 
 1456     array<value_type> values_;
 
 1458     void add_scaled_identity_impl(
const LinOp* a, 
const LinOp* b) 
override;
 
 1468 template <
typename ValueType>
 
 1469 struct temporary_clone_helper<matrix::Dense<ValueType>> {
 
 1470     static std::unique_ptr<matrix::Dense<ValueType>> create(
 
 1471         std::shared_ptr<const Executor> exec, matrix::Dense<ValueType>* ptr,
 
 1493 template <
typename VecPtr>
 
 1494 std::unique_ptr<matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
 
 1497     using value_type = 
typename detail::pointee<VecPtr>::value_type;
 
 1509 template <
typename VecPtr>
 
 1511     const matrix::Dense<typename detail::pointee<VecPtr>::value_type>>
 
 1514     using value_type = 
typename detail::pointee<VecPtr>::value_type;
 
 1539 template <
typename Matrix, 
typename... TArgs>
 
 1541     size_type stride, std::initializer_list<typename Matrix::value_type> vals,
 
 1542     std::shared_ptr<const Executor> exec, TArgs&&... create_args)
 
 1546     auto tmp = dense::create(exec->get_master(), 
dim<2>{num_rows, 1}, stride);
 
 1548     for (
const auto& elem : vals) {
 
 1549         tmp->
at(idx) = elem;
 
 1552     auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
 
 1577 template <
typename Matrix, 
typename... TArgs>
 
 1579     std::initializer_list<typename Matrix::value_type> vals,
 
 1580     std::shared_ptr<const Executor> exec, TArgs&&... create_args)
 
 1582     return initialize<Matrix>(1, vals, std::move(exec),
 
 1583                               std::forward<TArgs>(create_args)...);
 
 1607 template <
typename Matrix, 
typename... TArgs>
 
 1610     std::initializer_list<std::initializer_list<typename Matrix::value_type>>
 
 1612     std::shared_ptr<const Executor> exec, TArgs&&... create_args)
 
 1616     size_type num_cols = num_rows > 0 ? begin(vals)->size() : 1;
 
 1618         dense::create(exec->get_master(), 
dim<2>{num_rows, num_cols}, stride);
 
 1620     for (
const auto& row : vals) {
 
 1622         for (
const auto& elem : row) {
 
 1623             tmp->
at(ridx, cidx) = elem;
 
 1628     auto mtx = Matrix::create(exec, std::forward<TArgs>(create_args)...);
 
 1655 template <
typename Matrix, 
typename... TArgs>
 
 1657     std::initializer_list<std::initializer_list<typename Matrix::value_type>>
 
 1659     std::shared_ptr<const Executor> exec, TArgs&&... create_args)
 
 1661     return initialize<Matrix>(vals.size() > 0 ? begin(vals)->size() : 0, vals,
 
 1663                               std::forward<TArgs>(create_args)...);
 
 1670 #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
 
void move_to(result_type *result) override
Definition: polymorphic_object.hpp:732
 
void convert_to(result_type *result) const override
Definition: polymorphic_object.hpp:730
 
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition: matrix.hpp:27
 
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:20
 
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:902
 
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:219
 
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:37
 
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:108
 
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: permutation.hpp:112
 
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:807
 
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:1098
 
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:182
 
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:1540
 
value_type & at(size_type row, size_type col) noexcept
Returns a single element of the matrix.
Definition: dense.hpp:867
 
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition: utils_helper.hpp:175
 
size_type get_stride() const noexcept
Returns the stride of the matrix.
Definition: dense.hpp:845
 
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:253
 
A range is a multidimensional view of the memory.
Definition: range.hpp:298
 
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:852
 
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:826
 
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition: array.hpp:27
 
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:203
 
A span is a lightweight structure used to create sub-ranges from other ranges.
Definition: range.hpp:47
 
This class is a utility which efficiently implements the diagonal matrix (a linear operator which sca...
Definition: lin_op.hpp:32
 
typename detail::next_precision_impl< T >::type next_precision
Obtains the next type in the singly-linked precision list.
Definition: math.hpp:462
 
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:875
 
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition: array.hpp:674
 
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:237
 
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:835
 
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:788
 
std::unique_ptr< Diagonal< ValueType > > extract_diagonal() const override
Extracts the diagonal entries of the matrix into a vector.
 
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.
 
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:265
 
ValueType & at(size_type idx) noexcept
Returns a single element of the matrix.
Definition: dense.hpp:894
 
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:131
 
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
 
std::unique_ptr< Dense > create_submatrix(const span &rows, const span &columns)
Create a submatrix from the original matrix.
Definition: dense.hpp:1111
 
std::int32_t int32
32-bit signed integral type.
Definition: types.hpp:125
 
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:1495
 
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:32
 
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:683
 
permute_mode
Specifies how a permutation will be applied to a matrix.
Definition: permutation.hpp:43
 
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:1512
 
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition: polymorphic_object.hpp:235
 
size_type get_size() const noexcept
Returns the number of elements in the array.
Definition: array.hpp:657
 
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition: lin_op.hpp:211
 
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:345
 
COO stores a matrix in the coordinate matrix format.
Definition: coo.hpp:50