KASKADE 7 development version
|
A class for representing tensors of arbitrary static rank and extents. More...
#include <tensor.hh>
A class for representing tensors of arbitrary static rank and extents.
Entry | the type of tensor entries |
Size0 | the extent of the first dimension (must be >0) |
Sizes | the extents of the remaining dimensions |
Public Member Functions | |
operator std::conditional_t< rank==2, Dune::FieldMatrix< Entry, Size0, Base::block_type::dimension >, Base & > () const | |
Implicit conversion of rank 2 tensors to Dune::FieldMatrix. More... | |
Constructors | |
Tensor ()=default | |
Tensor (Entry const &e) | |
Assignment | |
Tensor & | operator= (Entry const &e) |
Assignment from a scalar. More... | |
Tensor & | operator= (Dune::FieldMatrix< Entry, Size0, Size1 > const &a) |
Element and subtensor access | |
The tensor class supports element access via the subscript operator [], indexed by integers, and the access via the call operator (). Both have different semantics. While subscript provides read and write access by returning (mutable or const) references to entries (or sub-tensors ordered by dimension), the call operator returns subtensors only by value, but is not restricted to ordered dimension access or complete ranges along dimensions. ExamplesLet \( a_{ijk} \) be a rank-3 tensor.
| |
template<class ... Access> | |
auto | operator() (int i0, Access... is) const |
template<int first, int last, class ... Access> | |
auto | operator() (StaticIndexRange< first, last >, Access... is) const |
Static Public Attributes | |
static constexpr int | rank = Tensor<Entry,Sizes...>::rank + 1 |
The rank of the tensor. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<class Entry , int Size0, int ... Sizes> | |
Tensor< Entry, Size0, Sizes... > | operator* (typename EntryTraits< Entry >::field_type a, Tensor< Entry, Size0, Sizes... > A) |
Scalar times tensor multiplication. More... | |
template<class Entry , int n> | |
Entry | trace (Tensor< Entry, n, n > const &A) |
Trace of a square matrix-shaped tensor. More... | |
|
default |
|
inline |
|
inline |
Implicit conversion of rank 2 tensors to Dune::FieldMatrix.
|
inline |
|
inline |
|
inline |
|
inline |
|
staticconstexpr |
The rank of the tensor.
Definition at line 95 of file tensor.hh.
Referenced by Kaskade::Tensor< double, dim+1, dim, dim >::operator std::conditional_t< rank==2, Dune::FieldMatrix< double, Size0, Base::block_type::dimension >, Base & >(), and Kaskade::Tensor< Entry, Size0, Sizes >::operator=().