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:
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 Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_TENSOR_PLUGIN
.
Some notes:
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) | |
| inlineexplicit |
Normal Dimension
| inline |
Normal Dimension
| inline |
Custom Dimension
© Eigen.
Licensed under the MPL2 License.
https://eigen.tuxfamily.org/dox/unsupported/classEigen_1_1Tensor.html