A class that represents a tetrahedral matrix or tensor, with optional support for higher-dimensional tensor-like data.
More...
|
| template<typename T = void, typename = std::enable_if_t< !Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>> |
| | TetraTensor (IndexType tri_dim) |
| | Constructor for a non-tensor tetrahedral or cubic matrix.
|
| | TetraTensor (const StorageType &data, IndexType tri_dim) |
| | Copy-constructor (almost).
|
| template<typename T = void, typename = std::enable_if_t< Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>> |
| | TetraTensor (IndexType tri_dim, IndexType tensor_size) |
| | Constructor for a tensor-like tetrahedral or cubic matrix.
|
| template<typename T = void, typename = std::enable_if_t<!Tensor, T>> |
| const DataType & | operator() (IndexType i, IndexType j, IndexType k) const |
| | Accessor for non-tensor tetrahedral or cubic matrix (const version).
|
| template<typename T = void, typename = std::enable_if_t<Tensor, T>> |
| const DataType & | operator() (IndexType i, IndexType j, IndexType k, IndexType l) const |
| | Accessor for tensor-like tetrahedral or cubic matrix (const version).
|
| template<typename T = void, typename = std::enable_if_t< !Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>> |
| DataType & | operator() (IndexType i, IndexType j, IndexType k) |
| | Mutator for non-tensor tetrahedral or cubic matrix.
|
| template<typename T = void, typename = std::enable_if_t<Tensor, T>> |
| DataType & | operator() (IndexType i, IndexType j, IndexType k, IndexType l) |
| | Mutator for tensor-like tetrahedral or cubic matrix.
|
| IndexType | dim () const |
| | Dimension n of the \(n \times n\) matrix (or one slice of the tensor).
|
| IndexType | tdim () const |
| | Dimension along the tensor dimension.
|
| IndexType | numel () const |
| | Total number of elements.
|
| auto | begin () |
| | Begin iterator.
|
| auto | end () |
| | End iterator.
|
| auto | begin () const |
| | Const begin iterator.
|
| auto | end () const |
| | Const end iterator.
|
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
class vulpes::datastructure::TetraTensor< Triangular, Tensor, DataType, IndexType, StorageType >
A class that represents a tetrahedral matrix or tensor, with optional support for higher-dimensional tensor-like data.
The TetraTensor class stores data in either a tetrahedral structure (if Triangular is true) or in a cubic structure (if Triangular is false). Namely it offers a coalescent representation for data when you know that the indexes of the tensor i, j, k satisfy i + j + k < tri_dim. It can also store fourth-order tensor data based on the template parameters.
- Template Parameters
-
| Triangular | Specifies whether the tensor is tetrahedral (if true). |
| Tensor | Specifies whether the tensor includes additional dimensions. |
| DataType | The data type of elements stored in the tensor. |
| IndexType | The data type for indexing the tensor. |
| StorageType | The container where to save the data. By default an std::vector, other used options are a const pointer, indicating that this is an not-owning view of some data |
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t< !Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>>
Constructor for a non-tensor tetrahedral or cubic matrix.
- Parameters
-
| tri_dim | The dimension of the tetrahedral or cubic matrix. |
- Note
- This constructor can only be used when Tensor is false.
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
Copy-constructor (almost).
This constructor initializes the tensor from the underlying data buffer. Especially useful for constructing data views (pass the pointer to the data)
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t< Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>>
Constructor for a tensor-like tetrahedral or cubic matrix.
- Parameters
-
| tri_dim | The dimension of the tetrahedral or cubic matrix. |
| tensor_size | The size of the extra tensor dimension. |
- Note
- This constructor can only be used when Tensor is true.
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t< !Tensor && std::is_same_v<StorageType, std::vector<DataType>>, T>>
Mutator for non-tensor tetrahedral or cubic matrix.
- Parameters
-
| i | First index. |
| j | Second index. |
| k | Third index. |
- Returns
- A reference to the element at position (i, j, k).
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t<!Tensor, T>>
Accessor for non-tensor tetrahedral or cubic matrix (const version).
- Parameters
-
| i | First index. |
| j | Second index. |
| k | Third index. |
- Returns
- The element at position (i, j, k).
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t<Tensor, T>>
Mutator for tensor-like tetrahedral or cubic matrix.
- Parameters
-
| i | First index. |
| j | Second index. |
| k | Third index. |
| l | Tensor dimension index. |
- Returns
- A reference to the element at position (i, j, k, l).
template<bool Triangular, bool Tensor, typename DataType, typename IndexType, typename StorageType = std::vector<DataType>>
template<typename T = void, typename = std::enable_if_t<Tensor, T>>
| const DataType & vulpes::datastructure::TetraTensor< Triangular, Tensor, DataType, IndexType, StorageType >::operator() |
( |
IndexType | i, |
|
|
IndexType | j, |
|
|
IndexType | k, |
|
|
IndexType | l ) const |
|
inline |
Accessor for tensor-like tetrahedral or cubic matrix (const version).
- Parameters
-
| i | First index. |
| j | Second index. |
| k | Third index. |
| l | Tensor dimension index. |
- Returns
- The element at position (i, j, k, l).