24#ifndef MORPHEUS_COO_SERIAL_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_COO_SERIAL_MATRIXOPERATIONS_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_SERIAL)
30#include <Morpheus_Exceptions.hpp>
31#include <Morpheus_SpaceTraits.hpp>
32#include <Morpheus_FormatTraits.hpp>
33#include <Morpheus_FormatTags.hpp>
34#include <Morpheus_Spaces.hpp>
39template <
typename ExecSpace,
typename Matrix,
typename Vector>
41 Matrix& A,
const Vector& diagonal,
42 typename std::enable_if_t<
43 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
44 Morpheus::is_dense_vector_format_container_v<Vector> &&
45 Morpheus::has_custom_backend_v<ExecSpace> &&
46 Morpheus::has_serial_execution_space_v<ExecSpace> &&
47 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
48 using size_type =
typename Matrix::size_type;
50 for (size_type n = 0; n < A.nnnz(); n++) {
51 if (A.row_indices(n) == A.column_indices(n)) {
52 A.values(n) = diagonal[A.column_indices(n)];
57template <
typename ExecSpace,
typename Matrix,
typename Vector>
59 Matrix&,
const Vector&,
60 typename std::enable_if_t<
61 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
62 Morpheus::is_dense_vector_format_container_v<Vector> &&
63 Morpheus::has_custom_backend_v<ExecSpace> &&
64 Morpheus::has_serial_execution_space_v<ExecSpace> &&
65 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
69template <
typename ExecSpace,
typename Matrix,
typename SizeType,
71void set_value(Matrix&, SizeType, SizeType, ValueType,
72 typename std::enable_if_t<
73 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
74 Morpheus::has_custom_backend_v<ExecSpace> &&
75 Morpheus::has_serial_execution_space_v<ExecSpace> &&
76 Morpheus::has_access_v<ExecSpace, Matrix>>* =
nullptr) {
80template <
typename ExecSpace,
typename Matrix,
typename IndexVector,
83 Matrix&,
typename IndexVector::value_type,
const IndexVector,
84 typename IndexVector::value_type,
const IndexVector,
const ValueVector,
85 typename std::enable_if_t<
86 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
87 Morpheus::is_dense_vector_format_container_v<IndexVector> &&
88 Morpheus::is_dense_vector_format_container_v<ValueVector> &&
89 Morpheus::has_custom_backend_v<ExecSpace> &&
90 Morpheus::has_serial_execution_space_v<ExecSpace> &&
91 Morpheus::has_access_v<ExecSpace, Matrix, IndexVector, ValueVector>>* =
96template <
typename ExecSpace,
typename Matrix,
typename TransposeMatrix>
98 const Matrix&, TransposeMatrix&,
99 typename std::enable_if_t<
100 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
101 Morpheus::is_coo_matrix_format_container_v<TransposeMatrix> &&
102 Morpheus::has_custom_backend_v<ExecSpace> &&
103 Morpheus::has_serial_execution_space_v<ExecSpace> &&
104 Morpheus::has_access_v<ExecSpace, Matrix, TransposeMatrix>>* =
Definition: Morpheus_Exceptions.hpp:43
Generic Morpheus interfaces.
Definition: dummy.cpp:24