24#ifndef MORPHEUS_CSR_OPENMP_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_CSR_OPENMP_MATRIXOPERATIONS_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_OPENMP)
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_openmp_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#pragma omp parallel for
52 for (size_type i = 0; i < A.nrows(); ++i) {
53 for (index_type jj = A.row_offsets(i); jj < A.row_offsets(i + 1); jj++) {
54 if (A.column_indices(jj) == (index_type)i) {
55 A.values(jj) = diagonal[i];
62template <
typename ExecSpace,
typename Matrix,
typename Vector>
64 Matrix&,
const Vector&,
65 typename std::enable_if_t<
66 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
67 Morpheus::is_dense_vector_format_container_v<Vector> &&
68 Morpheus::has_custom_backend_v<ExecSpace> &&
69 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
70 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
74template <
typename ExecSpace,
typename Matrix,
typename SizeType,
76void set_value(Matrix&, SizeType, SizeType, ValueType,
77 typename std::enable_if_t<
78 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
79 Morpheus::has_custom_backend_v<ExecSpace> &&
80 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
81 Morpheus::has_access_v<ExecSpace, Matrix>>* =
nullptr) {
85template <
typename ExecSpace,
typename Matrix,
typename IndexVector,
88 Matrix&,
typename IndexVector::value_type,
const IndexVector,
89 typename IndexVector::value_type,
const IndexVector,
const ValueVector,
90 typename std::enable_if_t<
91 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
92 Morpheus::is_dense_vector_format_container_v<IndexVector> &&
93 Morpheus::is_dense_vector_format_container_v<ValueVector> &&
94 Morpheus::has_custom_backend_v<ExecSpace> &&
95 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
96 Morpheus::has_access_v<ExecSpace, Matrix, IndexVector, ValueVector>>* =
101template <
typename ExecSpace,
typename Matrix,
typename TransposeMatrix>
103 const Matrix&, TransposeMatrix&,
104 typename std::enable_if_t<
105 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
106 Morpheus::is_csr_matrix_format_container_v<TransposeMatrix> &&
107 Morpheus::has_custom_backend_v<ExecSpace> &&
108 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
109 Morpheus::has_access_v<ExecSpace, Matrix, TransposeMatrix>>* =
Definition: Morpheus_Exceptions.hpp:43
Generic Morpheus interfaces.
Definition: dummy.cpp:24