12 #ifndef EIGEN_REVERSE_H 13 #define EIGEN_REVERSE_H 33 template<
typename MatrixType,
int Direction>
37 typedef typename MatrixType::Scalar
Scalar;
43 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
44 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
45 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
46 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
54 CoeffReadCost = _MatrixTypeNested::CoeffReadCost
60 static inline PacketScalar
run(
const PacketScalar& x) {
return preverse(x); }
65 static inline PacketScalar
run(
const PacketScalar& x) {
return x; }
70 template<
typename MatrixType,
int Direction>
class Reverse 77 using Base::IsRowMajor;
81 using Base::operator();
86 IsColMajor = !IsRowMajor,
89 OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
90 OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1,
92 || ((Direction ==
Vertical) && IsColMajor)
98 inline Reverse(
const MatrixType& matrix) : m_matrix(matrix) { }
102 inline Index rows()
const {
return m_matrix.rows(); }
103 inline Index
cols()
const {
return m_matrix.cols(); }
107 return -m_matrix.innerStride();
112 eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
113 return coeffRef(row, col);
118 return m_matrix.const_cast_derived().coeffRef(ReverseRow ? m_matrix.rows() - row - 1 :
row,
119 ReverseCol ? m_matrix.cols() - col - 1 :
col);
124 return m_matrix.coeff(ReverseRow ? m_matrix.rows() - row - 1 :
row,
125 ReverseCol ? m_matrix.cols() - col - 1 :
col);
128 inline CoeffReturnType
coeff(Index index)
const 130 return m_matrix.coeff(m_matrix.size() - index - 1);
135 return m_matrix.const_cast_derived().coeffRef(m_matrix.size() - index - 1);
141 return coeffRef(index);
144 template<
int LoadMode>
147 return reverse_packet::run(m_matrix.template packet<LoadMode>(
148 ReverseRow ? m_matrix.rows() - row - OffsetRow :
row,
149 ReverseCol ? m_matrix.cols() - col - OffsetCol :
col));
152 template<
int LoadMode>
155 m_matrix.const_cast_derived().template writePacket<LoadMode>(
156 ReverseRow ? m_matrix.rows() - row - OffsetRow :
row,
157 ReverseCol ? m_matrix.cols() - col - OffsetCol :
col,
158 reverse_packet::run(x));
161 template<
int LoadMode>
162 inline const PacketScalar
packet(Index index)
const 164 return internal::preverse(m_matrix.template packet<LoadMode>( m_matrix.size() - index - PacketSize ));
167 template<
int LoadMode>
170 m_matrix.const_cast_derived().template writePacket<LoadMode>(m_matrix.size() - index - PacketSize,
internal::preverse(x));
189 template<
typename Derived>
197 template<
typename Derived>
216 template<
typename Derived>
219 derived() = derived().reverse().eval();
224 #endif // EIGEN_REVERSE_H
CoeffReturnType coeff(Index row, Index col) const
const internal::remove_all< typename MatrixType::Nested >::type & nestedExpression() const
Scalar & coeffRef(Index row, Index col)
internal::reverse_packet_cond< PacketScalar, ReversePacket > reverse_packet
const unsigned int LvalueBit
internal::dense_xpr_base< Reverse >::type Base
static PacketScalar run(const PacketScalar &x)
Scalar & operator()(Index index)
CoeffReturnType coeff(Index index) const
const unsigned int PacketAccessBit
const PacketScalar packet(Index row, Index col) const
static PacketScalar run(const PacketScalar &x)
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
const PacketScalar packet(Index index) const
traits< MatrixType >::StorageKind StorageKind
const unsigned int HereditaryBits
Reverse(const MatrixType &matrix)
void writePacket(Index row, Index col, const PacketScalar &x)
traits< MatrixType >::XprKind XprKind
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
Scalar & coeffRef(Index index)
Index innerStride() const
ReverseReturnType reverse()
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
void writePacket(Index index, const PacketScalar &x)
MatrixType::Scalar Scalar
Scalar & operator()(Index row, Index col)
Expression of the reverse of a vector or matrix.
nested< MatrixType >::type MatrixTypeNested
const unsigned int LinearAccessBit
MatrixType::Nested m_matrix
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)