Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Protected Attributes

Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime > Class Template Reference


Detailed Description

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

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

Definition at line 62 of file Transpositions.h.

#include <src/Core/Transpositions.h>

Inheritance diagram for Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Matrix< DenseIndex,
SizeAtCompileTime,
1, 0, MaxSizeAtCompileTime, 1 > 
IndicesType
typedef IndicesType::Index Index

Public Member Functions

 Transpositions ()
template<int OtherSize, int OtherMaxSize>
 Transpositions (const Transpositions< OtherSize, OtherMaxSize > &other)
 Copy constructor.
template<typename Other >
 Transpositions (const MatrixBase< Other > &indices)
 Generic constructor from expression of the transposition indices.
template<int OtherSize, int OtherMaxSize>
Transpositionsoperator= (const Transpositions< OtherSize, OtherMaxSize > &other)
 Copies the other transpositions into *this.
 Transpositions (Index size)
 Constructs an uninitialized permutation matrix of given size.
Index size () const
const Indexcoeff (Index i) const
 Direct access to the underlying index vector.
IndexcoeffRef (Index i)
 Direct access to the underlying index vector.
const Indexoperator() (Index i) const
 Direct access to the underlying index vector.
Indexoperator() (Index i)
 Direct access to the underlying index vector.
const Indexoperator[] (Index i) const
 Direct access to the underlying index vector.
Indexoperator[] (Index i)
 Direct access to the underlying index vector.
const IndicesTypeindices () const
 const version of indices().
IndicesTypeindices ()
void resize (int size)
 Resizes to given size.
void setIdentity ()
 Sets *this to represents an identity transformation.
Transpose< Transpositionsinverse () const
Transpose< Transpositionstranspose () const

Protected Attributes

IndicesType m_indices

Member Typedef Documentation

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
typedef IndicesType::Index Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Index

Definition at line 67 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
typedef Matrix<DenseIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::IndicesType

Definition at line 66 of file Transpositions.h.


Constructor & Destructor Documentation

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Transpositions ( ) [inline]

Definition at line 69 of file Transpositions.h.

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

Copy constructor.

Definition at line 73 of file Transpositions.h.

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

Generic constructor from expression of the transposition indices.

Definition at line 84 of file Transpositions.h.

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

Constructs an uninitialized permutation matrix of given size.

Definition at line 108 of file Transpositions.h.


Member Function Documentation

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
const Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::coeff ( Index  i) const [inline]

Direct access to the underlying index vector.

Definition at line 115 of file Transpositions.h.

Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::coeffRef ( Index  i) [inline]

Direct access to the underlying index vector.

Definition at line 117 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
const IndicesType& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::indices ( ) const [inline]

const version of indices().

Definition at line 128 of file Transpositions.h.

Referenced by Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().

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

Definition at line 130 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Transpose<Transpositions> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::inverse ( ) const [inline]
Returns:
the inverse transformation

Definition at line 167 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
const Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator() ( Index  i) const [inline]

Direct access to the underlying index vector.

Definition at line 119 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator() ( Index  i) [inline]

Direct access to the underlying index vector.

Definition at line 121 of file Transpositions.h.

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

Copies the other transpositions into *this.

Definition at line 89 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator[] ( Index  i) [inline]

Direct access to the underlying index vector.

Definition at line 125 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
const Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator[] ( Index  i) const [inline]

Direct access to the underlying index vector.

Definition at line 123 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::resize ( int  size) [inline]

Resizes to given size.

Definition at line 133 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity ( ) [inline]

Sets *this to represents an identity transformation.

Definition at line 139 of file Transpositions.h.

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Index Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::size ( ) const [inline]
Returns:
the number of transpositions

Definition at line 112 of file Transpositions.h.

Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().

template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
Transpose<Transpositions> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::transpose ( ) const [inline]
Returns:
the tranpose transformation

Definition at line 171 of file Transpositions.h.


Member Data Documentation

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



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011