Public Types | Public Member Functions | Protected Attributes

Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

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

#include <Transpositions.h>

Inheritance diagram for Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >:
TranspositionsBase< Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >

List of all members.

Public Types

typedef TranspositionsBase
< Transpositions
Base
typedef Traits::IndicesType IndicesType
typedef IndicesType::Scalar Index

Public Member Functions

 Transpositions ()
template<typename OtherDerived >
 Transpositions (const TranspositionsBase< OtherDerived > &other)
 Transpositions (const Transpositions &other)
template<typename Other >
 Transpositions (const MatrixBase< Other > &indices)
template<typename OtherDerived >
Transpositionsoperator= (const TranspositionsBase< OtherDerived > &other)
Transpositionsoperator= (const Transpositions &other)
 Transpositions (Index size)
const IndicesTypeindices () const
IndicesTypeindices ()

Protected Attributes

IndicesType m_indices

Detailed Description

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

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

Parameters:
SizeAtCompileTime the number of transpositions, or Dynamic
MaxSizeAtCompileTime the 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

Member Typedef Documentation

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
typedef TranspositionsBase<Transpositions> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Base
template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
typedef IndicesType::Scalar Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Index
template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
typedef Traits::IndicesType Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::IndicesType

Constructor & Destructor Documentation

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

Copy constructor.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Transpositions ( const Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > &  other  )  [inline]

Standard copy constructor. Defined only to prevent a default copy constructor from hiding the other templated constructor

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other >
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Transpositions ( const MatrixBase< Other > &  indices  )  [inline, explicit]

Generic constructor from expression of the transposition indices.

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

Constructs an uninitialized permutation matrix of given size.


Member Function Documentation

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

Reimplemented from TranspositionsBase< Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >.

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

Copies the other transpositions into *this

Reimplemented from TranspositionsBase< Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
Transpositions& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::operator= ( const Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > &  other  )  [inline]

This is a special case of the templated operator=. Its purpose is to prevent a default operator= from hiding the templated operator=.


Member Data Documentation

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
IndicesType Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::m_indices [protected]

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