24#ifndef MORPHEUS_CSR_SERIAL_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_CSR_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_csr_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;
49 using index_type =
typename Matrix::index_type;
51 for (size_type i = 0; i < A.nrows(); ++i) {
52 for (index_type jj = A.row_offsets(i); jj < A.row_offsets(i + 1); jj++) {
53 if (A.column_indices(jj) == (index_type)i) {
54 A.values(jj) = diagonal[i];
61template <
typename ExecSpace,
typename Matrix,
typename Vector>
63 Matrix&,
const Vector&,
64 typename std::enable_if_t<
65 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
66 Morpheus::is_dense_vector_format_container_v<Vector> &&
67 Morpheus::has_custom_backend_v<ExecSpace> &&
68 Morpheus::has_serial_execution_space_v<ExecSpace> &&
69 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
73template <
typename ExecSpace,
typename Matrix,
typename SizeType,
75void set_value(Matrix&, SizeType, SizeType, ValueType,
76 typename std::enable_if_t<
77 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
78 Morpheus::has_custom_backend_v<ExecSpace> &&
79 Morpheus::has_serial_execution_space_v<ExecSpace> &&
80 Morpheus::has_access_v<ExecSpace, Matrix>>* =
nullptr) {
84template <
typename ExecSpace,
typename Matrix,
typename IndexVector,
87 Matrix&,
typename IndexVector::value_type,
const IndexVector,
88 typename IndexVector::value_type,
const IndexVector,
const ValueVector,
89 typename std::enable_if_t<
90 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
91 Morpheus::is_dense_vector_format_container_v<IndexVector> &&
92 Morpheus::is_dense_vector_format_container_v<ValueVector> &&
93 Morpheus::has_custom_backend_v<ExecSpace> &&
94 Morpheus::has_serial_execution_space_v<ExecSpace> &&
95 Morpheus::has_access_v<ExecSpace, Matrix, IndexVector, ValueVector>>* =
100template <
typename ExecSpace,
typename Matrix,
typename TransposeMatrix>
102 const Matrix&, TransposeMatrix&,
103 typename std::enable_if_t<
104 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
105 Morpheus::is_csr_matrix_format_container_v<TransposeMatrix> &&
106 Morpheus::has_custom_backend_v<ExecSpace> &&
107 Morpheus::has_serial_execution_space_v<ExecSpace> &&
108 Morpheus::has_access_v<ExecSpace, Matrix, TransposeMatrix>>* =
Definition: Morpheus_Exceptions.hpp:43
Generic Morpheus interfaces.
Definition: dummy.cpp:24