10 #ifndef EIGEN_TRANSPOSITIONS_H 11 #define EIGEN_TRANSPOSITIONS_H 48 template<
typename Derived>
55 typedef typename Traits::IndicesType IndicesType;
58 Derived& derived() {
return *
static_cast<Derived*
>(
this); }
59 const Derived& derived()
const {
return *
static_cast<const Derived*
>(
this); }
62 template<
typename OtherDerived>
69 #ifndef EIGEN_PARSED_BY_DOXYGEN 81 inline Index
size()
const {
return indices().size(); }
84 inline const Index&
coeff(Index i)
const {
return indices().coeff(i); }
86 inline Index&
coeffRef(Index i) {
return indices().coeffRef(i); }
88 inline const Index&
operator()(Index i)
const {
return indices()(i); }
90 inline Index&
operator()(Index i) {
return indices()(i); }
92 inline const Index&
operator[](Index i)
const {
return indices()(i); }
94 inline Index&
operator[](Index i) {
return indices()(i); }
97 const IndicesType&
indices()
const {
return derived().indices(); }
99 IndicesType&
indices() {
return derived().indices(); }
104 indices().resize(newSize);
110 for(
int i = 0; i < indices().size(); ++i)
147 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename IndexType>
150 typedef IndexType Index;
155 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename IndexType>
162 typedef typename Traits::IndicesType IndicesType;
168 template<
typename OtherDerived>
170 : m_indices(other.indices()) {}
172 #ifndef EIGEN_PARSED_BY_DOXYGEN 179 template<
typename Other>
184 template<
typename OtherDerived>
187 return Base::operator=(other);
190 #ifndef EIGEN_PARSED_BY_DOXYGEN 196 m_indices = other.m_indices;
207 const IndicesType&
indices()
const {
return m_indices; }
213 IndicesType m_indices;
218 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename IndexType,
int _PacketAccess>
221 typedef IndexType Index;
226 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename IndexType,
int PacketAccess>
228 :
public TranspositionsBase<Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType>,PacketAccess> >
234 typedef typename Traits::IndicesType IndicesType;
237 inline Map(
const Index* indicesPtr)
238 : m_indices(indicesPtr)
241 inline Map(
const Index* indicesPtr, Index
size)
242 : m_indices(indicesPtr,size)
246 template<
typename OtherDerived>
249 return Base::operator=(other);
252 #ifndef EIGEN_PARSED_BY_DOXYGEN 258 m_indices = other.m_indices;
264 const IndicesType&
indices()
const {
return m_indices; }
271 IndicesType m_indices;
275 template<
typename _IndicesType>
279 typedef _IndicesType IndicesType;
283 template<
typename _IndicesType>
291 typedef typename Traits::IndicesType IndicesType;
295 : m_indices(a_indices)
299 template<
typename OtherDerived>
302 return Base::operator=(other);
305 #ifndef EIGEN_PARSED_BY_DOXYGEN 311 m_indices = other.m_indices;
317 const IndicesType&
indices()
const {
return m_indices; }
324 const typename IndicesType::Nested m_indices;
329 template<
typename Derived,
typename TranspositionsDerived>
336 (transpositions.derived(), matrix.derived());
341 template<
typename Derived,
typename TranspositionDerived>
343 <TranspositionDerived, Derived,
OnTheLeft>
348 <TranspositionDerived, Derived,
OnTheLeft>
349 (transpositions.derived(), matrix.derived());
354 template<
typename TranspositionType,
typename MatrixType,
int S
ide,
bool Transposed>
357 typedef typename MatrixType::PlainObject ReturnType;
360 template<
typename TranspositionType,
typename MatrixType,
int S
ide,
bool Transposed>
362 :
public ReturnByValue<transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> >
365 typedef typename TranspositionType::Index Index;
368 : m_transpositions(tr), m_matrix(matrix)
371 inline int rows()
const {
return m_matrix.rows(); }
372 inline int cols()
const {
return m_matrix.cols(); }
374 template<
typename Dest>
inline void evalTo(Dest& dst)
const 376 const int size = m_transpositions.size();
382 for(
int k=(Transposed?size-1:0) ; Transposed?k>=0:k<
size ; Transposed?--k:++k)
383 if((j=m_transpositions.coeff(k))!=k)
386 dst.row(k).swap(dst.row(j));
388 dst.col(k).swap(dst.col(j));
393 const TranspositionType& m_transpositions;
394 typename MatrixType::Nested m_matrix;
401 template<
typename TranspositionsDerived>
404 typedef TranspositionsDerived TranspositionType;
405 typedef typename TranspositionType::IndicesType IndicesType;
408 Transpose(
const TranspositionType& t) : m_transpositions(t) {}
410 inline int size()
const {
return m_transpositions.size(); }
414 template<
typename Derived>
friend 423 template<
typename Derived>
431 const TranspositionType& m_transpositions;
436 #endif // EIGEN_TRANSPOSITIONS_H Index & operator()(Index i)
Direct access to the underlying index vector.
Definition: Transpositions.h:90
Definition: gtest_unittest.cc:5031
Definition: PermutationMatrix.h:491
const IndicesType & indices() const
const version of indices().
Definition: Transpositions.h:264
Apply transformation on the right.
Definition: Constants.h:279
Index size() const
Definition: Transpositions.h:81
Derived & operator=(const TranspositionsBase< OtherDerived > &other)
Copies the other transpositions into *this.
Definition: Transpositions.h:63
Transpositions(const MatrixBase< Other > &a_indices)
Generic constructor from expression of the transposition indices.
Definition: Transpositions.h:180
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
IndicesType & indices()
Definition: Transpositions.h:320
Expression of the transpose of a matrix.
Definition: Transpose.h:57
Derived & operator=(const TranspositionsBase &other)
This is a special case of the templated operator=.
Definition: Transpositions.h:73
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:539
const internal::transposition_matrix_product_retval< TranspositionType, Derived, OnTheLeft, true > operator*(const MatrixBase< Derived > &matrix) const
Definition: Transpositions.h:425
Index & coeffRef(Index i)
Direct access to the underlying index vector.
Definition: Transpositions.h:86
Definition: ReturnByValue.h:50
Map & operator=(const TranspositionsBase< OtherDerived > &other)
Copies the other transpositions into *this.
Definition: Transpositions.h:247
Transpose< TranspositionsBase > inverse() const
Definition: Transpositions.h:136
void resize(int newSize)
Resizes to given size.
Definition: Transpositions.h:102
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
Transpositions & operator=(const TranspositionsBase< OtherDerived > &other)
Copies the other transpositions into *this.
Definition: Transpositions.h:185
Transpositions(const TranspositionsBase< OtherDerived > &other)
Copy constructor.
Definition: Transpositions.h:169
Transpositions & operator=(const Transpositions &other)
This is a special case of the templated operator=.
Definition: Transpositions.h:194
void setIdentity()
Sets *this to represents an identity transformation.
Definition: Transpositions.h:108
Index & operator[](Index i)
Direct access to the underlying index vector.
Definition: Transpositions.h:94
const Index & operator()(Index i) const
Direct access to the underlying index vector.
Definition: Transpositions.h:88
Map & operator=(const Map &other)
This is a special case of the templated operator=.
Definition: Transpositions.h:256
IndicesType & indices()
Definition: Transpositions.h:209
Transpose< TranspositionsBase > transpose() const
Definition: Transpositions.h:140
IndicesType & indices()
Definition: Transpositions.h:267
friend const internal::transposition_matrix_product_retval< TranspositionType, Derived, OnTheRight, true > operator*(const MatrixBase< Derived > &matrix, const Transpose &trt)
Definition: Transpositions.h:416
Definition: BandTriangularSolver.h:13
IndicesType & indices()
Definition: Transpositions.h:99
const IndicesType & indices() const
const version of indices().
Definition: Transpositions.h:207
TranspositionsWrapper & operator=(const TranspositionsBase< OtherDerived > &other)
Copies the other transpositions into *this.
Definition: Transpositions.h:300
const IndicesType & indices() const
const version of indices().
Definition: Transpositions.h:317
const Index & coeff(Index i) const
Direct access to the underlying index vector.
Definition: Transpositions.h:84
Transpositions(Index size)
Constructs an uninitialized permutation matrix of given size.
Definition: Transpositions.h:203
const Index & operator[](Index i) const
Direct access to the underlying index vector.
Definition: Transpositions.h:92
const IndicesType & indices() const
const version of indices().
Definition: Transpositions.h:97
Transpositions(const Transpositions &other)
Standard copy constructor.
Definition: Transpositions.h:175
Definition: Transpositions.h:49
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Definition: Transpositions.h:45
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Represents a sequence of transpositions (row/column interchange)
Definition: Transpositions.h:156
Apply transformation on the left.
Definition: Constants.h:277
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
TranspositionsWrapper & operator=(const TranspositionsWrapper &other)
This is a special case of the templated operator=.
Definition: Transpositions.h:309