25#ifndef SCALAR_VECTOR_H
26#define SCALAR_VECTOR_H
42template<
typename T,
unsigned D,
typename IMPL>
54template<
typename T,
unsigned D,
typename IMPL>
58 for (
unsigned iDim=0; iDim < D; ++iDim) {
59 sqNorm += a[iDim] * a[iDim];
65template<
typename T,
unsigned D,
typename IMPL>
74template<
typename T,
unsigned D,
typename IMPL>
77 const T eps = std::numeric_limits<T>::epsilon();
78 for (
unsigned iDim=0; iDim < D; ++iDim) {
87template<
typename T,
unsigned D,
typename IMPL>
91 for (
unsigned iDim=0; iDim < D; ++iDim) {
98template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
102 for (
unsigned iDim=0; iDim < D; ++iDim) {
103 smaller &= (lhs[iDim] < rhs[iDim]);
109template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
116template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
119 bool smallerEq =
true;
120 for (
unsigned iDim=0; iDim < D; ++iDim) {
121 smallerEq &= (lhs[iDim] <= rhs[iDim]);
127template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
134template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
137 for (
unsigned iDim=0; iDim < D; ++iDim) {
138 if (lhs[iDim] < rhs[iDim])
return true;
139 if (lhs[iDim] > rhs[iDim])
return false;
145template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
148 for (
unsigned iDim=0; iDim < D; ++iDim) {
149 if (lhs[iDim] > rhs[iDim])
return true;
150 if (lhs[iDim] < rhs[iDim])
return false;
156template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
159 for (
unsigned iDim=0; iDim < D; ++iDim) {
160 if (lhs[iDim] < rhs[iDim])
return true;
161 if (lhs[iDim] > rhs[iDim])
return false;
167template<
typename T,
unsigned D,
typename U,
typename IMPL,
typename IMPL_>
170 for (
unsigned iDim=0; iDim < D; ++iDim) {
171 if (lhs[iDim] > rhs[iDim])
return true;
172 if (lhs[iDim] < rhs[iDim])
return false;
178template<
typename T,
unsigned D,
typename IMPL>
183 for (
unsigned iDim=0; iDim < D-1; ++iDim) {
184 os << o[iDim] <<
" ";
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Top level namespace for all of OpenLB.
constexpr bool lex_greater(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if lhs is lexicographically greater than rhs.
constexpr std::vector< T > toStdVector(const ScalarVector< T, D, IMPL > &a)
Copies data into a standard vector.
constexpr bool operator<(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if all lhs components are smaller than rhs.
constexpr bool operator>=(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if all lhs components are smaller or equal than rhs.
constexpr bool lex_smaller(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if lhs is lexicographically smaller than rhs.
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.
constexpr bool lex_smaller_eq(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if lhs is lexicographically smaller or equal to rhs.
constexpr bool lex_greater_eq(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if lhs is lexicographically greater or equal to rhs.
constexpr T norm_squared(const ScalarVector< T, D, IMPL > &a)
Squared euclidean vector norm.
bool closeToZero(const ScalarVector< T, D, IMPL > &a)
Returns true iff all components are within floating point error distance of 0.
constexpr bool operator>(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if all lhs components are greater than rhs.
std::ostream & operator<<(std::ostream &os, const ScalarVector< T, D, IMPL > &o)
Print vector entries to ostream in a human-readable fashion.
constexpr bool operator<=(const ScalarVector< T, D, IMPL > &lhs, const ScalarVector< U, D, IMPL_ > &rhs)
Returns true if all lhs components are smaller or equal than rhs.
Generic vector of values supporting basic arithmetic.
ScalarVector(const ScalarVector &)=delete
ScalarVector(ScalarVector &&)=delete
constexpr ScalarVector()=default