16 #ifndef GEOS_COMMON_TENSOR_HPP_ 
   17 #define GEOS_COMMON_TENSOR_HPP_ 
   29 template< 
typename T, 
int SIZE_TPARAM >
 
   34   static_assert( SIZE_TPARAM > 0, 
"Tensor size must be a positive value" );
 
   40   static constexpr 
int SIZE = SIZE_TPARAM;
 
   73   template< 
typename U = T >
 
   76   std::enable_if_t< std::is_floating_point< U >::value, 
bool >
 
   79     for( 
int i = 0; i < 
SIZE; ++i )
 
   96   template< 
typename U = T >
 
   99   std::enable_if_t< !std::is_floating_point< U >::value, 
bool >
 
  102     for( 
int i = 0; i < 
SIZE; ++i )
 
  119   constexpr 
int size( 
int junk )
 const 
  134     for( 
int i = 0; i < SIZE_TPARAM; ++i )
 
  136       result += lhs.
data[i] * rhs.
data[i];
 
  154     os << 
'{' << t.
data[0];
 
  155     for( 
int i = 1; i < 
SIZE; ++i )
 
  157       os << 
',' << t.
data[i];
 
  173 template< 
typename T, 
int SIZE_TPARAM >
 
  178   for( 
int i = 0; i < SIZE_TPARAM; ++i )
 
  190 template< 
typename T, 
int SIZE_TPARAM >
 
  195   for( 
int i = 0; i < SIZE_TPARAM; ++i )
 
  207 template< 
typename T, 
int SIZE_TPARAM >
 
  212   for( 
int i = 0; i < SIZE_TPARAM; ++i )
 
  214     data[i] += rhs.
data[i];
 
#define GEOS_HOST_DEVICE
Marks a host-device function.
 
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
 
#define GEOS_FORCE_INLINE
Marks a function or lambda for inlining.
 
Lightweight wrapper around a c-array.
 
Tensor< T, SIZE_TPARAM > & operator+=(const double &rhs)
Adds a single value to all tensor components.
 
T value_type
Alias for type template parameter.
 
T const  & operator[](std::ptrdiff_t const i) const
Const element access.
 
std::enable_if_t< !std::is_floating_point< U >::value, bool > operator==(Tensor< U, SIZE > const &rhs) const
Equality comparison operator.
 
Tensor< T, SIZE_TPARAM > & operator+=(const Tensor< T, SIZE_TPARAM > &rhs)
Component-wise addition of two tensors.
 
T & operator[](std::ptrdiff_t const i)
Non-const element access.
 
static constexpr int SIZE
Alias for size template parameter.
 
T data[SIZE]
Underlying array.
 
std::enable_if_t< std::is_floating_point< U >::value, bool > operator==(Tensor< U, SIZE > const &rhs) const
Equality comparison operator.
 
friend std::ostream & operator<<(std::ostream &os, Tensor< T, SIZE > const &t)
Stream insertion operator for Tensor.
 
constexpr int size(int junk) const
Returns the size of the tensor.
 
friend double operator*(const Tensor< T, SIZE_TPARAM > &lhs, const Tensor< T, SIZE_TPARAM > &rhs)
Define dot product. TODO: Check compatibility of lhs and rhs.
 
Tensor< T, SIZE_TPARAM > & operator=(const double &rhs)
Declare assignment operators.