24#ifndef MORPHEUS_DENSEVECTOR_OPENMP_WAXPBY_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_OPENMP_WAXPBY_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_OPENMP)
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
40template <
typename ExecSpace,
typename Vector1,
typename Vector2,
43 const typename Vector1::size_type n,
44 const typename Vector1::value_type alpha,
const Vector1& x,
45 const typename Vector2::value_type beta,
const Vector2& y, Vector3& w,
46 typename std::enable_if_t<
47 Morpheus::is_dense_vector_format_container_v<Vector1> &&
48 Morpheus::is_dense_vector_format_container_v<Vector2> &&
49 Morpheus::is_dense_vector_format_container_v<Vector3> &&
50 Morpheus::has_custom_backend_v<ExecSpace> &&
51 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
52 Morpheus::has_access_v<ExecSpace, Vector1, Vector2, Vector3>>* =
54 using size_type =
typename Vector1::size_type;
56 assert(x.size() >= n);
57 assert(y.size() >= n);
58 assert(w.size() >= n);
61#pragma omp parallel for
62 for (size_type i = 0; i < n; i++) w[i] = x[i] + beta * y[i];
63 }
else if (beta == 1.0) {
64#pragma omp parallel for
65 for (size_type i = 0; i < n; i++) w[i] = alpha * x[i] + y[i];
67#pragma omp parallel for
68 for (size_type i = 0; i < n; i++) w[i] = alpha * x[i] + beta * y[i];
Generic Morpheus interfaces.
Definition: dummy.cpp:24