Base class for permutations. More...
#include <PermutationMatrix.h>
Public Types | |
enum | { Flags = Traits::Flags, CoeffReadCost = Traits::CoeffReadCost, RowsAtCompileTime = Traits::RowsAtCompileTime, ColsAtCompileTime = Traits::ColsAtCompileTime, MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = Traits::MaxColsAtCompileTime } |
typedef Traits::IndicesType | IndicesType |
typedef Traits::Scalar | Scalar |
typedef Traits::Index | Index |
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime > | DenseMatrixType |
typedef PermutationMatrix < IndicesType::SizeAtCompileTime, IndicesType::MaxSizeAtCompileTime, Index > | PlainPermutationType |
Public Member Functions | |
template<typename OtherDerived > | |
Derived & | operator= (const PermutationBase< OtherDerived > &other) |
template<typename OtherDerived > | |
Derived & | operator= (const TranspositionsBase< OtherDerived > &tr) |
Derived & | operator= (const PermutationBase &other) |
Index | rows () const |
Index | cols () const |
Index | size () const |
template<typename DenseDerived > | |
void | evalTo (MatrixBase< DenseDerived > &other) const |
DenseMatrixType | toDenseMatrix () const |
const IndicesType & | indices () const |
IndicesType & | indices () |
void | resize (Index size) |
void | setIdentity () |
void | setIdentity (Index size) |
Derived & | applyTranspositionOnTheLeft (Index i, Index j) |
Derived & | applyTranspositionOnTheRight (Index i, Index j) |
Transpose< PermutationBase > | inverse () const |
Transpose< PermutationBase > | transpose () const |
template<typename Other > | |
PlainPermutationType | operator* (const PermutationBase< Other > &other) const |
template<typename Other > | |
PlainPermutationType | operator* (const Transpose< PermutationBase< Other > > &other) const |
Protected Member Functions | |
template<typename OtherDerived > | |
void | assignTranspose (const PermutationBase< OtherDerived > &other) |
template<typename Lhs , typename Rhs > | |
void | assignProduct (const Lhs &lhs, const Rhs &rhs) |
Friends | |
template<typename Other > | |
PlainPermutationType | operator* (const Transpose< PermutationBase< Other > > &other, const PermutationBase &perm) |
Base class for permutations.
Derived | the derived class |
This class is the base class for all expressions representing 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 any kind of permutation object with any kind of matrix expression (MatrixBase) on either side.
typedef Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime,0,MaxRowsAtCompileTime,MaxColsAtCompileTime> PermutationBase< Derived >::DenseMatrixType |
typedef Traits::Index PermutationBase< Derived >::Index |
Reimplemented from EigenBase< Derived >.
Reimplemented in Map< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, _PacketAccess >.
typedef Traits::IndicesType PermutationBase< Derived >::IndicesType |
Reimplemented in PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, Map< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, _PacketAccess >, PermutationWrapper< _IndicesType >, PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime >, and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >.
typedef PermutationMatrix<IndicesType::SizeAtCompileTime,IndicesType::MaxSizeAtCompileTime,Index> PermutationBase< Derived >::PlainPermutationType |
typedef Traits::Scalar PermutationBase< Derived >::Scalar |
anonymous enum |
Derived& PermutationBase< Derived >::applyTranspositionOnTheLeft | ( | Index | i, | |
Index | j | |||
) | [inline] |
Multiplies *this by the transposition on the left.
Derived& PermutationBase< Derived >::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.
void PermutationBase< Derived >::assignProduct | ( | const Lhs & | lhs, | |
const Rhs & | rhs | |||
) | [inline, protected] |
void PermutationBase< Derived >::assignTranspose | ( | const PermutationBase< OtherDerived > & | other | ) | [inline, protected] |
Index PermutationBase< Derived >::cols | ( | void | ) | const [inline] |
Reimplemented from EigenBase< Derived >.
void PermutationBase< Derived >::evalTo | ( | MatrixBase< DenseDerived > & | other | ) | const [inline] |
const IndicesType& PermutationBase< Derived >::indices | ( | ) | const [inline] |
const version of indices().
Reimplemented in PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, Map< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, _PacketAccess >, PermutationWrapper< _IndicesType >, PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime >, and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >.
IndicesType& PermutationBase< Derived >::indices | ( | ) | [inline] |
Reimplemented in PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, Map< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >, _PacketAccess >, PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime >, and PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >.
Transpose<PermutationBase> PermutationBase< Derived >::inverse | ( | ) | const [inline] |
PlainPermutationType PermutationBase< Derived >::operator* | ( | const PermutationBase< Other > & | other | ) | const [inline] |
PlainPermutationType PermutationBase< Derived >::operator* | ( | const Transpose< PermutationBase< Other > > & | other | ) | const [inline] |
Derived& PermutationBase< Derived >::operator= | ( | const PermutationBase< OtherDerived > & | other | ) | [inline] |
Copies the other permutation into *this
Derived& PermutationBase< Derived >::operator= | ( | const TranspositionsBase< OtherDerived > & | tr | ) | [inline] |
Assignment from the Transpositions tr
Derived& PermutationBase< Derived >::operator= | ( | const PermutationBase< Derived > & | other | ) | [inline] |
This is a special case of the templated operator=. Its purpose is to prevent a default operator= from hiding the templated operator=.
void PermutationBase< Derived >::resize | ( | Index | size | ) | [inline] |
Resizes to given size.
Index PermutationBase< Derived >::rows | ( | void | ) | const [inline] |
Reimplemented from EigenBase< Derived >.
void PermutationBase< Derived >::setIdentity | ( | ) | [inline] |
Sets *this to be the identity permutation matrix
void PermutationBase< Derived >::setIdentity | ( | Index | size | ) | [inline] |
Sets *this to be the identity permutation matrix of given size.
Index PermutationBase< Derived >::size | ( | ) | const [inline] |
Reimplemented from EigenBase< Derived >.
DenseMatrixType PermutationBase< Derived >::toDenseMatrix | ( | ) | const [inline] |
Transpose<PermutationBase> PermutationBase< Derived >::transpose | ( | ) | const [inline] |
PlainPermutationType operator* | ( | const Transpose< PermutationBase< Other > > & | other, | |
const PermutationBase< Derived > & | perm | |||
) | [friend] |