24#ifndef MORPHEUS_COO_KOKKOS_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_COO_KOKKOS_MATRIXOPERATIONS_IMPL_HPP
27#include <Morpheus_Exceptions.hpp>
28#include <Morpheus_SpaceTraits.hpp>
29#include <Morpheus_FormatTraits.hpp>
30#include <Morpheus_FormatTags.hpp>
31#include <Morpheus_Spaces.hpp>
36template <
typename ExecSpace,
typename Matrix,
typename Vector>
38 Matrix& A,
const Vector& diagonal,
39 typename std::enable_if_t<
40 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
41 Morpheus::is_dense_vector_format_container_v<Vector> &&
42 Morpheus::has_generic_backend_v<ExecSpace> &&
43 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
44 using execution_space =
typename ExecSpace::execution_space;
45 using size_type =
typename Matrix::size_type;
46 using value_array =
typename Matrix::value_array_type::value_array_type;
47 using index_array =
typename Matrix::index_array_type::value_array_type;
50 Kokkos::RangePolicy<Kokkos::IndexType<size_type>, execution_space>;
52 value_array values = A.values().view();
53 index_array column_indices = A.column_indices().view();
54 index_array row_indices = A.row_indices().view();
55 const value_array diagonal_view = diagonal.const_view();
57 range_policy policy(0, A.nnnz());
60 policy, KOKKOS_LAMBDA(
const size_type i) {
61 if (row_indices[i] == column_indices[i])
62 values[i] = diagonal_view[column_indices[i]];
66template <
typename ExecSpace,
typename Matrix,
typename Vector>
68 Matrix&,
const Vector&,
69 typename std::enable_if_t<
70 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
71 Morpheus::is_dense_vector_format_container_v<Vector> &&
72 Morpheus::has_generic_backend_v<ExecSpace> &&
73 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
77template <
typename ExecSpace,
typename Matrix,
typename SizeType,
79void set_value(Matrix&, SizeType, SizeType, ValueType,
80 typename std::enable_if_t<
81 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
82 Morpheus::has_generic_backend_v<ExecSpace> &&
83 Morpheus::has_access_v<ExecSpace, Matrix>>* =
nullptr) {
87template <
typename ExecSpace,
typename Matrix,
typename IndexVector,
90 Matrix&,
typename IndexVector::value_type,
const IndexVector,
91 typename IndexVector::value_type,
const IndexVector,
const ValueVector,
92 typename std::enable_if_t<
93 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
94 Morpheus::is_dense_vector_format_container_v<IndexVector> &&
95 Morpheus::is_dense_vector_format_container_v<ValueVector> &&
96 Morpheus::has_generic_backend_v<ExecSpace> &&
97 Morpheus::has_access_v<ExecSpace, Matrix, IndexVector, ValueVector>>* =
102template <
typename ExecSpace,
typename Matrix,
typename TransposeMatrix>
104 const Matrix&, TransposeMatrix&,
105 typename std::enable_if_t<
106 Morpheus::is_coo_matrix_format_container_v<Matrix> &&
107 Morpheus::is_coo_matrix_format_container_v<TransposeMatrix> &&
108 Morpheus::has_generic_backend_v<ExecSpace> &&
109 Morpheus::has_access_v<ExecSpace, Matrix, TransposeMatrix>>* =
Definition: Morpheus_Exceptions.hpp:43
Generic Morpheus interfaces.
Definition: dummy.cpp:24