12 #ifndef EIGEN_REVERSE_H
13 #define EIGEN_REVERSE_H
22 template <
typename MatrixType,
int Direction>
30 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
31 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
32 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
33 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
38 template <
typename PacketType,
bool ReversePacket>
43 template <
typename PacketType>
64 template <
typename MatrixType,
int Direction>
70 using
Base::IsRowMajor;
109 template <
typename Derived>
128 template <
typename Derived>
130 constexpr
int HalfRowsAtCompileTime = RowsAtCompileTime ==
Dynamic ?
Dynamic : RowsAtCompileTime / 2;
131 constexpr
int HalfColsAtCompileTime = ColsAtCompileTime ==
Dynamic ?
Dynamic : ColsAtCompileTime / 2;
134 this->
template leftCols<HalfColsAtCompileTime>(
half).swap(
135 this->
template rightCols<HalfColsAtCompileTime>(
half).
reverse());
136 if ((
cols() % 2) == 1) {
138 col(
half).template head<HalfRowsAtCompileTime>(half2).swap(
143 this->
template topRows<HalfRowsAtCompileTime>(
half).swap(
144 this->
template bottomRows<HalfRowsAtCompileTime>(
half).
reverse());
145 if ((
rows() % 2) == 1) {
147 row(
half).template head<HalfColsAtCompileTime>(half2).swap(
155 template <
int Direction>
160 template <
typename ExpressionType>
161 static void run(ExpressionType& xpr) {
162 constexpr
Index HalfAtCompileTime =
163 ExpressionType::RowsAtCompileTime ==
Dynamic ?
Dynamic : ExpressionType::RowsAtCompileTime / 2;
165 xpr.template topRows<HalfAtCompileTime>(
half).swap(
166 xpr.template bottomRows<HalfAtCompileTime>(
half).colwise().reverse());
172 template <
typename ExpressionType>
173 static void run(ExpressionType& xpr) {
174 constexpr
Index HalfAtCompileTime =
175 ExpressionType::ColsAtCompileTime ==
Dynamic ?
Dynamic : ExpressionType::ColsAtCompileTime / 2;
177 xpr.template leftCols<HalfAtCompileTime>(
half).swap(
178 xpr.template rightCols<HalfAtCompileTime>(
half).rowwise().reverse());
195 template <
typename ExpressionType,
int Direction>
Direction
An enum that indicates the direction in Cartesian coordinates.
Definition: GeneralDefine.h:56
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1171
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Macro to manually inherit assignment operators. This is necessary, because the implicitly defined ass...
Definition: Macros.h:1126
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
void reverse(const MatrixType &m)
Definition: array_reverse.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
EIGEN_DEVICE_FUNC void reverseInPlace()
Definition: Reverse.h:129
EIGEN_DEVICE_FUNC ReverseReturnType reverse()
Definition: Reverse.h:110
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:65
@ OffsetCol
Definition: Reverse.h:79
@ ReversePacket
Definition: Reverse.h:80
@ ReverseRow
Definition: Reverse.h:76
@ PacketSize
Definition: Reverse.h:74
@ ReverseCol
Definition: Reverse.h:77
@ OffsetRow
Definition: Reverse.h:78
@ IsColMajor
Definition: Reverse.h:75
EIGEN_DEVICE_FUNC Index innerStride() const
Definition: Reverse.h:93
EIGEN_DEVICE_FUNC const internal::remove_all_t< typename MatrixType::Nested > & nestedExpression() const
Definition: Reverse.h:95
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Reverse.h:90
internal::reverse_packet_cond< PacketScalar, ReversePacket > reverse_packet
Definition: Reverse.h:83
internal::remove_all_t< MatrixType > NestedExpression
Definition: Reverse.h:69
EIGEN_DEVICE_FUNC Reverse(const MatrixType &matrix)
Definition: Reverse.h:86
MatrixType::Nested m_matrix
Definition: Reverse.h:100
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Reverse.h:91
internal::dense_xpr_base< Reverse >::type Base
Definition: Reverse.h:67
EIGEN_DEVICE_FUNC void reverseInPlace()
Definition: Reverse.h:196
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
@ BothDirections
Definition: Constants.h:272
@ Horizontal
Definition: Constants.h:269
@ Vertical
Definition: Constants.h:266
const unsigned int LvalueBit
Definition: Constants.h:148
const unsigned int RowMajorBit
Definition: Constants.h:70
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)
Definition: AltiVec/Complex.h:303
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Definition: TensorMeta.h:47
Definition: XprHelper.h:558
Definition: GenericPacketMath.h:108
Definition: XprHelper.h:506
static PacketType run(const PacketType &x)
Definition: Reverse.h:45
static PacketType run(const PacketType &x)
Definition: Reverse.h:40
std::remove_reference_t< MatrixTypeNested > MatrixTypeNested_
Definition: Reverse.h:28
traits< MatrixType >::StorageKind StorageKind
Definition: Reverse.h:25
ref_selector< MatrixType >::type MatrixTypeNested
Definition: Reverse.h:27
traits< MatrixType >::XprKind XprKind
Definition: Reverse.h:26
MatrixType::Scalar Scalar
Definition: Reverse.h:24
Definition: ForwardDeclarations.h:21
Definition: Reverse.h:171
static void run(ExpressionType &xpr)
Definition: Reverse.h:173
Definition: Reverse.h:159
static void run(ExpressionType &xpr)
Definition: Reverse.h:161
Definition: Reverse.h:156
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317