Lightweight wrapper around a c-array.
More...
#include <Tensor.hpp>
|
using | value_type = T |
| Alias for type template parameter.
|
|
|
T const & | operator[] (std::ptrdiff_t const i) const |
| Const element access. More...
|
|
T & | operator[] (std::ptrdiff_t const i) |
| Non-const element access. More...
|
|
template<typename U = T> |
std::enable_if_t< std::is_floating_point< U >::value, bool > | operator== (Tensor< U, SIZE > const &rhs) const |
| Equality comparison operator. More...
|
|
template<typename U = T> |
std::enable_if_t< !std::is_floating_point< U >::value, bool > | operator== (Tensor< U, SIZE > const &rhs) const |
| Equality comparison operator. More...
|
|
constexpr int | size (int junk) const |
| Returns the size of the tensor. More...
|
|
Tensor< T, SIZE_TPARAM > & | operator= (const double &rhs) |
| Declare assignment operators. More...
|
|
Tensor< T, SIZE_TPARAM > & | operator+= (const double &rhs) |
| Adds a single value to all tensor components. More...
|
|
Tensor< T, SIZE_TPARAM > & | operator+= (const Tensor< T, SIZE_TPARAM > &rhs) |
| Component-wise addition of two tensors. More...
|
|
|
static constexpr int | SIZE = SIZE_TPARAM |
| Alias for size template parameter.
|
|
|
double | operator* (const Tensor< T, SIZE_TPARAM > &lhs, const Tensor< T, SIZE_TPARAM > &rhs) |
| Define dot product. TODO: Check compatibility of lhs and rhs.
|
|
std::ostream & | operator<< (std::ostream &os, Tensor< T, SIZE > const &t) |
| Stream insertion operator for Tensor. More...
|
|
template<typename T, int SIZE_TPARAM>
class geos::Tensor< T, SIZE_TPARAM >
Lightweight wrapper around a c-array.
- Template Parameters
-
T | data type |
SIZE_TPARAM | number of values |
Definition at line 30 of file Tensor.hpp.
◆ operator+=() [1/2]
template<typename T , int SIZE_TPARAM>
Tensor< T, SIZE_TPARAM > & geos::Tensor< T, SIZE_TPARAM >::operator+= |
( |
const double & |
rhs | ) |
|
|
inline |
Adds a single value to all tensor components.
- Parameters
-
- Returns
- The updated tensor.
Definition at line 193 of file Tensor.hpp.
◆ operator+=() [2/2]
template<typename T , int SIZE_TPARAM>
Component-wise addition of two tensors.
- Parameters
-
rhs | the tensor being added to 'this' one |
- Returns
- The updated tensor.
Definition at line 210 of file Tensor.hpp.
◆ operator=()
template<typename T , int SIZE_TPARAM>
Tensor< T, SIZE_TPARAM > & geos::Tensor< T, SIZE_TPARAM >::operator= |
( |
const double & |
rhs | ) |
|
|
inline |
Declare assignment operators.
Assigns all tensor components to a single input value.
- Parameters
-
- Returns
- The updated tensor.
Definition at line 176 of file Tensor.hpp.
◆ operator==() [1/2]
template<typename T , int SIZE_TPARAM>
template<typename U = T>
std::enable_if_t< std::is_floating_point< U >::value, bool > geos::Tensor< T, SIZE_TPARAM >::operator== |
( |
Tensor< U, SIZE > const & |
rhs | ) |
const |
|
inline |
Equality comparison operator.
- Template Parameters
-
U | dummy parameter to enable SFINAE, do not provide explicitly |
- Parameters
-
rhs | the right-hand side value to compare to |
- Returns
- true iff
T data[SIZE]
Underlying array.
- Note
- Version for floating point types that avoids direct equality comparison.
Definition at line 77 of file Tensor.hpp.
◆ operator==() [2/2]
template<typename T , int SIZE_TPARAM>
template<typename U = T>
std::enable_if_t< !std::is_floating_point< U >::value, bool > geos::Tensor< T, SIZE_TPARAM >::operator== |
( |
Tensor< U, SIZE > const & |
rhs | ) |
const |
|
inline |
Equality comparison operator.
- Template Parameters
-
U | dummy parameter to enable SFINAE, do not provide explicitly |
- Parameters
-
rhs | the right-hand side value to compare to |
- Returns
- true iff
- Note
- Version for all types except floating point.
Definition at line 100 of file Tensor.hpp.
◆ operator[]() [1/2]
template<typename T , int SIZE_TPARAM>
T& geos::Tensor< T, SIZE_TPARAM >::operator[] |
( |
std::ptrdiff_t const |
i | ) |
|
|
inline |
Non-const element access.
- Parameters
-
- Returns
- reference to the i-th element
Definition at line 61 of file Tensor.hpp.
◆ operator[]() [2/2]
template<typename T , int SIZE_TPARAM>
T const& geos::Tensor< T, SIZE_TPARAM >::operator[] |
( |
std::ptrdiff_t const |
i | ) |
const |
|
inline |
Const element access.
- Parameters
-
- Returns
- const reference to the i-th element
Definition at line 49 of file Tensor.hpp.
◆ size()
template<typename T , int SIZE_TPARAM>
constexpr int geos::Tensor< T, SIZE_TPARAM >::size |
( |
int |
junk | ) |
const |
|
inlineconstexpr |
Returns the size of the tensor.
- Parameters
-
- Returns
- The value of the template parameter SIZE.
Definition at line 119 of file Tensor.hpp.
◆ operator<<
template<typename T , int SIZE_TPARAM>
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
Tensor< T, SIZE > const & |
t |
|
) |
| |
|
friend |
Stream insertion operator for Tensor.
- Parameters
-
os | the output stream |
t | the tensor value |
- Returns
- reference to
os
Definition at line 152 of file Tensor.hpp.
The documentation for this class was generated from the following file: