11 #ifndef EIGEN_TRANSPOSE_H
12 #define EIGEN_TRANSPOSE_H
20 template <
typename MatrixType>
25 RowsAtCompileTime = MatrixType::ColsAtCompileTime,
26 ColsAtCompileTime = MatrixType::RowsAtCompileTime,
27 MaxRowsAtCompileTime = MatrixType::MaxColsAtCompileTime,
28 MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
31 Flags1 = Flags0 | FlagsLvalueBit,
39 template <
typename MatrixType,
typename StorageKind>
55 template <
typename MatrixType>
95 template <
typename MatrixType>
103 template <
typename XprType,
typename StorageKind>
109 template <
typename MatrixType>
113 using Base::coeffRef;
123 return derived().nestedExpression().data();
126 return derived().nestedExpression().data();
131 return derived().nestedExpression().coeffRef(colId, rowId);
135 return derived().nestedExpression().coeffRef(index);
161 template <
typename Derived>
171 template <
typename Derived>
196 template <
typename Derived>
208 bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) &&
209 MatrixType::RowsAtCompileTime !=
Dynamic,
210 bool MatchPacketSize =
215 template <
typename MatrixType>
218 m.matrix().template triangularView<StrictlyUpper>().swap(
219 m.matrix().transpose().template triangularView<StrictlyUpper>());
223 template <
typename MatrixType>
231 for (
Index i = 0;
i < PacketSize; ++
i)
A.
packet[
i] =
m.template packetByOuterInner<Alignment>(
i, 0);
233 for (
Index i = 0;
i < PacketSize; ++
i)
234 m.template writePacket<Alignment>(
m.rowIndexByOuterInner(
i, 0),
m.colIndexByOuterInner(
i, 0),
A.
packet[
i]);
238 template <
typename MatrixType, Index Alignment>
245 for (; row_start + PacketSize <=
m.rows(); row_start += PacketSize) {
246 for (
int col_start = row_start; col_start + PacketSize <=
m.cols(); col_start += PacketSize) {
248 if (row_start == col_start) {
249 for (
Index i = 0;
i < PacketSize; ++
i)
250 A.
packet[
i] =
m.template packetByOuterInner<Alignment>(row_start +
i, col_start);
252 for (
Index i = 0;
i < PacketSize; ++
i)
253 m.template writePacket<Alignment>(
m.rowIndexByOuterInner(row_start +
i, col_start),
254 m.colIndexByOuterInner(row_start +
i, col_start),
A.
packet[
i]);
257 for (
Index i = 0;
i < PacketSize; ++
i) {
258 A.
packet[
i] =
m.template packetByOuterInner<Alignment>(row_start +
i, col_start);
259 B.packet[
i] =
m.template packetByOuterInner<Alignment>(col_start +
i, row_start);
263 for (
Index i = 0;
i < PacketSize; ++
i) {
264 m.template writePacket<Alignment>(
m.rowIndexByOuterInner(row_start +
i, col_start),
265 m.colIndexByOuterInner(row_start +
i, col_start),
B.packet[
i]);
266 m.template writePacket<Alignment>(
m.rowIndexByOuterInner(col_start +
i, row_start),
267 m.colIndexByOuterInner(col_start +
i, row_start),
A.
packet[
i]);
273 m.matrix().row(
row).head(
row).swap(
m.matrix().col(
row).head(
row).transpose());
277 template <
typename MatrixType,
bool MatchPacketSize>
281 if (
m.rows() ==
m.cols()) {
284 if ((
m.rows() % PacketSize) == 0)
285 BlockedInPlaceTranspose<MatrixType, internal::evaluator<MatrixType>::Alignment>(
m);
287 BlockedInPlaceTranspose<MatrixType, Unaligned>(
m);
289 m.matrix().template triangularView<StrictlyUpper>().swap(
290 m.matrix().transpose().template triangularView<StrictlyUpper>());
293 m =
m.transpose().eval();
319 template <
typename Derived>
322 "transposeInPlace() called on a non-square non-resizable matrix");
349 template <
typename Derived>
354 #ifndef EIGEN_NO_DEBUG
360 template <
bool DestIsTransposed,
typename OtherDerived>
365 template <
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
373 template <
typename Scalar,
bool DestIsTransposed,
typename OtherDerived>
381 template <
typename Scalar,
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
397 template <
typename Derived,
typename OtherDerived,
398 bool MightHaveTransposeAliasing =
399 check_transpose_aliasing_compile_time_selector<blas_traits<Derived>::IsTransposed, OtherDerived>
::ret>
405 "aliasing detected during transposition, use transposeInPlace() "
406 "or evaluate the rhs into a temporary using .eval()");
410 template <
typename Derived,
typename OtherDerived>
415 template <
typename Dst,
typename Src>
417 if ((!Dst::IsVectorAtCompileTime) && dst.rows() > 1 && dst.cols() > 1)
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1149
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
Macro to manually define default constructors and destructors. This is necessary when the copy constr...
Definition: Macros.h:1137
#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_assert(x)
Definition: Macros.h:910
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Macro to manually inherit assignment operators. This is necessary, because the implicitly defined ass...
Definition: Macros.h:1126
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
void adjoint(const MatrixType &m)
Definition: adjoint.cpp:85
SCALAR Scalar
Definition: bench_gemm.cpp:45
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:48
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
internal::packet_traits< Scalar >::type Packet
Definition: benchmark-blocking-sizes.cpp:54
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNested_ & rhs() const
Definition: CwiseBinaryOp.h:125
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNested_ & lhs() const
Definition: CwiseBinaryOp.h:123
EIGEN_DEVICE_FUNC void transposeInPlace()
Definition: Transpose.h:320
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Definition: Transpose.h:162
EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const
Definition: Transpose.h:197
std::conditional_t< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, ConstTransposeReturnType >, ConstTransposeReturnType > AdjointReturnType
Definition: MatrixBase.h:113
EIGEN_DEVICE_FUNC void adjointInPlace()
Definition: Transpose.h:350
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
Definition: PlainObjectBase.h:247
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar * data() const
Definition: Transpose.h:125
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeffRef(Index index) const
Definition: Transpose.h:134
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index outerStride() const
Definition: Transpose.h:118
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeffRef(Index rowId, Index colId) const
Definition: Transpose.h:130
internal::TransposeImpl_base< MatrixType >::type Base
Definition: Transpose.h:112
std::conditional_t< internal::is_lvalue< MatrixType >::value, Scalar, const Scalar > ScalarWithConstIfNotLvalue
Definition: Transpose.h:120
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ScalarWithConstIfNotLvalue * data()
Definition: Transpose.h:122
Definition: Transpose.h:104
internal::generic_xpr_base< Transpose< XprType > >::type Base
Definition: Transpose.h:106
Expression of the transpose of a matrix.
Definition: Transpose.h:56
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Transpose.h:68
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Transpose.h:69
TransposeImpl< MatrixType, typename internal::traits< MatrixType >::StorageKind >::Base Base
Definition: Transpose.h:60
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::remove_reference_t< MatrixTypeNested > & nestedExpression()
Definition: Transpose.h:77
internal::ref_selector< MatrixType >::non_const_type m_matrix
Definition: Transpose.h:85
internal::remove_all_t< MatrixType > NestedExpression
Definition: Transpose.h:62
internal::ref_selector< MatrixType >::non_const_type MatrixTypeNested
Definition: Transpose.h:58
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all_t< MatrixTypeNested > & nestedExpression() const
Definition: Transpose.h:72
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index nrows, Index ncols)
Definition: Transpose.h:82
Definition: matrices.h:74
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
const unsigned int PacketAccessBit
Definition: Constants.h:97
const unsigned int LvalueBit
Definition: Constants.h:148
const unsigned int RowMajorBit
Definition: Constants.h:70
Eigen::DenseIndex ret
Definition: level1_cplx_impl.h:43
int * m
Definition: level2_cplx_impl.h:294
EIGEN_STRONG_INLINE void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
Definition: AltiVec/Complex.h:339
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const T::Scalar * extract_data(const T &m)
Definition: BlasUtil.h:581
void BlockedInPlaceTranspose(MatrixType &m)
Definition: Transpose.h:239
EIGEN_DEVICE_FUNC void check_for_aliasing(const Dst &dst, const Src &src)
Definition: Transpose.h:416
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
squared absolute value
Definition: GlobalFunctions.h:87
const unsigned int NestByRefBit
Definition: Constants.h:173
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
void transpose()
Definition: skew_symmetric_matrix3.cpp:135
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Definition: Constants.h:519
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: GenericPacketMath.h:1407
dense_xpr_base< Transpose< MatrixType > >::type type
Definition: Transpose.h:97
Definition: Transpose.h:91
dense_xpr_base< Transpose< MatrixType > >::type type
Definition: Transpose.h:92
Definition: BlasUtil.h:459
static EIGEN_DEVICE_FUNC void run(const Derived &, const OtherDerived &)
Definition: Transpose.h:412
Definition: Transpose.h:400
static EIGEN_DEVICE_FUNC void run(const Derived &dst, const OtherDerived &other)
Definition: Transpose.h:401
Definition: Transpose.h:361
@ ret
Definition: Transpose.h:362
static EIGEN_DEVICE_FUNC bool run(const Scalar *dest, const CwiseBinaryOp< BinOp, DerivedA, DerivedB > &src)
Definition: Transpose.h:383
Definition: Transpose.h:374
static EIGEN_DEVICE_FUNC bool run(const Scalar *dest, const OtherDerived &src)
Definition: Transpose.h:375
Definition: XprHelper.h:558
Definition: CoreEvaluators.h:104
Definition: XprHelper.h:575
Definition: DenseCoeffsBase.h:546
static void run(MatrixType &m)
Definition: Transpose.h:279
static void run(MatrixType &m)
Definition: Transpose.h:217
static void run(MatrixType &m)
Definition: Transpose.h:225
Definition: Transpose.h:213
Definition: XprHelper.h:819
Definition: DenseCoeffsBase.h:556
Definition: GenericPacketMath.h:108
Definition: XprHelper.h:506
std::conditional_t< bool(traits< T >::Flags &NestByRefBit), T &, T > non_const_type
Definition: XprHelper.h:509
std::remove_reference_t< MatrixTypeNested > MatrixTypeNestedPlain
Definition: Transpose.h:23
ref_selector< MatrixType >::type MatrixTypeNested
Definition: Transpose.h:22
Definition: ForwardDeclarations.h:21
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