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 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) { }
92 EIGEN_DEVICE_FUNC inline
Index rows()
const {
return m_matrix.rows(); }
93 EIGEN_DEVICE_FUNC
inline Index cols()
const {
return m_matrix.cols(); }
97 return -m_matrix.innerStride();
116 template<
typename Derived>
138 template<
typename Derived>
147 Index half2 = rows()/2;
148 col(half).head(half2).swap(
col(half).
tail(half2).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 EIGEN_DEVICE_FUNC ColsBlockXpr rightCols(Index n)
This is the const version of rightCols(Index).
EIGEN_DEVICE_FUNC void reverseInPlace()
internal::reverse_packet_cond< PacketScalar, ReversePacket > reverse_packet
EIGEN_DEVICE_FUNC SegmentReturnType tail(Index n)
This is the const version of tail(Index).
const unsigned int LvalueBit
internal::dense_xpr_base< Reverse >::type Base
EIGEN_DEVICE_FUNC Index cols() const
EIGEN_DEVICE_FUNC const internal::remove_all< typename MatrixType::Nested >::type & nestedExpression() const
EIGEN_DEVICE_FUNC RowsBlockXpr topRows(Index n)
This is the const version of topRows(Index).
const unsigned int RowMajorBit
EIGEN_DEVICE_FUNC Reverse(const MatrixType &matrix)
static PacketType run(const PacketType &x)
traits< MatrixType >::StorageKind StorageKind
static void run(ExpressionType &xpr)
EIGEN_DEVICE_FUNC ColsBlockXpr leftCols(Index n)
This is the const version of leftCols(Index).
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
traits< MatrixType >::XprKind XprKind
static PacketType run(const PacketType &x)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
static void run(ExpressionType &xpr)
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */.
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
EIGEN_DEVICE_FUNC RowsBlockXpr bottomRows(Index n)
This is the const version of bottomRows(Index).
EIGEN_DEVICE_FUNC ReverseReturnType reverse()
MatrixType::Scalar Scalar
EIGEN_DEVICE_FUNC Index innerStride() const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_DEVICE_FUNC void reverseInPlace()
ref_selector< MatrixType >::type MatrixTypeNested
Expression of the reverse of a vector or matrix.
void run(Expr &expr, Dev &dev)
MatrixType::Nested m_matrix
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)