11 #ifndef EIGEN_TRANSPOSE_H 12 #define EIGEN_TRANSPOSE_H 17 template<
typename MatrixType>
23 RowsAtCompileTime = MatrixType::ColsAtCompileTime,
24 ColsAtCompileTime = MatrixType::RowsAtCompileTime,
25 MaxRowsAtCompileTime = MatrixType::MaxColsAtCompileTime,
26 MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
29 Flags1 = Flags0 | FlagsLvalueBit,
37 template<
typename MatrixType,
typename StorageKind>
class TransposeImpl;
53 :
public TransposeImpl<MatrixType,typename internal::traits<MatrixType>::StorageKind>
64 explicit inline
Transpose(MatrixType& matrix) : m_matrix(matrix) {}
68 EIGEN_DEVICE_FUNC inline
Index rows()
const {
return m_matrix.cols(); }
69 EIGEN_DEVICE_FUNC
inline Index cols()
const {
return m_matrix.rows(); }
83 m_matrix.resize(ncols,nrows);
92 template<typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::ret>
98 template<
typename MatrixType>
107 template<
typename XprType,
typename StorageKind>
121 using Base::coeffRef;
125 EIGEN_DEVICE_FUNC inline
Index innerStride()
const {
return derived().nestedExpression().innerStride(); }
126 EIGEN_DEVICE_FUNC
inline Index outerStride()
const {
return derived().nestedExpression().outerStride(); }
134 EIGEN_DEVICE_FUNC
inline ScalarWithConstIfNotLvalue*
data() {
return derived().nestedExpression().data(); }
135 EIGEN_DEVICE_FUNC
inline const Scalar*
data()
const {
return derived().nestedExpression().data(); }
141 return derived().nestedExpression().coeffRef(colId, rowId);
147 return derived().nestedExpression().coeffRef(index);
170 template<
typename Derived>
182 template<
typename Derived>
208 template<
typename Derived>
221 template<
typename MatrixType,
222 bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) && MatrixType::RowsAtCompileTime!=
Dynamic,
223 bool MatchPacketSize =
228 template<
typename MatrixType>
230 static void run(MatrixType& m) {
231 m.matrix().template triangularView<StrictlyUpper>().
swap(m.matrix().transpose());
236 template<
typename MatrixType>
238 static void run(MatrixType& m) {
239 typedef typename MatrixType::Scalar Scalar;
244 for (
Index i=0; i<PacketSize; ++i)
245 A.
packet[i] = m.template packetByOuterInner<Alignment>(i,0);
247 for (
Index i=0; i<PacketSize; ++i)
248 m.template writePacket<Alignment>(m.rowIndexByOuterInner(i,0), m.colIndexByOuterInner(i,0), A.
packet[i]);
252 template<
typename MatrixType,
bool MatchPacketSize>
254 static void run(MatrixType& m) {
255 if (m.rows()==m.cols())
256 m.matrix().template triangularView<StrictlyUpper>().
swap(m.matrix().transpose());
258 m = m.transpose().eval();
283 template<
typename Derived>
287 &&
"transposeInPlace() called on a non-square non-resizable matrix");
314 template<
typename Derived>
317 derived() = adjoint().eval();
320 #ifndef EIGEN_NO_DEBUG 326 template<
bool DestIsTransposed,
typename OtherDerived>
332 template<
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
340 template<
typename Scalar,
bool DestIsTransposed,
typename OtherDerived>
343 static bool run(
const Scalar* dest,
const OtherDerived& src)
349 template<
typename Scalar,
bool DestIsTransposed,
typename BinOp,
typename DerivedA,
typename DerivedB>
365 template<
typename Derived,
typename OtherDerived,
366 bool MightHaveTransposeAliasing
372 static void run(
const Derived& dst,
const OtherDerived& other)
375 <
typename Derived::Scalar,blas_traits<Derived>::IsTransposed,OtherDerived>
377 &&
"aliasing detected during transposition, use transposeInPlace() " 378 "or evaluate the rhs into a temporary using .eval()");
383 template<
typename Derived,
typename OtherDerived>
386 static void run(
const Derived&,
const OtherDerived&)
391 template<
typename Dst,
typename Src>
399 #endif // EIGEN_NO_DEBUG 403 #endif // EIGEN_TRANSPOSE_H
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
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.
void check_for_aliasing(const Dst &dst, const Src &src)
const unsigned int LvalueBit
internal::ref_selector< MatrixType >::non_const_type MatrixTypeNested
void resize(Index nrows, Index ncols)
internal::TransposeImpl_base< MatrixType >::type Base
const unsigned int RowMajorBit
EIGEN_DEVICE_FUNC const _LhsNested & lhs() const
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
const unsigned int PacketAccessBit
dense_xpr_base< Transpose< MatrixType > >::type type
dense_xpr_base< Transpose< MatrixType > >::type type
Generic expression where a coefficient-wise binary operator is applied to two expressions.
static void run(MatrixType &m)
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index index) const
EIGEN_STRONG_INLINE void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
static void run(const Derived &, const OtherDerived &)
EIGEN_DEVICE_FUNC void adjointInPlace()
EIGEN_DEVICE_FUNC const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
const unsigned int NestByRefBit
EIGEN_DEVICE_FUNC internal::remove_reference< MatrixTypeNested >::type & nestedExpression()
EIGEN_DEVICE_FUNC const Scalar * data() const
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue * data()
static void run(MatrixType &m)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
internal::generic_xpr_base< Transpose< XprType > >::type Base
ref_selector< MatrixType >::type MatrixTypeNested
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
EIGEN_DEVICE_FUNC Index outerStride() const
const T::Scalar * extract_data(const T &m)
EIGEN_DEVICE_FUNC void transposeInPlace()
TransposeImpl< MatrixType, typename internal::traits< MatrixType >::StorageKind >::Base Base
EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const
void run(Expr &expr, Dev &dev)
static void run(const Derived &dst, const OtherDerived &other)
EIGEN_DEVICE_FUNC const _RhsNested & rhs() const
EIGEN_DEVICE_FUNC Index cols() const
internal::ref_selector< MatrixType >::non_const_type m_matrix
static bool run(const Scalar *dest, const OtherDerived &src)
void swap(scoped_array< T > &a, scoped_array< T > &b)
static void run(MatrixType &m)
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index rowId, Index colId) const