Eigen  5.0.1
 
Loading...
Searching...
No Matches
Eigen::PermutationBase< Derived > Class Template Reference

#include <Eigen/src/Core/PermutationMatrix.h>

Detailed Description

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

Base class for permutations.

Template 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, and with a diagonal matrix (DiagonalBase) on either side, which yields a ScaledPermutationMatrix.

See also
class PermutationMatrix, class PermutationWrapper
+ Inheritance diagram for Eigen::PermutationBase< Derived >:

Public Member Functions

InverseReturnType adjoint () const
 
Derived & applyTranspositionOnTheLeft (Index i, Index j)
 
Derived & applyTranspositionOnTheRight (Index i, Index j)
 
Index cols () const
 
Index determinant () const
 
DenseMatrixType eval () const
 
constexpr IndicesType & indices ()
 
constexpr const IndicesType & indices () const
 
InverseReturnType inverse () const
 
template<typename Other>
PlainPermutationType operator* (const InverseImpl< Other, PermutationStorage > &other) const
 
template<typename Other>
PlainPermutationType operator* (const PermutationBase< Other > &other) const
 
template<typename OtherDerived>
Derived & operator= (const PermutationBase< OtherDerived > &other)
 
template<typename OtherDerived>
Derived & operator= (const TranspositionsBase< OtherDerived > &tr)
 
void resize (Index newSize)
 
Index rows () const
 
void setIdentity ()
 
void setIdentity (Index newSize)
 
Index size () const
 
DenseMatrixType toDenseMatrix () const
 
InverseReturnType transpose () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
constexpr Index cols () const noexcept
 
constexpr Derived & derived ()
 
constexpr const Derived & derived () const
 
constexpr Index rows () const noexcept
 
constexpr Index size () const noexcept
 

Additional Inherited Members

- Public Types inherited from Eigen::EigenBase< Derived >
using Index
 The interface type of indices.
 

Member Function Documentation

◆ adjoint()

template<typename Derived>
InverseReturnType Eigen::PermutationBase< Derived >::adjoint ( ) const
inline
Returns
the adjoint of the permutation matrix. Its entries are real and it is orthogonal, so this equals transpose() and inverse().
Note
This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization).

◆ 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.
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

◆ 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.

◆ eval()

template<typename Derived>
DenseMatrixType Eigen::PermutationBase< Derived >::eval ( ) const
inline
Returns
the plain matrix representation of the permutation.

◆ indices() [1/2]

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

◆ indices() [2/2]

template<typename Derived>
const IndicesType & Eigen::PermutationBase< Derived >::indices ( ) const
inlineconstexpr

const version of indices().

◆ inverse()

template<typename Derived>
InverseReturnType Eigen::PermutationBase< Derived >::inverse ( ) const
inline
Returns
the inverse permutation matrix.
Note
This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization).

◆ 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
This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization).

◆ 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
This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization).

◆ operator=() [1/2]

template<typename Derived>
template<typename OtherDerived>
Derived & Eigen::PermutationBase< Derived >::operator= ( const PermutationBase< OtherDerived > & other)
inline

Copies the other permutation into *this

◆ operator=() [2/2]

template<typename Derived>
template<typename OtherDerived>
Derived & Eigen::PermutationBase< Derived >::operator= ( const TranspositionsBase< OtherDerived > & tr)
inline

Assignment from the Transpositions tr

◆ resize()

template<typename Derived>
void Eigen::PermutationBase< Derived >::resize ( Index newSize)
inline

Resizes to given size.

◆ rows()

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

◆ setIdentity() [1/2]

template<typename Derived>
void Eigen::PermutationBase< Derived >::setIdentity ( )
inline

Sets *this to be the identity permutation matrix

◆ setIdentity() [2/2]

template<typename Derived>
void Eigen::PermutationBase< Derived >::setIdentity ( Index newSize)
inline

Sets *this to be the identity permutation matrix of given size.

◆ 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 transpose permutation matrix.
Note
This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization).

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