24#ifndef MORPHEUS_DIA_OPENMP_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_DIA_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_dia_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;
50 using value_type =
typename Matrix::value_type;
52 const size_type ndiag = A.values().ncols();
54#pragma omp parallel for
55 for (size_type row = 0; row < A.nrows(); row++) {
56 for (size_type n = 0; n < ndiag; n++) {
57 const index_type col = row + A.diagonal_offsets(n);
59 if ((col >= 0 && col < (index_type)A.ncols()) &&
60 (col == (index_type)row)) {
62 (A.values(row, n) == value_type(0)) ? 0 : diagonal[col];
68template <
typename ExecSpace,
typename Matrix,
typename Vector>
70 Matrix&,
const Vector&,
71 typename std::enable_if_t<
72 Morpheus::is_dia_matrix_format_container_v<Matrix> &&
73 Morpheus::is_dense_vector_format_container_v<Vector> &&
74 Morpheus::has_custom_backend_v<ExecSpace> &&
75 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
76 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
80template <
typename ExecSpace,
typename Matrix,
typename SizeType,
82void set_value(Matrix&, SizeType, SizeType, ValueType,
83 typename std::enable_if_t<
84 Morpheus::is_dia_matrix_format_container_v<Matrix> &&
85 Morpheus::has_custom_backend_v<ExecSpace> &&
86 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
87 Morpheus::has_access_v<ExecSpace, Matrix>>* =
nullptr) {
91template <
typename ExecSpace,
typename Matrix,
typename IndexVector,
94 Matrix&,
typename IndexVector::value_type,
const IndexVector,
95 typename IndexVector::value_type,
const IndexVector,
const ValueVector,
96 typename std::enable_if_t<
97 Morpheus::is_dia_matrix_format_container_v<Matrix> &&
98 Morpheus::is_dense_vector_format_container_v<IndexVector> &&
99 Morpheus::is_dense_vector_format_container_v<ValueVector> &&
100 Morpheus::has_custom_backend_v<ExecSpace> &&
101 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
102 Morpheus::has_access_v<ExecSpace, Matrix, IndexVector, ValueVector>>* =
107template <
typename ExecSpace,
typename Matrix,
typename TransposeMatrix>
109 const Matrix&, TransposeMatrix&,
110 typename std::enable_if_t<
111 Morpheus::is_dia_matrix_format_container_v<Matrix> &&
112 Morpheus::is_dia_matrix_format_container_v<TransposeMatrix> &&
113 Morpheus::has_custom_backend_v<ExecSpace> &&
114 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
115 Morpheus::has_access_v<ExecSpace, Matrix, TransposeMatrix>>* =
Definition: Morpheus_Exceptions.hpp:43
Generic Morpheus interfaces.
Definition: dummy.cpp:24