12#ifndef EIGEN_REVERSE_H
13#define EIGEN_REVERSE_H
19template<
typename MatrixType,
int Direction>
20struct traits<Reverse<MatrixType, Direction> >
23 typedef typename MatrixType::Scalar Scalar;
24 typedef typename traits<MatrixType>::StorageKind StorageKind;
25 typedef typename traits<MatrixType>::XprKind XprKind;
26 typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
27 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
29 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
30 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
31 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
32 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
37template<
typename PacketType,
bool ReversePacket>
struct reverse_packet_cond
39 static inline PacketType run(
const PacketType& x) {
return preverse(x); }
42template<
typename PacketType>
struct reverse_packet_cond<PacketType,false>
44 static inline PacketType run(
const PacketType& x) {
return x; }
63template<
typename MatrixType,
int Direction>
class Reverse
64 :
public internal::dense_xpr_base< Reverse<MatrixType, Direction> >::type
68 typedef typename internal::dense_xpr_base<Reverse>::type Base;
69 EIGEN_DENSE_PUBLIC_INTERFACE(Reverse)
70 typedef typename internal::remove_all<MatrixType>::type NestedExpression;
71 using Base::IsRowMajor;
75 PacketSize = internal::packet_traits<Scalar>::size,
76 IsColMajor = !IsRowMajor,
79 OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
80 OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1,
82 || ((Direction ==
Vertical) && IsColMajor)
85 typedef internal::reverse_packet_cond<PacketScalar,ReversePacket> reverse_packet;
88 EIGEN_DEVICE_FUNC
explicit inline Reverse(
const MatrixType& matrix) : m_matrix(matrix) { }
90 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse)
92 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
93 inline Index rows()
const EIGEN_NOEXCEPT {
return m_matrix.rows(); }
94 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
95 inline Index cols()
const EIGEN_NOEXCEPT {
return m_matrix.cols(); }
97 EIGEN_DEVICE_FUNC
inline Index innerStride()
const
99 return -m_matrix.innerStride();
102 EIGEN_DEVICE_FUNC
const typename internal::remove_all<typename MatrixType::Nested>::type&
103 nestedExpression()
const
109 typename MatrixType::Nested m_matrix;
118template<
typename Derived>
119EIGEN_DEVICE_FUNC
inline typename DenseBase<Derived>::ReverseReturnType
122 return ReverseReturnType(
derived());
140template<
typename Derived>
167template<
int Direction>
168struct vectorwise_reverse_inplace_impl;
171struct vectorwise_reverse_inplace_impl<
Vertical>
173 template<
typename ExpressionType>
174 static void run(ExpressionType &xpr)
176 const int HalfAtCompileTime = ExpressionType::RowsAtCompileTime==
Dynamic?
Dynamic:ExpressionType::RowsAtCompileTime/2;
177 Index half = xpr.rows()/2;
184struct vectorwise_reverse_inplace_impl<
Horizontal>
186 template<
typename ExpressionType>
187 static void run(ExpressionType &xpr)
189 const int HalfAtCompileTime = ExpressionType::ColsAtCompileTime==
Dynamic?
Dynamic:ExpressionType::ColsAtCompileTime/2;
190 Index half = xpr.cols()/2;
209template<
typename ExpressionType,
int Direction>
212 internal::vectorwise_reverse_inplace_impl<Direction>::run(m_matrix);
RowXpr row(Index i)
Definition DenseBase.h:1119
ColXpr col(Index i)
Definition DenseBase.h:1098
ReverseReturnType reverse()
Definition Reverse.h:120
NColsBlockXpr<... >::Type leftCols(NColsType n)
Definition DenseBase.h:798
NRowsBlockXpr<... >::Type topRows(NRowsType n)
Definition DenseBase.h:571
FixedSegmentReturnType<... >::Type tail(NType n)
Definition DenseBase.h:1258
NColsBlockXpr<... >::Type rightCols(NColsType n)
Definition DenseBase.h:873
void reverseInPlace()
Definition Reverse.h:141
NRowsBlockXpr<... >::Type bottomRows(NRowsType n)
Definition DenseBase.h:646
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition EigenBase.h:63
Derived & derived()
Definition EigenBase.h:46
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition EigenBase.h:60
void reverseInPlace()
Definition Reverse.h:210
@ BothDirections
Definition Constants.h:270
@ Horizontal
Definition Constants.h:267
@ Vertical
Definition Constants.h:264
const unsigned int LvalueBit
Definition Constants.h:144
const unsigned int RowMajorBit
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
Definition Constants.h:22