24#ifndef MORPHEUS_DYNAMICMATRIX_IMPL_HPP
25#define MORPHEUS_DYNAMICMATRIX_IMPL_HPP
29#include <Morpheus_Exceptions.hpp>
30#include <Morpheus_FormatsRegistry.hpp>
31#include <Morpheus_ContainerTraits.hpp>
37template <
class ValueType,
class... Properties>
45 using result_type = void;
48 template <
typename... Args>
49 result_type operator()(
50 typename CooMatrix<ValueType, Properties...>::type &mat,
51 const size_type nrows,
const size_type ncols,
const size_type nnnz) {
52 mat.
resize(nrows, ncols, nnnz);
56 template <
typename... Args>
57 result_type operator()(
59 const size_type nrows,
const size_type ncols,
const size_type nnnz) {
60 mat.
resize(nrows, ncols, nnnz);
64 template <
typename... Args>
65 result_type operator()(
67 const size_type nrows,
const size_type ncols,
const size_type nnnz,
68 const size_type ndiag,
const size_type alignment = 32) {
69 mat.
resize(nrows, ncols, nnnz, ndiag, alignment);
74 template <
typename... Args>
75 result_type operator()(
76 typename CooMatrix<ValueType, Properties...>::type &mat, Args &&...) {
78 "Invalid use of the dynamic resize interface for current format (" +
82 template <
typename... Args>
83 result_type operator()(
86 "Invalid use of the dynamic resize interface for current format (" +
90 template <
typename... Args>
91 result_type operator()(
94 "Invalid use of the dynamic resize interface for current format (" +
100 using result_type = void;
102 template <
typename T1,
typename T2>
103 result_type operator()(
104 const T1 &src, T2 &dst,
110 template <
typename T1,
typename T2>
111 result_type operator()(
112 const T1 &src, T2 &dst,
116 "Invalid use of the dynamic resize interface. Src and dst tags must be "
118 std::to_string(src.format_index()) +
119 " != " + std::to_string(dst.format_index()) +
")");
124 using result_type = void;
126 template <
typename T1,
typename T2>
127 result_type operator()(
128 const T1 &src, T2 &dst,
131 dst = T2().allocate(src);
134 template <
typename T1,
typename T2>
135 result_type operator()(
136 const T1 &src, T2 &dst,
140 "Invalid use of the dynamic allocate interface. Src and std tags must "
142 std::to_string(src.format_index()) +
143 " != " + std::to_string(dst.format_index()) +
")");
148 using result_type = void;
150 template <
typename T1,
typename T2>
151 result_type operator()(
152 const T1 &src, T2 &dst,
158 template <
typename T1,
typename T2>
159 result_type operator()(
160 const T1 &src, T2 &dst,
164 "Invalid use of the dynamic assign interface. Src and dst tags must be "
166 std::to_string(src.format_index()) +
167 " != " + std::to_string(dst.format_index()) +
")");
171template <
size_t I,
class ValueType,
typename... Properties>
176 static void activate(variant &A,
size_t idx) {
178 A =
typename type_list::template type<I - 1>{};
186template <
class ValueType,
typename... Properties>
191 static void activate(variant &A,
size_t idx) {
void resize(const size_type num_rows, const size_type num_cols, const size_type num_entries)
Resizes CooMatrix with shape of (num_rows, num_cols) and sets number of non-zero entries to num_entri...
Definition: Morpheus_CooMatrix.hpp:363
int format_index() const
Returns the equivalent index to the format enum assigned to the CooMatrix container.
Definition: Morpheus_CooMatrix.hpp:441
typename traits::type type
Definition: Morpheus_CsrMatrix.hpp:96
typename traits::type type
Definition: Morpheus_DiaMatrix.hpp:102
Definition: Morpheus_Exceptions.hpp:57
Generic Morpheus interfaces.
Definition: dummy.cpp:24
Traits class for accessing attributes of a Container (Matrix or Vector)
Definition: Morpheus_ContainerTraits.hpp:54
size_t size_type
The size type of the container.
Definition: Morpheus_ContainerTraits.hpp:103
ValueType value_type
The type of values held by the container.
Definition: Morpheus_ContainerTraits.hpp:91
Definition: Morpheus_DynamicMatrix_Impl.hpp:172
Definition: Morpheus_DynamicMatrix_Impl.hpp:123
Definition: Morpheus_DynamicMatrix_Impl.hpp:147
Definition: Morpheus_DynamicMatrix_Impl.hpp:99
Definition: Morpheus_DynamicMatrix_Impl.hpp:40
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85