Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen-unsupported  3.4.90 (git rev e3e74001f7c4bf95f0dde572e8a08c5b2918a3ab)
Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ > Class Template Reference

Detailed Description

template<typename Scalar_, int NumIndices_, int Options_, typename IndexType_>
class Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >

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:

Template Parameters
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.

Template Parameters
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:

Eigen::Tensor<double, 4> t(10, 10, 10, 10);
t(0, 1, 2, 3) = 42.0;
The tensor class.
Definition: Tensor.h:64

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.

Some notes:

Relation to other parts of Eigen:
The midterm development goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that taking blocks or using tensors in expressions is easily possible, including an interface with the vector/matrix code by providing .asMatrix() and .asVector() (or similar) methods for rank 2 and 1 tensors. However, currently, the Tensor class does not provide any of these features and is only available as a stand-alone class that just allows for coefficient access. Also, when fixed-size tensors are implemented, the number of template arguments is likely to change dramatically.

Storage orders

+ Inheritance diagram for Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >:

Public Member Functions

void resize (const array< Index, NumIndices > &dimensions)
 
template<typename std::ptrdiff_t... Indices>
void resize (const Sizes< Indices... > &dimensions)
 
 Tensor (const array< Index, NumIndices > &dimensions)
 

Constructor & Destructor Documentation

◆ Tensor()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( const array< Index, NumIndices > &  dimensions)
inlineexplicit

Normal Dimension

Member Function Documentation

◆ resize() [1/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( const array< Index, NumIndices > &  dimensions)
inline

Normal Dimension

◆ resize() [2/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename std::ptrdiff_t... Indices>
void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( const Sizes< Indices... > &  dimensions)
inline

Custom Dimension


The documentation for this class was generated from the following file: