42 #ifndef KOKKOS_INNER_PRODUCT_SPACE_TRAITS_MP_VECTOR_HPP
43 #define KOKKOS_INNER_PRODUCT_SPACE_TRAITS_MP_VECTOR_HPP
45 #include "Sacado_ConfigDefs.h"
46 #if defined(HAVE_STOKHOS_ENSEMBLE_REDUCT)
49 #include "Kokkos_InnerProductSpaceTraits.hpp"
61 class InnerProductSpaceTraits<
Sacado::MP::Vector<S> > {
67 typedef InnerProductSpaceTraits<base_value_type> BIT;
68 typedef typename BIT::dot_type base_dot_type;
70 typedef typename ArithTraits<val_type>::mag_type mag_type;
71 typedef base_dot_type dot_type;
73 static KOKKOS_FORCEINLINE_FUNCTION
74 mag_type norm (
const val_type&
x) {
77 mag_type nrm = mag_type(0);
79 const mag_type
n = BIT::norm(
x.fastAccessCoeff(i) );
85 static KOKKOS_FORCEINLINE_FUNCTION
86 dot_type
dot (
const val_type&
x,
const val_type&
y) {
91 dot_type r = dot_type(0);
92 if (
x.hasFastAccess(sz) &&
y.hasFastAccess(sz))
94 r +=
BIT::dot(
x.fastAccessCoeff(i),
y.fastAccessCoeff(i) );
104 template <
typename S>
105 class InnerProductSpaceTraits< const
Sacado::MP::Vector<S> > {
111 typedef InnerProductSpaceTraits<base_value_type> BIT;
112 typedef typename BIT::dot_type base_dot_type;
114 typedef typename ArithTraits<val_type>::mag_type mag_type;
115 typedef base_dot_type dot_type;
117 static KOKKOS_FORCEINLINE_FUNCTION
118 mag_type norm (
const val_type&
x) {
121 mag_type nrm = mag_type(0);
123 const mag_type
n = BIT::norm(
x.fastAccessCoeff(i) );
129 static KOKKOS_FORCEINLINE_FUNCTION
130 dot_type
dot (
const val_type&
x,
const val_type&
y) {
135 dot_type r = dot_type(0);
136 if (
x.hasFastAccess(sz) &&
y.hasFastAccess(sz))
138 r +=
BIT::dot(
x.fastAccessCoeff(i),
y.fastAccessCoeff(i) );