The tensor class. More...
Classes | |
struct | isOfNormalIndex |
Public Types | |
enum | { IsAligned , CoordAccess , RawAccess } |
typedef TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > | Base |
typedef Base::CoeffReturnType | CoeffReturnType |
typedef DSizes< Index, NumIndices_ > | Dimensions |
typedef internal::traits< Self >::Index | Index |
typedef Eigen::internal::nested< Self >::type | Nested |
typedef NumTraits< Scalar >::Real | RealScalar |
typedef Scalar_ | Scalar |
typedef Tensor< Scalar_, NumIndices_, Options_, IndexType_ > | Self |
typedef internal::traits< Self >::StorageKind | StorageKind |
Public Member Functions | |
Self & | base () |
const Self & | base () const |
const Scalar & | coeff () const |
const Scalar & | coeff (const array< Index, NumIndices > &indices) const |
template<typename CustomIndices > | |
const Scalar & | coeff (CustomIndices &indices) const |
template<typename... IndexTypes> | |
const Scalar & | coeff (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) const |
const Scalar & | coeff (Index index) const |
Scalar & | coeffRef () |
Scalar & | coeffRef (const array< Index, NumIndices > &indices) |
template<typename CustomIndices > | |
Scalar & | coeffRef (CustomIndices &indices) |
template<typename... IndexTypes> | |
Scalar & | coeffRef (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) |
Scalar & | coeffRef (Index index) |
Scalar * | data () |
const Scalar * | data () const |
Index | dimension (std::size_t n) const |
const Dimensions & | dimensions () const |
Scalar & | operator() () |
const Scalar & | operator() () const |
Scalar & | operator() (const array< Index, NumIndices > &indices) |
const Scalar & | operator() (const array< Index, NumIndices > &indices) const |
template<typename CustomIndices > | |
Scalar & | operator() (CustomIndices &indices) |
template<typename CustomIndices > | |
const Scalar & | operator() (CustomIndices &indices) const |
template<typename... IndexTypes> | |
Scalar & | operator() (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) |
template<typename... IndexTypes> | |
const Scalar & | operator() (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) const |
Scalar & | operator() (Index index) |
const Scalar & | operator() (Index index) const |
template<typename OtherDerived > | |
Tensor & | operator= (const OtherDerived &other) |
Tensor & | operator= (const Tensor &other) |
Tensor & | operator= (Self &&other) |
Scalar & | operator[] (Index index) |
const Scalar & | operator[] (Index index) const |
Index | rank () const |
void | resize () |
void | resize (const array< Index, NumIndices > &dimensions) |
void | resize (const DSizes< Index, NumIndices > &dimensions) |
template<typename FirstType , typename... OtherTypes> | |
void | resize (const Eigen::IndexList< FirstType, OtherTypes... > &dimensions) |
template<typename std::ptrdiff_t... Indices> | |
void | resize (const Sizes< Indices... > &dimensions) |
template<typename CustomDimension > | |
void | resize (CustomDimension &dimensions) |
template<typename... IndexTypes> | |
void | resize (Index firstDimension, IndexTypes... otherDimensions) |
Index | size () const |
Tensor () | |
Tensor (const array< Index, NumIndices > &dimensions) | |
Tensor (const Self &other) | |
template<typename OtherDerived > | |
Tensor (const TensorBase< OtherDerived, ReadOnlyAccessors > &other) | |
template<typename OtherDerived > | |
Tensor (const TensorBase< OtherDerived, WriteAccessors > &other) | |
template<typename... IndexTypes> | |
Tensor (Index firstDimension, IndexTypes... otherDimensions) | |
Tensor (Self &&other) | |
Static Public Attributes | |
static constexpr int | Layout |
static constexpr int | NumIndices |
static constexpr int | Options |
Protected Member Functions | |
bool | checkIndexRange (const array< Index, NumIndices > &indices) const |
Index | linearizedIndex (const array< Index, NumIndices > &indices) const |
Protected Attributes | |
TensorStorage< Scalar, Dimensions, Options > | m_storage |
The tensor class.
The Tensor class is the work-horse for all dense tensors within Eigen.
The Tensor class encompasses only dynamic-size objects so far.
The first two template parameters are required:
Scalar_ | Numeric type, e.g. float, double, int or std::complex<float> . User defined scalar types are supported as well (see here). |
NumIndices_ | Number of indices (i.e. rank of the tensor) |
The remaining template parameters are optional – in most cases you don't have to worry about them.
Options_ | A combination of either RowMajor or ColMajor, and of either AutoAlign or DontAlign. The former controls storage order, and defaults to column-major. The latter controls alignment, which is required for vectorization. It defaults to aligning tensors. Note that tensors currently do not support any operations that profit from vectorization. Support for such operations (i.e. adding two tensors etc.) is planned. |
You can access elements of tensors using normal subscripting:
This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_TENSOR_PLUGIN
, EIGEN_TENSORBASE_PLUGIN
, and EIGEN_READONLY_TENSORBASE_PLUGIN
.
Some notes:
typedef TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexType_> > Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Base |
typedef Base::CoeffReturnType Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::CoeffReturnType |
typedef DSizes<Index, NumIndices_> Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Dimensions |
typedef internal::traits<Self>::Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Index |
typedef Eigen::internal::nested<Self>::type Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Nested |
typedef NumTraits<Scalar>::Real Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::RealScalar |
typedef Scalar_ Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Scalar |
typedef Tensor<Scalar_, NumIndices_, Options_, IndexType_> Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Self |
typedef internal::traits<Self>::StorageKind Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::StorageKind |
anonymous enum |
|
inline |
Definition at line 271 of file Tensor.h.
|
inline |
Definition at line 277 of file Tensor.h.
|
inline |
Definition at line 283 of file Tensor.h.
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Definition at line 438 of file Tensor.h.
|
inline |
|
inline |
Definition at line 123 of file Tensor.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Definition at line 453 of file Tensor.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 350 of file Tensor.h.
|
inline |
|
staticconstexpr |
|
protected |
|
staticconstexpr |
|
staticconstexpr |