LCS::Tensor< T, Dim > Class Template Reference
Class for tensors. More...
#include <basic.hpp>
Public Member Functions | |
Tensor (unsigned nx, unsigned ny) | |
void | operator= (const Tensor< T, Dim > &t) |
T & | operator() (unsigned i, unsigned j) |
T | operator() (unsigned i, unsigned j) const |
T & | Get (unsigned i, unsigned j) |
T | Get (unsigned i, unsigned j) const |
T | GetValue (unsigned i, unsigned j) const |
auto & | GetAll () const |
auto | GetNearby (const unsigned i, const unsigned j) const |
void | SetValue (unsigned i, unsigned j, T value) |
void | SetAll (std::vector< T > &data) |
auto | Size () const |
Detailed Description
template<typename T, unsigned Dim = 2>
class LCS::Tensor< T, Dim >
Class for tensors.
This class is used for representing tensors (matrices) in a 1D vector.
- Template Parameters
-
T Data type of each element in the tensor. Dim Dimension of the tensor.
Constructor & Destructor Documentation
template<typename T, unsigned Dim = 2>
|
inline |
Constructor for initializing the tensor.
- Parameters
-
nx The number of grid points in -direction.
ny The number of grid points in -direction.
Member Function Documentation
template<typename T, unsigned Dim = 2>
|
inline |
Get one element reference of the tensor.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
- Returns
- Reference of the element at the given location.
template<typename T, unsigned Dim = 2>
|
inline |
Get one element of the tensor.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
- Returns
- The element at the given location.
template<typename T, unsigned Dim = 2>
|
inline |
Get all elements of the tensor in STL vector format
- Returns
- STL vector that contains raw data of the tensor
template<typename T, unsigned Dim = 2>
|
inline |
Obtain nearby points of a given point
- Parameters
-
i Index of the given point in -coordinate.
j Index of the given point in -coordinate.
- Returns
- Tuple that contains the
- and
-coordinates of the nearby points.
template<typename T, unsigned Dim = 2>
|
inline |
An another implementation of getting one tensor element. The Get() function does not work well sometimes, perhaps due to the overloading.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
- Returns
- The element at the given location.
template<typename T, unsigned Dim = 2>
|
inline |
Get one element reference of the tensor using the () operator.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
- Returns
- Reference of the element at the given location.
template<typename T, unsigned Dim = 2>
|
inline |
Get one element of the tensor using the () operator.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
- Returns
- The element at the given location.
template<typename T, unsigned Dim = 2>
|
inline |
template<typename T, unsigned Dim = 2>
|
inline |
Set values of all tensor elements.
- Parameters
-
data A vector contains all element values of the tensor.
template<typename T, unsigned Dim = 2>
|
inline |
Set value for one tensor element.
- Parameters
-
i Index in -coordinate.
j Index in -coordinate.
value The value to be assigned.
template<typename T, unsigned Dim = 2>
|
inline |
Get the shape of the tensor.
- Returns
- Tuple that contains the shape of the tensor.
The documentation for this class was generated from the following file:
- src/basic.hpp