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

Provide explicit default constructors for TinyMatrix and TinyVector

g++-7 does not like the mix of constexpr and these implicit constructors
parent 91a2ab35
No related branches found
No related tags found
No related merge requests found
...@@ -46,11 +46,8 @@ public: ...@@ -46,11 +46,8 @@ public:
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
constexpr friend TinyMatrix operator*(const T& t, const TinyMatrix& A) constexpr friend TinyMatrix operator*(const T& t, const TinyMatrix& A)
{ {
TinyMatrix tA; TinyMatrix B = A;
for (size_t i=0; i<N*N; ++i) { return std::move(B *= t);
tA.m_values[i] = t * A.m_values[i];
}
return std::move(tA);
} }
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
...@@ -242,7 +239,10 @@ public: ...@@ -242,7 +239,10 @@ public:
} }
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
constexpr TinyMatrix() noexcept = default; constexpr TinyMatrix() noexcept
{
;
}
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
constexpr TinyMatrix(const ZeroType& z) noexcept constexpr TinyMatrix(const ZeroType& z) noexcept
...@@ -273,7 +273,7 @@ public: ...@@ -273,7 +273,7 @@ public:
} }
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
constexpr TinyMatrix(TinyMatrix&& A) noexcept = default; TinyMatrix(TinyMatrix&& A) noexcept = default;
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
~TinyMatrix()=default; ~TinyMatrix()=default;
......
...@@ -78,11 +78,8 @@ class TinyVector ...@@ -78,11 +78,8 @@ class TinyVector
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
constexpr friend TinyVector operator*(const T& t, const TinyVector& v) constexpr friend TinyVector operator*(const T& t, const TinyVector& v)
{ {
TinyVector tv; TinyVector w = v;
for (size_t i=0; i<N; ++i) { return std::move(w*=t);
tv.m_values[i] = t * v.m_values[i];
}
return std::move(tv);
} }
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
...@@ -230,10 +227,7 @@ class TinyVector ...@@ -230,10 +227,7 @@ class TinyVector
constexpr TinyVector(TinyVector&& v) noexcept = default; constexpr TinyVector(TinyVector&& v) noexcept = default;
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
~TinyVector() noexcept ~TinyVector() noexcept = default;
{
;
}
}; };
template <size_t N, typename T> template <size_t N, typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment