12 #ifndef EIGEN_REVERSE_H
13 #define EIGEN_REVERSE_H
21 template<
typename MatrixType,
int Direction>
26 typedef typename traits<MatrixType>::StorageKind StorageKind;
27 typedef typename traits<MatrixType>::XprKind XprKind;
28 typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
29 typedef std::remove_reference_t<MatrixTypeNested> MatrixTypeNested_;
31 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
32 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
33 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
34 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
39 template<
typename PacketType,
bool ReversePacket>
struct reverse_packet_cond
41 static inline PacketType run(
const PacketType&
x) {
return preverse(
x); }
44 template<
typename PacketType>
struct reverse_packet_cond<PacketType,false>
46 static inline PacketType run(
const PacketType&
x) {
return x; }
65 template<
typename MatrixType,
int Direction>
class Reverse
66 :
public internal::dense_xpr_base< Reverse<MatrixType, Direction> >::type
70 typedef typename internal::dense_xpr_base<Reverse>::type
Base;
73 using
Base::IsRowMajor;
87 typedef internal::reverse_packet_cond<PacketScalar,ReversePacket>
reverse_packet;
120 template<
typename Derived>
142 template<
typename Derived>
169 template<
int Direction>
170 struct vectorwise_reverse_inplace_impl;
173 struct vectorwise_reverse_inplace_impl<
Vertical>
175 template<
typename ExpressionType>
176 static void run(ExpressionType &xpr)
178 constexpr
Index HalfAtCompileTime = ExpressionType::RowsAtCompileTime==
Dynamic?
Dynamic:ExpressionType::RowsAtCompileTime/2;
180 xpr.template topRows<HalfAtCompileTime>(
half)
181 .swap(xpr.template bottomRows<HalfAtCompileTime>(
half).colwise().reverse());
186 struct vectorwise_reverse_inplace_impl<
Horizontal>
188 template<
typename ExpressionType>
189 static void run(ExpressionType &xpr)
191 constexpr
Index HalfAtCompileTime = ExpressionType::ColsAtCompileTime==
Dynamic?
Dynamic:ExpressionType::ColsAtCompileTime/2;
192 Index half = xpr.cols()/2;
193 xpr.template leftCols<HalfAtCompileTime>(half)
194 .swap(xpr.template rightCols<HalfAtCompileTime>(half).rowwise().reverse());
211 template<
typename ExpressionType,
int Direction>
214 internal::vectorwise_reverse_inplace_impl<Direction>::run(m_matrix);
NRowsBlockXpr<... >::Type topRows(NRowsType n)
RowXpr row(Index i)
This is the const version of row(). */.
NColsBlockXpr<... >::Type leftCols(NColsType n)
ColXpr col(Index i)
This is the const version of col().
NColsBlockXpr<... >::Type rightCols(NColsType n)
NRowsBlockXpr<... >::Type bottomRows(NRowsType n)
FixedSegmentReturnType<... >::Type tail(NType n)
#define EIGEN_DEVICE_FUNC
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Matrix< float, 1, Dynamic > MatrixType
ReverseReturnType reverse()
internal::traits< Derived >::Scalar Scalar
The matrix class, also used for vectors and row-vectors.
Expression of the reverse of a vector or matrix.
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
internal::reverse_packet_cond< PacketScalar, ReversePacket > reverse_packet
Reverse(const MatrixType &matrix)
internal::remove_all_t< MatrixType > NestedExpression
const internal::remove_all_t< typename MatrixType::Nested > & nestedExpression() const
Index innerStride() const
MatrixType::Nested m_matrix
internal::dense_xpr_base< Reverse >::type Base
const unsigned int LvalueBit
const unsigned int RowMajorBit
typename remove_all< T >::type remove_all_t
Packet2cf preverse(const Packet2cf &a)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Eigen::Index Index
The interface type of indices.