![]() |
Eigen
5.0.1-dev+master
|
#include <Eigen/src/Core/Reshaped.h>
Expression of a fixed-size or dynamic-size reshape.
| XprType | the type of the expression in which we are taking a reshape |
| Rows | the number of rows of the reshape we are taking at compile time (optional) |
| Cols | the number of columns of the reshape we are taking at compile time (optional) |
| Order | can be ColMajor or RowMajor, default is ColMajor. |
This class represents an expression of either a fixed-size or dynamic-size reshape. It is the return type of DenseBase::reshaped(NRowsType,NColsType) and most of the time this is the only way it is used. The source and reshape must have the same coefficient count. Incompatible fixed counts are rejected at compile time, or by a debug assertion when EIGEN_NO_STATIC_ASSERT is defined. Dynamic counts are checked in debug builds.
If you want to directly manipulate reshaped expressions, for instance if you want to write a function returning such an expression, it is advised to use the auto keyword for such use cases.
Here is an example illustrating the dynamic case:
Output:
1 4 7 10 2 5 8 11 3 6 9 12 Matrix m is: 1 4 7 10 2 5 8 11 3 6 9 12 Matrix n is: 1 3 5 7 9 11 2 4 6 8 10 12
Here is an example illustrating the fixed-size case:
Output:
matrix m is: 1 2 3 4 5 6 7 8 matrix n is: 1 3 5 7 2 4 6 8
Public Member Functions | |
| constexpr | Reshaped (XprType &xpr) |
| constexpr | Reshaped (XprType &xpr, Index reshapeRows, Index reshapeCols) |
|
inlineconstexpr |
Fixed-size constructor
|
inlineconstexpr |
Dynamic-size constructor