12#ifndef EIGEN_REVERSE_H
13#define EIGEN_REVERSE_H
33template<
typename MatrixType,
int Direction>
37 typedef typename MatrixType::Scalar Scalar;
41 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
43 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
44 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
45 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
46 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
53 static inline PacketType run(
const PacketType& x) {
return preverse(x); }
58 static inline PacketType run(
const PacketType& x) {
return x; }
63template<
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)
90 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Reverse)
97 return -m_matrix.innerStride();
101 nestedExpression()
const
107 typename MatrixType::Nested m_matrix;
116template<
typename Derived>
138template<
typename Derived>
143 Index half = cols()/2;
144 leftCols(half).swap(rightCols(half).reverse());
147 Index
half2 = rows()/2;
148 col(half).head(
half2).swap(col(half).tail(
half2).reverse());
153 Index half = rows()/2;
154 topRows(half).swap(bottomRows(half).reverse());
157 Index
half2 = cols()/2;
158 row(half).head(
half2).swap(row(half).tail(
half2).reverse());
165template<
int Direction>
171 template<
typename ExpressionType>
172 static void run(ExpressionType &
xpr)
174 Index half =
xpr.rows()/2;
175 xpr.topRows(half).swap(
xpr.bottomRows(half).colwise().reverse());
182 template<
typename ExpressionType>
183 static void run(ExpressionType &
xpr)
185 Index half =
xpr.cols()/2;
186 xpr.leftCols(half).swap(
xpr.rightCols(half).rowwise().reverse());
203template<
typename ExpressionType,
int Direction>
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:49
Expression of the reverse of a vector or matrix.
Definition Reverse.h:65
Pseudo expression representing a solving operation.
Definition Solve.h:63
Pseudo expression providing partial reduction operations.
Definition VectorwiseOp.h:157
@ BothDirections
For Reverse, both rows and columns are reversed; not used for PartialReduxExpr and VectorwiseOp.
Definition Constants.h:271
@ Horizontal
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows.
Definition Constants.h:268
@ Vertical
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns.
Definition Constants.h:265
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:138
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
Definition XprHelper.h:428
Definition GenericPacketMath.h:90
Definition ForwardDeclarations.h:17