11 #ifndef EIGEN_TRANSPOSE_H 12 #define EIGEN_TRANSPOSE_H 31 template<
typename MatrixType>
40 RowsAtCompileTime = MatrixType::ColsAtCompileTime,
41 ColsAtCompileTime = MatrixType::RowsAtCompileTime,
42 MaxRowsAtCompileTime = MatrixType::MaxColsAtCompileTime,
43 MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
45 Flags0 = MatrixTypeNestedPlain::Flags & ~(
LvalueBit | NestByRefBit),
46 Flags1 = Flags0 | FlagsLvalueBit,
48 CoeffReadCost = MatrixTypeNestedPlain::CoeffReadCost,
55 template<
typename MatrixType,
typename StorageKind>
class TransposeImpl;
58 :
public TransposeImpl<MatrixType,typename internal::traits<MatrixType>::StorageKind>
67 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Transpose)
69 inline Index rows()
const {
return m_matrix.cols(); }
70 inline Index cols()
const {
return m_matrix.rows(); }
81 typename MatrixType::Nested m_matrix;
86 template<typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::ret>
92 template<
typename MatrixType>
105 typedef typename internal::TransposeImpl_base<MatrixType>::type
Base;
109 inline Index innerStride()
const {
return derived().nestedExpression().innerStride(); }
110 inline Index outerStride()
const {
return derived().nestedExpression().outerStride(); }
118 inline ScalarWithConstIfNotLvalue* data() {
return derived().nestedExpression().data(); }
119 inline const Scalar* data()
const {
return derived().nestedExpression().data(); }
121 inline ScalarWithConstIfNotLvalue& coeffRef(Index rowId, Index colId)
124 return derived().nestedExpression().const_cast_derived().coeffRef(colId, rowId);
127 inline ScalarWithConstIfNotLvalue& coeffRef(Index index)
130 return derived().nestedExpression().const_cast_derived().coeffRef(index);
133 inline const Scalar& coeffRef(Index rowId, Index colId)
const 135 return derived().nestedExpression().coeffRef(colId, rowId);
138 inline const Scalar& coeffRef(Index index)
const 140 return derived().nestedExpression().coeffRef(index);
143 inline CoeffReturnType coeff(Index rowId, Index colId)
const 145 return derived().nestedExpression().coeff(colId, rowId);
148 inline CoeffReturnType coeff(Index index)
const 150 return derived().nestedExpression().coeff(index);
153 template<
int LoadMode>
154 inline const PacketScalar packet(Index rowId, Index colId)
const 156 return derived().nestedExpression().template packet<LoadMode>(colId, rowId);
159 template<
int LoadMode>
160 inline void writePacket(Index rowId, Index colId,
const PacketScalar& x)
162 derived().nestedExpression().const_cast_derived().template writePacket<LoadMode>(colId, rowId, x);
165 template<
int LoadMode>
166 inline const PacketScalar packet(Index index)
const 168 return derived().nestedExpression().template packet<LoadMode>(index);
171 template<
int LoadMode>
172 inline void writePacket(Index index,
const PacketScalar& x)
174 derived().nestedExpression().const_cast_derived().template writePacket<LoadMode>(index, x);
197 template<
typename Derived>
209 template<
typename Derived>
235 template<
typename Derived>
239 return this->transpose();
250 bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) && MatrixType::RowsAtCompileTime!=
Dynamic>
253 template<
typename MatrixType>
256 m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose());
260 template<
typename MatrixType>
263 if (m.rows()==m.cols())
264 m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose());
266 m = m.transpose().eval();
291 template<
typename Derived>
294 eigen_assert((rows() == cols() || (RowsAtCompileTime ==
Dynamic && ColsAtCompileTime ==
Dynamic))
295 &&
"transposeInPlace() called on a non-square non-resizable matrix");
322 template<
typename Derived>
325 derived() = adjoint().eval();
328 #ifndef EIGEN_NO_DEBUG 334 template<
typename BinOp,
typename NestedXpr,
typename Rhs>
339 static inline const XprType extract(
const XprType& x) {
return x; }
342 template<
bool DestIsTransposed,
typename OtherDerived>
348 template<
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
356 template<
typename Scalar,
bool DestIsTransposed,
typename OtherDerived>
359 static bool run(
const Scalar* dest,
const OtherDerived& src)
365 template<
typename Scalar,
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
381 template<
typename Derived,
typename OtherDerived,
382 bool MightHaveTransposeAliasing
388 static void run(
const Derived& dst,
const OtherDerived& other)
391 <
typename Derived::Scalar,blas_traits<Derived>::IsTransposed,OtherDerived>
392 ::run(extract_data(dst), other))
393 &&
"aliasing detected during transposition, use transposeInPlace() " 394 "or evaluate the rhs into a temporary using .eval()");
399 template<
typename Derived,
typename OtherDerived>
402 static void run(
const Derived&,
const OtherDerived&)
409 template<
typename Derived>
410 template<
typename OtherDerived>
419 #endif // EIGEN_TRANSPOSE_H Definition: Transpose.h:55
Definition: gtest_unittest.cc:5031
Definition: DenseCoeffsBase.h:727
Definition: Transpose.h:386
Definition: BlasUtil.h:151
const AdjointReturnType adjoint() const
Definition: Transpose.h:237
Expression of the transpose of a matrix.
Definition: Transpose.h:57
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 RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
internal::remove_all< typename MatrixType::Nested >::type & nestedExpression()
Definition: Transpose.h:78
Eigen::Transpose< Derived > transpose()
Definition: Transpose.h:199
Definition: XprHelper.h:350
const _LhsNested & lhs() const
Definition: CwiseBinaryOp.h:151
Definition: SelfCwiseBinaryOp.h:45
Definition: Transpose.h:87
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:107
const _RhsNested & rhs() const
Definition: CwiseBinaryOp.h:153
Definition: Transpose.h:343
void adjointInPlace()
This is the "in place" version of adjoint(): it replaces *this by its own transpose.
Definition: Transpose.h:323
Definition: BandTriangularSolver.h:13
Definition: DenseCoeffsBase.h:739
Definition: Transpose.h:254
Definition: Transpose.h:357
The type used to identify a dense storage.
Definition: Constants.h:428
Definition: Transpose.h:261
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
void transposeInPlace()
This is the "in place" version of transpose(): it replaces *this by its own transpose.
Definition: Transpose.h:292
Definition: Transpose.h:251
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:459
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
const internal::remove_all< typename MatrixType::Nested >::type & nestedExpression() const
Definition: Transpose.h:74