12 #ifndef EIGEN_REVERSE_H 13 #define EIGEN_REVERSE_H 19 template<
typename MatrixType,
int Direction>
23 typedef typename MatrixType::Scalar Scalar;
29 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
30 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
31 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
32 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
63 template<
typename MatrixType,
int Direction>
class Reverse 69 EIGEN_DENSE_PUBLIC_INTERFACE(
Reverse)
71 using Base::IsRowMajor;
76 IsColMajor = !IsRowMajor,
79 OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
80 OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1,
82 || ((Direction ==
Vertical) && IsColMajor)
88 EIGEN_DEVICE_FUNC
explicit inline Reverse(
const MatrixType& matrix) : m_matrix(matrix) { }
90 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse)
92 EIGEN_DEVICE_FUNC
inline Index rows()
const {
return m_matrix.rows(); }
93 EIGEN_DEVICE_FUNC
inline Index cols()
const {
return m_matrix.cols(); }
95 EIGEN_DEVICE_FUNC
inline Index innerStride()
const 97 return -m_matrix.innerStride();
101 nestedExpression()
const 107 typename MatrixType::Nested m_matrix;
116 template<
typename Derived>
138 template<
typename Derived>
144 leftCols(half).swap(rightCols(half).reverse());
147 Index half2 = rows()/2;
148 col(half).head(half2).swap(col(half).tail(half2).reverse());
154 topRows(half).swap(bottomRows(half).reverse());
157 Index half2 = cols()/2;
158 row(half).head(half2).swap(row(half).tail(half2).reverse());
165 template<
int Direction>
171 template<
typename ExpressionType>
172 static void run(ExpressionType &xpr)
175 xpr.topRows(half).swap(xpr.bottomRows(half).colwise().reverse());
182 template<
typename ExpressionType>
183 static void run(ExpressionType &xpr)
186 xpr.leftCols(half).swap(xpr.rightCols(half).rowwise().reverse());
203 template<
typename ExpressionType,
int Direction>
211 #endif // EIGEN_REVERSE_H
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns...
Definition: Constants.h:265
EIGEN_DEVICE_FUNC void reverseInPlace()
This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of *this...
Definition: Reverse.h:204
Definition: Reverse.h:166
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:139
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Definition: XprHelper.h:463
Definition: GenericPacketMath.h:96
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: CoreEvaluators.h:1413
Definition: XprHelper.h:396
EIGEN_DEVICE_FUNC ReverseReturnType reverse()
Definition: Reverse.h:118
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows...
Definition: Constants.h:268
For Reverse, both rows and columns are reversed; not used for PartialReduxExpr and VectorwiseOp...
Definition: Constants.h:271
Definition: BandTriangularSolver.h:13
EIGEN_DEVICE_FUNC void reverseInPlace()
This is the "in place" version of reverse: it reverses *this.
Definition: Reverse.h:139
Definition: TensorMeta.h:50
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:63
Definition: ForwardDeclarations.h:17