OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
VectorMath.h
Go to the documentation of this file.
1#ifndef OPALX_VECTOR_MATH_H
2#define OPALX_VECTOR_MATH_H
3
4#include "Ippl.h"
5
6#include <utility>
7
8template <typename T, unsigned Dim>
9using Vector_t = ippl::Vector<T, Dim>;
10
11using VectorPair_t = std::pair<Vector_t<double, 3>, Vector_t<double, 3>>;
12
13// Euclidean norm for OPALX/IPPL vectors.
14template <class T, unsigned D>
15KOKKOS_INLINE_FUNCTION double euclidean_norm(const Vector_t<T, D>& v) {
16 return Kokkos::sqrt(v.dot(v));
17}
18
19// Scalar product between two OPALX/IPPL vectors.
20template <class T, unsigned D>
21KOKKOS_INLINE_FUNCTION double dot(const Vector_t<T, D>& v, const Vector_t<T, D>& w) {
22 return v.dot(w);
23}
24
25// Squared Euclidean norm for OPALX/IPPL vectors.
26template <class T, unsigned D>
27KOKKOS_INLINE_FUNCTION double dot(const Vector_t<T, D>& v) {
28 return v.dot(v);
29}
30
31#endif
std::pair< Vector_t< double, 3 >, Vector_t< double, 3 > > VectorPair_t
ippl::Vector< T, Dim > Vector_t
KOKKOS_INLINE_FUNCTION double dot(const Vector_t< T, D > &v, const Vector_t< T, D > &w)
Definition VectorMath.h:21
KOKKOS_INLINE_FUNCTION double euclidean_norm(const Vector_t< T, D > &v)
Definition VectorMath.h:15