Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

Represents a sequence of transpositions (row/column interchange) More...

#include <Transpositions.h>

Public Member Functions

const Index & coeff (Index i) const
 
Index & coeffRef (Index i)
 
IndicesType & indices ()
 
const IndicesType & indices () const
 
Transpose< TranspositionsBase > inverse () const
 
Index & operator() (Index i)
 
const Index & operator() (Index i) const
 
template<typename OtherDerived>
Transpositionsoperator= (const TranspositionsBase< OtherDerived > &other)
 
Index & operator[] (Index i)
 
const Index & operator[] (Index i) const
 
void resize (int size)
 
void setIdentity ()
 
Index size () const
 
Transpose< TranspositionsBase > transpose () const
 
template<typename Other>
 Transpositions (const MatrixBase< Other > &indices)
 
template<typename OtherDerived>
 Transpositions (const TranspositionsBase< OtherDerived > &other)
 
 Transpositions (Index size)
 

Detailed Description

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
class Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >

Represents a sequence of transpositions (row/column interchange)

Parameters
SizeAtCompileTimethe number of transpositions, or Dynamic
MaxSizeAtCompileTimethe maximum number of transpositions, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it.

This class represents a permutation transformation as a sequence of n transpositions $[T_{n-1} \ldots T_{i} \ldots T_{0}]$. It is internally stored as a vector of integers indices. Each transposition $ T_{i} $ applied on the left of a matrix ( $ T_{i} M$) interchanges the rows i and indices[i] of the matrix M. A transposition applied on the right (e.g., $ M T_{i}$) yields a column interchange.

Compared to the class PermutationMatrix, such a sequence of transpositions is what is computed during a decomposition with pivoting, and it is faster when applying the permutation in-place.

To apply a sequence of transpositions to a matrix, simply use the operator * as in the following example:

Transpositions tr;
MatrixXf mat;
mat = tr * mat;

In this example, we detect that the matrix appears on both side, and so the transpositions are applied in-place without any temporary or extra copy.

See also
class PermutationMatrix

Constructor & Destructor Documentation

◆ Transpositions() [1/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename OtherDerived>
Transpositions ( const TranspositionsBase< OtherDerived > & other)
inline

Copy constructor.

◆ Transpositions() [2/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other>
Transpositions ( const MatrixBase< Other > & indices)
inlineexplicit

Generic constructor from expression of the transposition indices.

◆ Transpositions() [3/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
Transpositions ( Index size)
inline

Constructs an uninitialized permutation matrix of given size.

Member Function Documentation

◆ coeff()

template<typename Derived>
const Index & coeff ( Index i) const
inlineinherited

Direct access to the underlying index vector

◆ coeffRef()

template<typename Derived>
Index & coeffRef ( Index i)
inlineinherited

Direct access to the underlying index vector

◆ indices() [1/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
IndicesType & indices ( )
inline
Returns
a reference to the stored array representing the transpositions.

◆ indices() [2/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
const IndicesType & indices ( ) const
inline

const version of indices().

◆ inverse()

template<typename Derived>
Transpose< TranspositionsBase > inverse ( ) const
inlineinherited
Returns
the inverse transformation

◆ operator()() [1/2]

template<typename Derived>
Index & operator() ( Index i)
inlineinherited

Direct access to the underlying index vector

◆ operator()() [2/2]

template<typename Derived>
const Index & operator() ( Index i) const
inlineinherited

Direct access to the underlying index vector

◆ operator=()

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename OtherDerived>
Transpositions & operator= ( const TranspositionsBase< OtherDerived > & other)
inline

Copies the other transpositions into *this

◆ operator[]() [1/2]

template<typename Derived>
Index & operator[] ( Index i)
inlineinherited

Direct access to the underlying index vector

◆ operator[]() [2/2]

template<typename Derived>
const Index & operator[] ( Index i) const
inlineinherited

Direct access to the underlying index vector

◆ resize()

template<typename Derived>
void resize ( int size)
inlineinherited

Resizes to given size.

◆ setIdentity()

template<typename Derived>
void setIdentity ( )
inlineinherited

Sets *this to represents an identity transformation

◆ size()

template<typename Derived>
Index size ( ) const
inlineinherited
Returns
the number of transpositions

◆ transpose()

template<typename Derived>
Transpose< TranspositionsBase > transpose ( ) const
inlineinherited
Returns
the tranpose transformation

The documentation for this class was generated from the following file: