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

Merge branch 'develop' into feature/language

parents 6688409d 5d217433
Branches
Tags
1 merge request!37Feature/language
...@@ -45,14 +45,20 @@ class TinyMatrix ...@@ -45,14 +45,20 @@ class TinyMatrix
for (size_t i = 0; i < N * N; ++i) { for (size_t i = 0; i < N * N; ++i) {
opposed.m_values[i] = -m_values[i]; opposed.m_values[i] = -m_values[i];
} }
return std::move(opposed); return opposed;
} }
PUGS_INLINE PUGS_INLINE
constexpr friend TinyMatrix operator*(const T& t, const TinyMatrix& A) constexpr friend TinyMatrix operator*(const T& t, const TinyMatrix& A)
{ {
TinyMatrix B = A; TinyMatrix B = A;
return std::move(B *= t); return B *= t;
}
PUGS_INLINE
constexpr friend TinyMatrix operator*(const T& t, TinyMatrix&& A)
{
return std::move(A *= t);
} }
PUGS_INLINE PUGS_INLINE
...@@ -79,7 +85,7 @@ class TinyMatrix ...@@ -79,7 +85,7 @@ class TinyMatrix
AB(i, j) = sum; AB(i, j) = sum;
} }
} }
return std::move(AB); return AB;
} }
PUGS_INLINE PUGS_INLINE
...@@ -94,7 +100,7 @@ class TinyMatrix ...@@ -94,7 +100,7 @@ class TinyMatrix
} }
Ax[i] = sum; Ax[i] = sum;
} }
return std::move(Ax); return Ax;
} }
PUGS_INLINE PUGS_INLINE
...@@ -143,7 +149,7 @@ class TinyMatrix ...@@ -143,7 +149,7 @@ class TinyMatrix
for (size_t i = 0; i < N * N; ++i) { for (size_t i = 0; i < N * N; ++i) {
sum.m_values[i] = m_values[i] + A.m_values[i]; sum.m_values[i] = m_values[i] + A.m_values[i];
} }
return std::move(sum); return sum;
} }
PUGS_INLINE PUGS_INLINE
...@@ -164,7 +170,7 @@ class TinyMatrix ...@@ -164,7 +170,7 @@ class TinyMatrix
for (size_t i = 0; i < N * N; ++i) { for (size_t i = 0; i < N * N; ++i) {
difference.m_values[i] = m_values[i] - A.m_values[i]; difference.m_values[i] = m_values[i] - A.m_values[i];
} }
return std::move(difference); return difference;
} }
PUGS_INLINE PUGS_INLINE
...@@ -306,7 +312,7 @@ tensorProduct(const TinyVector<N, T>& x, const TinyVector<N, T>& y) ...@@ -306,7 +312,7 @@ tensorProduct(const TinyVector<N, T>& x, const TinyVector<N, T>& y)
A(i, j) = x[i] * y[j]; A(i, j) = x[i] * y[j];
} }
} }
return std::move(A); return A;
} }
template <size_t N, typename T> template <size_t N, typename T>
...@@ -404,7 +410,7 @@ getMinor(const TinyMatrix<N, T>& A, const size_t& I, const size_t& J) ...@@ -404,7 +410,7 @@ getMinor(const TinyMatrix<N, T>& A, const size_t& I, const size_t& J)
M(i - 1, j - 1) = A(i, j); M(i - 1, j - 1) = A(i, j);
} }
} }
return std::move(M); return M;
} }
template <size_t N, typename T> template <size_t N, typename T>
...@@ -418,7 +424,7 @@ inverse(const TinyMatrix<1, T>& A) ...@@ -418,7 +424,7 @@ inverse(const TinyMatrix<1, T>& A)
static_assert(std::is_floating_point<T>::value, "inverse is defined for floating point types only"); static_assert(std::is_floating_point<T>::value, "inverse is defined for floating point types only");
TinyMatrix<1, T> A_1(1. / A(0, 0)); TinyMatrix<1, T> A_1(1. / A(0, 0));
return std::move(A_1); return A_1;
} }
template <size_t N, typename T> template <size_t N, typename T>
...@@ -442,7 +448,7 @@ inverse(const TinyMatrix<2, T>& A) ...@@ -442,7 +448,7 @@ inverse(const TinyMatrix<2, T>& A)
const T inv_determinent = 1. / determinent; const T inv_determinent = 1. / determinent;
TinyMatrix<2, T> A_cofactors_T(A(1, 1), -A(0, 1), -A(1, 0), A(0, 0)); TinyMatrix<2, T> A_cofactors_T(A(1, 1), -A(0, 1), -A(1, 0), A(0, 0));
return std::move(A_cofactors_T *= inv_determinent); return A_cofactors_T *= inv_determinent;
} }
template <typename T> template <typename T>
...@@ -458,7 +464,7 @@ inverse(const TinyMatrix<3, T>& A) ...@@ -458,7 +464,7 @@ inverse(const TinyMatrix<3, T>& A)
cofactor(A, 1, 1), cofactor(A, 2, 1), cofactor(A, 0, 2), cofactor(A, 1, 2), cofactor(A, 1, 1), cofactor(A, 2, 1), cofactor(A, 0, 2), cofactor(A, 1, 2),
cofactor(A, 2, 2)); cofactor(A, 2, 2));
return std::move(A_cofactors_T *= 1. / determinent); return A_cofactors_T *= 1. / determinent;
} }
#endif // TINYMATRIX_HPP #endif // TINYMATRIX_HPP
...@@ -39,7 +39,7 @@ class TinyVector ...@@ -39,7 +39,7 @@ class TinyVector
for (size_t i = 0; i < N; ++i) { for (size_t i = 0; i < N; ++i) {
opposed.m_values[i] = -m_values[i]; opposed.m_values[i] = -m_values[i];
} }
return std::move(opposed); return opposed;
} }
PUGS_INLINE PUGS_INLINE
...@@ -74,7 +74,7 @@ class TinyVector ...@@ -74,7 +74,7 @@ class TinyVector
for (size_t i = 1; i < N; ++i) { for (size_t i = 1; i < N; ++i) {
t += m_values[i] * v.m_values[i]; t += m_values[i] * v.m_values[i];
} }
return std::move(t); return t;
} }
PUGS_INLINE PUGS_INLINE
...@@ -91,7 +91,7 @@ class TinyVector ...@@ -91,7 +91,7 @@ class TinyVector
constexpr friend TinyVector operator*(const T& t, const TinyVector& v) constexpr friend TinyVector operator*(const T& t, const TinyVector& v)
{ {
TinyVector w = v; TinyVector w = v;
return std::move(w *= t); return w *= t;
} }
PUGS_INLINE PUGS_INLINE
...@@ -121,7 +121,7 @@ class TinyVector ...@@ -121,7 +121,7 @@ class TinyVector
for (size_t i = 0; i < N; ++i) { for (size_t i = 0; i < N; ++i) {
sum.m_values[i] = m_values[i] + v.m_values[i]; sum.m_values[i] = m_values[i] + v.m_values[i];
} }
return std::move(sum); return sum;
} }
PUGS_INLINE PUGS_INLINE
...@@ -142,7 +142,7 @@ class TinyVector ...@@ -142,7 +142,7 @@ class TinyVector
for (size_t i = 0; i < N; ++i) { for (size_t i = 0; i < N; ++i) {
difference.m_values[i] = m_values[i] - v.m_values[i]; difference.m_values[i] = m_values[i] - v.m_values[i];
} }
return std::move(difference); return difference;
} }
PUGS_INLINE PUGS_INLINE
...@@ -262,7 +262,7 @@ PUGS_INLINE constexpr TinyVector<3, T> ...@@ -262,7 +262,7 @@ PUGS_INLINE constexpr TinyVector<3, T>
crossProduct(const TinyVector<3, T>& u, const TinyVector<3, T>& v) crossProduct(const TinyVector<3, T>& u, const TinyVector<3, T>& v)
{ {
TinyVector<3, T> cross_product(u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]); TinyVector<3, T> cross_product(u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]);
return std::move(cross_product); return cross_product;
} }
#endif // TINYVECTOR_HPP #endif // TINYVECTOR_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment