24#ifndef MORPHEUS_DENSEVECTOR_SERIAL_DOT_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_SERIAL_DOT_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_SERIAL)
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
38template <
typename ExecSpace,
typename Vector1,
typename Vector2>
39inline typename Vector2::value_type dot(
40 typename Vector1::size_type n,
const Vector1& x,
const Vector2& y,
41 typename std::enable_if_t<
42 Morpheus::is_dense_vector_format_container_v<Vector1> &&
43 Morpheus::is_dense_vector_format_container_v<Vector2> &&
44 Morpheus::has_custom_backend_v<ExecSpace> &&
45 Morpheus::has_serial_execution_space_v<ExecSpace> &&
46 Morpheus::has_access_v<ExecSpace, Vector1, Vector2>>* =
nullptr) {
47 using size_type =
typename Vector1::size_type;
48 using value_type =
typename Vector1::non_const_value_type;
50 value_type result = value_type(0);
52 if (y.data() == x.data()) {
53 for (size_type i = 0; i < n; i++) result += x[i] * x[i];
55 for (size_type i = 0; i < n; i++) result += x[i] * y[i];
Generic Morpheus interfaces.
Definition: dummy.cpp:24