Skip to content
Snippets Groups Projects
Commit 127b154a authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Added self multiplication by a T

parent 78456b44
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,15 @@ public: ...@@ -68,6 +68,15 @@ public:
return std::move(t); return std::move(t);
} }
KOKKOS_INLINE_FUNCTION
TinyVector& operator*=(const T& t)
{
for (size_t i=0; i<N; ++i) {
m_values[i] *= t;
}
return *this;
}
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
friend TinyVector operator*(const T& t, const TinyVector& v) friend TinyVector operator*(const T& t, const TinyVector& v)
{ {
...@@ -81,9 +90,7 @@ public: ...@@ -81,9 +90,7 @@ public:
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
friend TinyVector operator*(const T& t, TinyVector&& v) friend TinyVector operator*(const T& t, TinyVector&& v)
{ {
for (size_t i=0; i<N; ++i) { v *= t;
v.m_values[i] *= t;
}
return std::move(v); return std::move(v);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment