12 #ifndef EIGEN_REVERSE_H 13 #define EIGEN_REVERSE_H 33 template<
typename MatrixType,
int Direction>
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 76 EIGEN_DENSE_PUBLIC_INTERFACE(
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)
100 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Reverse)
102 inline Index rows()
const {
return m_matrix.rows(); }
103 inline Index cols()
const {
return m_matrix.cols(); }
105 inline Index innerStride()
const 107 return -m_matrix.innerStride();
110 inline Scalar& operator()(Index row, Index col)
112 eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
113 return coeffRef(row, col);
116 inline Scalar& coeffRef(Index row, Index col)
118 return m_matrix.const_cast_derived().coeffRef(ReverseRow ? m_matrix.rows() - row - 1 : row,
119 ReverseCol ? m_matrix.cols() - col - 1 : col);
122 inline CoeffReturnType coeff(Index row, Index col)
const 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);
133 inline Scalar& coeffRef(Index index)
135 return m_matrix.const_cast_derived().coeffRef(m_matrix.size() - index - 1);
138 inline Scalar& operator()(Index index)
140 eigen_assert(index >= 0 && index < m_matrix.size());
141 return coeffRef(index);
144 template<
int LoadMode>
145 inline const PacketScalar packet(Index row, Index col)
const 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>
153 inline void writePacket(Index row, Index col,
const PacketScalar& x)
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>
168 inline void writePacket(Index index,
const PacketScalar& x)
170 m_matrix.const_cast_derived().template writePacket<LoadMode>(m_matrix.size() - index - PacketSize, internal::preverse(x));
174 nestedExpression()
const 180 typename MatrixType::Nested m_matrix;
189 template<
typename Derived>
197 template<
typename Derived>
216 template<
typename Derived>
219 derived() = derived().reverse().eval();
224 #endif // EIGEN_REVERSE_H Definition: gtest_unittest.cc:5031
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns...
Definition: Constants.h:209
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:131
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:81
Definition: XprHelper.h:350
Definition: GenericPacketMath.h:71
ReverseReturnType reverse()
Definition: Reverse.h:191
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows...
Definition: Constants.h:212
For Reverse, both rows and columns are reversed; not used for PartialReduxExpr and VectorwiseOp...
Definition: Constants.h:215
Definition: BandTriangularSolver.h:13
void reverseInPlace()
This is the "in place" version of reverse: it reverses *this.
Definition: Reverse.h:217
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:70
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition: Constants.h:117
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48