Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Dynamic/Morpheus_MatrixOperations_Impl.hpp
1
24#ifndef MORPHEUS_DYNAMIC_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_DYNAMIC_MATRIXOPERATIONS_IMPL_HPP
26
27#include <Morpheus_FormatTags.hpp>
28
29#include <impl/Morpheus_MatrixOperations_Impl.hpp>
30#include <impl/Morpheus_Variant.hpp>
31
32namespace Morpheus {
33namespace Impl {
34template <typename ExecSpace, typename Matrix, typename Vector>
35inline void update_diagonal(
36 Matrix& A, const Vector& diagonal,
37 typename std::enable_if<
40 nullptr) {
41 Impl::Variant::visit(
42 [&](auto&& arg) { Impl::update_diagonal<ExecSpace>(arg, diagonal); },
43 A.formats());
44}
45
46template <typename ExecSpace, typename Matrix, typename Vector>
47inline void get_diagonal(
48 const Matrix& A, Vector& diagonal,
49 typename std::enable_if<
52 nullptr) {
53 Impl::Variant::visit(
54 [&](auto&& arg) { Impl::get_diagonal<ExecSpace>(arg, diagonal); },
55 A.const_formats());
56}
57
58template <typename ExecSpace, typename Matrix, typename SizeType,
59 typename ValueType>
60inline void set_value(
61 Matrix& A, SizeType row, SizeType col, ValueType value,
62 typename std::enable_if<
64 nullptr) {
65 Impl::Variant::visit(
66 [&](auto&& arg) { Impl::set_value<ExecSpace>(arg, row, col, value); },
67 A.formats());
68}
69
70template <typename ExecSpace, typename Matrix, typename IndexVector,
71 typename ValueVector>
72inline void set_values(
73 Matrix& A, typename IndexVector::value_type m, const IndexVector idxm,
74 typename IndexVector::value_type n, const IndexVector idxn,
75 ValueVector values,
76 typename std::enable_if<
80 nullptr) {
81 Impl::Variant::visit(
82 [&](auto&& arg) {
83 Impl::set_value<ExecSpace>(arg, m, idxm, n, idxn, values);
84 },
85 A.formats());
86}
87
88template <typename ExecSpace, typename Matrix, typename TransposeMatrix>
89inline void transpose(
90 const Matrix& A, TransposeMatrix& At,
91 typename std::enable_if<
94 nullptr) {
95 Impl::Variant::visit([&](auto&& arg) { Impl::transpose<ExecSpace>(arg, At); },
96 A.const_formats());
97}
98
99template <typename ExecSpace, typename Matrix, typename TransposeMatrix>
100inline void transpose(
101 const Matrix& A, TransposeMatrix& At,
102 typename std::enable_if<
105 type* = nullptr) {
106 Impl::Variant::visit(
107 [&](auto&& arg1, auto&& arg2) { Impl::transpose<ExecSpace>(arg1, arg2); },
108 A.const_formats(), At.formats());
109}
110
111} // namespace Impl
112} // namespace Morpheus
113
114#endif // MORPHEUS_DYNAMIC_MATRIXOPERATIONS_IMPL_HPP
Checks if the given type T is a valid Dense Vector Format Container i.e is valid vector container and...
Definition: Morpheus_FormatTags.hpp:273
Checks if the given type T is a valid Dynamic Matrix Format Container i.e is valid matrix container a...
Definition: Morpheus_FormatTags.hpp:201
A valid Sparse Matrix container is the one that has a valid Sparse Matrix tag i.e satisfies the has_s...
Definition: Morpheus_FormatTraits.hpp:85
Generic Morpheus interfaces.
Definition: dummy.cpp:24