Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Friends
Eigen::PermutationBase< Derived > Class Template Reference

Base class for permutations. More...

#include <PermutationMatrix.h>

Inheritance diagram for Eigen::PermutationBase< Derived >:
Eigen::EigenBase< Derived > Eigen::PermutationMatrix< Dynamic, Dynamic, StorageIndex >

Public Types

enum  {
  Flags = Traits::Flags , RowsAtCompileTime = Traits::RowsAtCompileTime , ColsAtCompileTime = Traits::ColsAtCompileTime , MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime ,
  MaxColsAtCompileTime = Traits::MaxColsAtCompileTime
}
 
typedef Traits::IndicesType IndicesType
 
typedef Traits::StorageIndex StorageIndex
 
typedef Matrix< StorageIndex, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime > DenseMatrixType
 
typedef PermutationMatrix< IndicesType::SizeAtCompileTime, IndicesType::MaxSizeAtCompileTime, StorageIndex > PlainPermutationType
 
typedef PlainPermutationType PlainObject
 
typedef Inverse< Derived > InverseReturnType
 
typedef void Scalar
 
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices.
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

Public Member Functions

template<typename OtherDerived >
Derived & operator= (const PermutationBase< OtherDerived > &other)
 Copies the other permutation into *this.
 
template<typename OtherDerived >
Derived & operator= (const TranspositionsBase< OtherDerived > &tr)
 Assignment from the Transpositions tr.
 
Derived & operator= (const PermutationBase &other)
 This is a special case of the templated operator=.
 
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
 const version of indices().
 
IndicesType & indices ()
 
void resize (Index newSize)
 Resizes to given size.
 
void setIdentity ()
 Sets *this to be the identity permutation matrix.
 
void setIdentity (Index newSize)
 Sets *this to be the identity permutation matrix of given size.
 
Derived & applyTranspositionOnTheLeft (Index i, Index j)
 Multiplies *this by the transposition $(ij)$ on the left.
 
Derived & applyTranspositionOnTheRight (Index i, Index j)
 Multiplies *this by the transposition $(ij)$ on the right.
 
InverseReturnType inverse () const
 
InverseReturnType transpose () const
 
template<typename Other >
PlainPermutationType operator* (const PermutationBase< Other > &other) const
 
template<typename Other >
PlainPermutationType operator* (const InverseImpl< Other, PermutationStorage > &other) const
 
Index determinant () const
 
EIGEN_DEVICE_FUNC Derived & derived ()
 
EIGEN_DEVICE_FUNC const Derived & derived () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
EIGEN_DEVICE_FUNC Derived & derived ()
 
EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC Derived & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const Derived & const_derived () const
 
EIGEN_DEVICE_FUNC Index rows () const
 
EIGEN_DEVICE_FUNC Index cols () const
 
EIGEN_DEVICE_FUNC Index size () const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) 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 InverseImpl< Other, PermutationStorage > &other, const PermutationBase &perm)
 

Detailed Description

template<typename Derived>
class Eigen::PermutationBase< Derived >

Base class for permutations.

Parameters
Derivedthe 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 $ \sigma $ is a permutation, the corresponding permutation matrix $ P_\sigma $ is such that if $ (e_1,\ldots,e_p) $ is the canonical basis, we have:

\[ P_\sigma(e_i) = e_{\sigma(i)}. \]

This convention ensures that for any two permutations $ \sigma, \tau $, we have:

\[ P_{\sigma\circ\tau} = P_\sigma P_\tau. \]

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.

See also
class PermutationMatrix, class PermutationWrapper

Member Function Documentation

◆ applyTranspositionOnTheLeft()

template<typename Derived >
Derived & Eigen::PermutationBase< Derived >::applyTranspositionOnTheLeft ( Index  i,
Index  j 
)
inline

Multiplies *this by the transposition $(ij)$ on the left.

Returns
a reference to *this.
Warning
This is much slower than applyTranspositionOnTheRight(Index,Index): this has linear complexity and requires a lot of branching.
See also
applyTranspositionOnTheRight(Index,Index)

◆ applyTranspositionOnTheRight()

template<typename Derived >
Derived & Eigen::PermutationBase< Derived >::applyTranspositionOnTheRight ( Index  i,
Index  j 
)
inline

Multiplies *this by the transposition $(ij)$ on the right.

Returns
a reference to *this.

This is a fast operation, it only consists in swapping two indices.

See also
applyTranspositionOnTheLeft(Index,Index)

◆ cols()

template<typename Derived >
Index Eigen::PermutationBase< Derived >::cols ( ) const
inline
Returns
the number of columns

◆ derived() [1/2]

template<typename Derived >
EIGEN_DEVICE_FUNC Derived & Eigen::EigenBase< Derived >::derived ( )
inline
Returns
a reference to the derived object

◆ derived() [2/2]

template<typename Derived >
EIGEN_DEVICE_FUNC const Derived & Eigen::EigenBase< Derived >::derived ( ) const
inline
Returns
a const reference to the derived object

◆ determinant()

template<typename Derived >
Index Eigen::PermutationBase< Derived >::determinant ( ) const
inline
Returns
the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation.

This function is O(n) procedure allocating a buffer of n booleans.

◆ indices()

template<typename Derived >
IndicesType & Eigen::PermutationBase< Derived >::indices ( )
inline
Returns
a reference to the stored array representing the permutation.

◆ inverse()

template<typename Derived >
InverseReturnType Eigen::PermutationBase< Derived >::inverse ( ) const
inline
Returns
the inverse permutation matrix.
Note
\note_try_to_help_rvo

◆ operator*() [1/2]

template<typename Derived >
template<typename Other >
PlainPermutationType Eigen::PermutationBase< Derived >::operator* ( const InverseImpl< Other, PermutationStorage > &  other) const
inline
Returns
the product of a permutation with another inverse permutation.
Note
\note_try_to_help_rvo

◆ operator*() [2/2]

template<typename Derived >
template<typename Other >
PlainPermutationType Eigen::PermutationBase< Derived >::operator* ( const PermutationBase< Other > &  other) const
inline
Returns
the product permutation matrix.
Note
\note_try_to_help_rvo

◆ operator=()

template<typename Derived >
Derived & Eigen::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=.

◆ rows()

template<typename Derived >
Index Eigen::PermutationBase< Derived >::rows ( ) const
inline
Returns
the number of rows

◆ size()

template<typename Derived >
Index Eigen::PermutationBase< Derived >::size ( ) const
inline
Returns
the size of a side of the respective square matrix, i.e., the number of indices

◆ toDenseMatrix()

template<typename Derived >
DenseMatrixType Eigen::PermutationBase< Derived >::toDenseMatrix ( ) const
inline
Returns
a Matrix object initialized from this permutation matrix. Notice that it is inefficient to return this Matrix object by value. For efficiency, favor using the Matrix constructor taking EigenBase objects.

◆ transpose()

template<typename Derived >
InverseReturnType Eigen::PermutationBase< Derived >::transpose ( ) const
inline
Returns
the tranpose permutation matrix.
Note
\note_try_to_help_rvo

Friends And Related Symbol Documentation

◆ operator*

template<typename Derived >
template<typename Other >
PlainPermutationType operator* ( const InverseImpl< Other, PermutationStorage > &  other,
const PermutationBase< Derived > &  perm 
)
friend
Returns
the product of an inverse permutation with another permutation.
Note
\note_try_to_help_rvo

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