11 #ifndef EIGEN_TRANSPOSE_H 12 #define EIGEN_TRANSPOSE_H 31 template<
typename MatrixType>
34 typedef typename MatrixType::Scalar
Scalar;
40 RowsAtCompileTime = MatrixType::ColsAtCompileTime,
41 ColsAtCompileTime = MatrixType::RowsAtCompileTime,
42 MaxRowsAtCompileTime = MatrixType::MaxColsAtCompileTime,
43 MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
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>
69 inline Index rows()
const {
return m_matrix.cols(); }
70 inline Index
cols()
const {
return m_matrix.rows(); }
86 template<typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::ret>
92 template<
typename MatrixType>
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);
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>
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();
249 template<
typename MatrixType,
250 bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) && MatrixType::RowsAtCompileTime!=
Dynamic>
253 template<
typename MatrixType>
255 static void run(MatrixType& m) {
256 m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose());
260 template<
typename MatrixType>
262 static void run(MatrixType& m) {
263 if (m.rows()==m.cols())
264 m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose());
266 m = m.transpose().eval();
290 template<
typename Derived>
294 &&
"transposeInPlace() called on a non-square non-resizable matrix");
320 template<
typename Derived>
323 derived() = adjoint().eval();
326 #ifndef EIGEN_NO_DEBUG 332 template<
typename BinOp,
typename NestedXpr,
typename Rhs>
337 static inline const XprType
extract(
const XprType& x) {
return x; }
340 template<
bool DestIsTransposed,
typename OtherDerived>
346 template<
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
354 template<
typename Scalar,
bool DestIsTransposed,
typename OtherDerived>
357 static bool run(
const Scalar* dest,
const OtherDerived& src)
363 template<
typename Scalar,
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
379 template<
typename Derived,
typename OtherDerived,
380 bool MightHaveTransposeAliasing
386 static void run(
const Derived& dst,
const OtherDerived& other)
389 <
typename Derived::Scalar,blas_traits<Derived>::IsTransposed,OtherDerived>
391 &&
"aliasing detected during transposition, use transposeInPlace() " 392 "or evaluate the rhs into a temporary using .eval()");
397 template<
typename Derived,
typename OtherDerived>
400 static void run(
const Derived&,
const OtherDerived&)
407 template<
typename Derived>
408 template<
typename OtherDerived>
417 #endif // EIGEN_TRANSPOSE_H #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
const _RhsNested & rhs() const
ScalarWithConstIfNotLvalue * data()
const PacketScalar packet(Index rowId, Index colId) const
static bool run(const Scalar *dest, const CwiseBinaryOp< BinOp, DerivedA, DerivedB > &src)
internal::conditional< internal::is_lvalue< MatrixType >::value, Scalar, const Scalar >::type ScalarWithConstIfNotLvalue
remove_reference< MatrixTypeNested >::type MatrixTypeNestedPlain
Expression of the transpose of a matrix.
traits< MatrixType >::XprKind XprKind
const unsigned int LvalueBit
static void run(MatrixType &m)
const Scalar * data() const
internal::TransposeImpl_base< MatrixType >::type Base
iterative scaling algorithm to equilibrate rows and column norms in matrices
const PacketScalar packet(Index index) const
void checkTransposeAliasing(const OtherDerived &other) const
void writePacket(Index rowId, Index colId, const PacketScalar &x)
const unsigned int RowMajorBit
internal::remove_all< typename MatrixType::Nested >::type & nestedExpression()
CoeffReturnType coeff(Index index) const
MatrixType::Scalar Scalar
Eigen::Transpose< Derived > transpose()
#define EIGEN_STATIC_ASSERT_LVALUE(Derived)
ScalarWithConstIfNotLvalue & coeffRef(Index index)
dense_xpr_base< Transpose< MatrixType > >::type type
dense_xpr_base< Transpose< MatrixType > >::type type
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
static const XprType extract(const XprType &x)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const Scalar & coeffRef(Index rowId, Index colId) const
MatrixType::Nested m_matrix
static void run(const Derived &, const OtherDerived &)
traits< MatrixType >::StorageKind StorageKind
ScalarWithConstIfNotLvalue & coeffRef(Index rowId, Index colId)
const _LhsNested & lhs() const
const unsigned int NestByRefBit
SelfCwiseBinaryOp< BinOp, NestedXpr, Rhs > XprType
Index outerStride() const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
CoeffReturnType coeff(Index rowId, Index colId) const
const T::Scalar * extract_data(const T &m)
TransposeImpl< MatrixType, typename internal::traits< MatrixType >::StorageKind >::Base Base
const AdjointReturnType adjoint() const
static void run(const Derived &dst, const OtherDerived &other)
const internal::remove_all< typename MatrixType::Nested >::type & nestedExpression() const
const Scalar & coeffRef(Index index) const
static void run(MatrixType &m)
nested< MatrixType >::type MatrixTypeNested
void writePacket(Index index, const PacketScalar &x)
static bool run(const Scalar *dest, const OtherDerived &src)