24#ifndef MORPHEUS_CSR_KOKKOS_MULTIPLY_IMPL_HPP
25#define MORPHEUS_CSR_KOKKOS_MULTIPLY_IMPL_HPP
27#include <Morpheus_SpaceTraits.hpp>
28#include <Morpheus_FormatTraits.hpp>
29#include <Morpheus_FormatTags.hpp>
30#include <Morpheus_Spaces.hpp>
35template <
typename ExecSpace,
typename Matrix,
typename Vector>
37 const Matrix& A,
const Vector& x, Vector& y,
const bool init,
38 typename std::enable_if_t<
39 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
40 Morpheus::is_dense_vector_format_container_v<Vector> &&
41 Morpheus::has_generic_backend_v<ExecSpace> &&
42 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
43 using execution_space =
typename ExecSpace::execution_space;
44 using size_type =
typename Matrix::size_type;
45 using policy_index_type = Kokkos::IndexType<size_type>;
46 using range_policy = Kokkos::RangePolicy<policy_index_type, execution_space>;
47 using value_array =
typename Matrix::value_array_type::value_array_type;
48 using index_array =
typename Matrix::index_array_type::value_array_type;
49 using value_type =
typename value_array::value_type;
50 using index_type =
typename index_array::value_type;
52 const value_array values = A.cvalues().const_view(), x_view = x.const_view();
53 const index_array column_indices = A.ccolumn_indices().const_view(),
54 row_offsets = A.crow_offsets().const_view();
55 value_array y_view = y.view();
57 range_policy policy(0, A.nrows());
60 policy, KOKKOS_LAMBDA(
const size_type i) {
61 value_type sum = init ? value_type(0) : y_view[i];
62 for (index_type jj = row_offsets[i]; jj < row_offsets[i + 1]; jj++) {
63 sum += values[jj] * x_view[column_indices[jj]];
Generic Morpheus interfaces.
Definition: dummy.cpp:24