Represents a sequence of transpositions (row/column interchange)
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 . It is internally stored as a vector of integers
indices
. Each transposition applied on the left of a matrix (
) interchanges the rows
i
and indices
[i] of the matrix M
. A transposition applied on the right (e.g., ) 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.
Definition at line 62 of file Transpositions.h.
#include <src/Core/Transpositions.h>
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> | |
Transpositions & | operator= (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 Index & | coeff (Index i) const |
Direct access to the underlying index vector. | |
Index & | coeffRef (Index i) |
Direct access to the underlying index vector. | |
const Index & | operator() (Index i) const |
Direct access to the underlying index vector. | |
Index & | operator() (Index i) |
Direct access to the underlying index vector. | |
const Index & | operator[] (Index i) const |
Direct access to the underlying index vector. | |
Index & | operator[] (Index i) |
Direct access to the underlying index vector. | |
const IndicesType & | indices () const |
const version of indices(). | |
IndicesType & | indices () |
void | resize (int size) |
Resizes to given size. | |
void | setIdentity () |
Sets *this to represents an identity transformation. | |
Transpose< Transpositions > | inverse () const |
Transpose< Transpositions > | transpose () const |
Protected Attributes | |
IndicesType | m_indices |
typedef IndicesType::Index Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Index |
Definition at line 67 of file Transpositions.h.
typedef Matrix<DenseIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::IndicesType |
Definition at line 66 of file Transpositions.h.
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Transpositions | ( | ) | [inline] |
Definition at line 69 of file Transpositions.h.
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Transpositions | ( | const Transpositions< OtherSize, OtherMaxSize > & | other | ) | [inline] |
Copy constructor.
Definition at line 73 of file Transpositions.h.
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.
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::Transpositions | ( | Index | size | ) | [inline] |
Constructs an uninitialized permutation matrix of given size.
Definition at line 108 of file Transpositions.h.
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=().
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::coeffRef | ( | Index | i | ) | [inline] |
Direct access to the underlying index vector.
Definition at line 117 of file Transpositions.h.
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=().
IndicesType& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::indices | ( | ) | [inline] |
Definition at line 130 of file Transpositions.h.
Transpose<Transpositions> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::inverse | ( | ) | const [inline] |
Definition at line 167 of file Transpositions.h.
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.
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator() | ( | Index | i | ) | [inline] |
Direct access to the underlying index vector.
Definition at line 121 of file Transpositions.h.
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.
Index& Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::operator[] | ( | Index | i | ) | [inline] |
Direct access to the underlying index vector.
Definition at line 125 of file Transpositions.h.
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.
void Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::resize | ( | int | size | ) | [inline] |
Resizes to given size.
Definition at line 133 of file Transpositions.h.
void Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity | ( | ) | [inline] |
Sets *this
to represents an identity transformation.
Definition at line 139 of file Transpositions.h.
Index Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::size | ( | ) | const [inline] |
Definition at line 112 of file Transpositions.h.
Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().
Transpose<Transpositions> Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::transpose | ( | ) | const [inline] |
Definition at line 171 of file Transpositions.h.
IndicesType Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime >::m_indices [protected] |
Definition at line 188 of file Transpositions.h.
Referenced by Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::coeff(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::coeffRef(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::indices(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::operator()(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::operator[](), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::resize(), Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::setIdentity(), and Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime >::size().
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011 |