All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
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_@anchortensor_tparam_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_@anchortensor_tparam_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;
*

This class can be extended with the help of the plugin mechanism described on the page TopicCustomizingEigen by defining the preprocessor symbol EIGEN_TENSOR_PLUGIN.

Some notes:

Relation to other parts of Eigen:
The midterm developement 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.

TopicStorageOrders

+ 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

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

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

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: