Permutation matrix.
SizeAtCompileTime | the number of rows/cols, or Dynamic | |
MaxSizeAtCompileTime | the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. |
This class represents a permutation matrix, internally stored as a vector of integers. The convention followed here is that if is a permutation, the corresponding permutation matrix
is such that if
is the canonical basis, we have:
This convention ensures that for any two permutations , we have:
Permutation matrices are square and invertible.
Notice that in addition to the member functions and operators listed here, there also are non-member operator* to multiply a PermutationMatrix with any kind of matrix expression (MatrixBase) on either side.
Definition at line 64 of file PermutationMatrix.h.
#include <src/Core/PermutationMatrix.h>
Public Types | |
typedef Matrix< int, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1 > | IndicesType |
Public Member Functions | |
PermutationMatrix () | |
PermutationMatrix (int size) | |
Constructs an uninitialized permutation matrix of given size. | |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix (const PermutationMatrix< OtherSize, OtherMaxSize > &other) | |
Copy constructor. | |
template<typename Other > | |
PermutationMatrix (const MatrixBase< Other > &indices) | |
Generic constructor from expression of the indices. | |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix (const Transpositions< OtherSize, OtherMaxSize > &tr) | |
Convert the Transpositions tr to a permutation matrix. | |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix & | operator= (const PermutationMatrix< OtherSize, OtherMaxSize > &other) |
Copies the other permutation into *this. | |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix & | operator= (const Transpositions< OtherSize, OtherMaxSize > &tr) |
Assignment from the Transpositions tr. | |
Index | rows () const |
Index | cols () const |
Index | size () const |
DenseMatrixType | toDenseMatrix () const |
const IndicesType & | indices () const |
const version of indices(). | |
IndicesType & | indices () |
void | resize (Index size) |
Resizes to given size. | |
void | setIdentity () |
Sets *this to be the identity permutation matrix. | |
void | setIdentity (Index size) |
Sets *this to be the identity permutation matrix of given size. | |
PermutationMatrix & | applyTranspositionOnTheLeft (Index i, Index j) |
Multiplies *this by the transposition ![]() | |
PermutationMatrix & | applyTranspositionOnTheRight (Index i, Index j) |
Multiplies *this by the transposition ![]() | |
Transpose< PermutationMatrix > | inverse () const |
Transpose< PermutationMatrix > | transpose () const |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix | operator* (const PermutationMatrix< OtherSize, OtherMaxSize > &other) const |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix | operator* (const Transpose< PermutationMatrix< OtherSize, OtherMaxSize > > &other) const |
Protected Attributes | |
IndicesType | m_indices |
Friends | |
template<int OtherSize, int OtherMaxSize> | |
PermutationMatrix | operator* (const Transpose< PermutationMatrix< OtherSize, OtherMaxSize > > &other, const PermutationMatrix &perm) |
typedef Matrix<int, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::IndicesType |
Definition at line 84 of file PermutationMatrix.h.
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::PermutationMatrix | ( | ) | [inline] |
Definition at line 86 of file PermutationMatrix.h.
Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator*().
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::PermutationMatrix | ( | int | size | ) | [inline] |
Constructs an uninitialized permutation matrix of given size.
Definition at line 91 of file PermutationMatrix.h.
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::PermutationMatrix | ( | const PermutationMatrix< OtherSize, OtherMaxSize > & | other | ) | [inline] |
Copy constructor.
Definition at line 96 of file PermutationMatrix.h.
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::PermutationMatrix | ( | const MatrixBase< Other > & | indices | ) | [inline, explicit] |
Generic constructor from expression of the indices.
The indices array has the meaning that the permutations sends each integer i to indices[i].
Definition at line 113 of file PermutationMatrix.h.
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::PermutationMatrix | ( | const Transpositions< OtherSize, OtherMaxSize > & | tr | ) | [inline, explicit] |
Convert the Transpositions tr to a permutation matrix.
Definition at line 118 of file PermutationMatrix.h.
PermutationMatrix& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::applyTranspositionOnTheLeft | ( | Index | i, | |
Index | j | |||
) | [inline] |
Multiplies *this by the transposition on the left.
Definition at line 217 of file PermutationMatrix.h.
PermutationMatrix& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::applyTranspositionOnTheRight | ( | Index | i, | |
Index | j | |||
) | [inline] |
Multiplies *this by the transposition on the right.
This is a fast operation, it only consists in swapping two indices.
Definition at line 236 of file PermutationMatrix.h.
Referenced by FullPivLU< _MatrixType >::compute(), FullPivHouseholderQR< _MatrixType >::compute(), ColPivHouseholderQR< _MatrixType >::compute(), and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().
Index PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::cols | ( | void | ) | const [inline] |
Reimplemented from EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime > >.
Definition at line 157 of file PermutationMatrix.h.
IndicesType& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::indices | ( | ) | [inline] |
Definition at line 184 of file PermutationMatrix.h.
const IndicesType& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::indices | ( | ) | const [inline] |
const version of indices().
Definition at line 182 of file PermutationMatrix.h.
Referenced by SparseSymmetricPermutationProduct< MatrixType, UpLo >::evalTo(), and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().
Transpose<PermutationMatrix> PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::inverse | ( | ) | const [inline] |
Definition at line 247 of file PermutationMatrix.h.
Referenced by PartialPivLU< _MatrixType >::reconstructedMatrix(), and FullPivLU< _MatrixType >::reconstructedMatrix().
PermutationMatrix PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::operator* | ( | const PermutationMatrix< OtherSize, OtherMaxSize > & | other | ) | const [inline] |
PermutationMatrix PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::operator* | ( | const Transpose< PermutationMatrix< OtherSize, OtherMaxSize > > & | other | ) | const [inline] |
Definition at line 290 of file PermutationMatrix.h.
PermutationMatrix& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::operator= | ( | const PermutationMatrix< OtherSize, OtherMaxSize > & | other | ) | [inline] |
Copies the other permutation into *this.
Definition at line 126 of file PermutationMatrix.h.
PermutationMatrix& PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::operator= | ( | const Transpositions< OtherSize, OtherMaxSize > & | tr | ) | [inline] |
Assignment from the Transpositions tr.
Definition at line 134 of file PermutationMatrix.h.
void PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::resize | ( | Index | size | ) | [inline] |
Resizes to given size.
Definition at line 188 of file PermutationMatrix.h.
Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::setIdentity().
Index PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::rows | ( | void | ) | const [inline] |
Reimplemented from EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime > >.
Definition at line 154 of file PermutationMatrix.h.
void PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity | ( | Index | size | ) | [inline] |
Sets *this to be the identity permutation matrix of given size.
Definition at line 202 of file PermutationMatrix.h.
void PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity | ( | ) | [inline] |
Sets *this to be the identity permutation matrix.
Definition at line 194 of file PermutationMatrix.h.
Referenced by FullPivLU< _MatrixType >::compute(), FullPivHouseholderQR< _MatrixType >::compute(), ColPivHouseholderQR< _MatrixType >::compute(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=(), and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::setIdentity().
Index PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::size | ( | ) | const [inline] |
Reimplemented from EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime > >.
Definition at line 160 of file PermutationMatrix.h.
Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().
DenseMatrixType PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::toDenseMatrix | ( | ) | const [inline] |
Transpose<PermutationMatrix> PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::transpose | ( | ) | const [inline] |
PermutationMatrix operator* | ( | const Transpose< PermutationMatrix< OtherSize, OtherMaxSize > > & | other, | |
const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime > & | perm | |||
) | [friend] |
Definition at line 298 of file PermutationMatrix.h.
IndicesType PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime >::m_indices [protected] |
Definition at line 303 of file PermutationMatrix.h.
Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::applyTranspositionOnTheLeft(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::applyTranspositionOnTheRight(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::cols(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::indices(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::resize(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::rows(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::setIdentity(), and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::size().
Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011 |