PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

Permutation matrix. More...

#include <PermutationMatrix.h>

+ Inheritance diagram for PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >:

Public Member Functions

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheLeft (Index i, Index j)
 
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheRight (Index i, Index j)
 
Index cols () const
 
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived ()
 
const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived () const
 
IndicesType & indices ()
 
const IndicesType & indices () const
 
Transpose< PermutationBaseinverse () const
 
PlainPermutationType operator* (const PermutationBase< Other > &other) const
 
PlainPermutationType operator* (const Transpose< PermutationBase< Other > > &other) const
 
template<typename Other>
PermutationMatrixoperator= (const PermutationBase< Other > &other)
 
template<typename Other>
PermutationMatrixoperator= (const TranspositionsBase< Other > &tr)
 
template<typename Other>
 PermutationMatrix (const MatrixBase< Other > &indices)
 
template<typename OtherDerived>
 PermutationMatrix (const PermutationBase< OtherDerived > &other)
 
template<typename Other>
 PermutationMatrix (const TranspositionsBase< Other > &tr)
 
 PermutationMatrix (int size)
 
void resize (Index size)
 
Index rows () const
 
void setIdentity ()
 
void setIdentity (Index size)
 
Index size () const
 
DenseMatrixType toDenseMatrix () const
 
Transpose< PermutationBasetranspose () const
 

Detailed Description

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
class Eigen::PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >

Permutation matrix.

Parameters
SizeAtCompileTimethe number of rows/cols, or Dynamic
MaxSizeAtCompileTimethe maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it.
IndexTypethe interger type of the indices

This class represents a permutation matrix, internally stored as a vector of integers.

See also
class PermutationBase, class PermutationWrapper, class DiagonalMatrix

Constructor & Destructor Documentation

◆ PermutationMatrix() [1/4]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
PermutationMatrix ( int size)
inline

Constructs an uninitialized permutation matrix of given size.

◆ PermutationMatrix() [2/4]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename OtherDerived>
PermutationMatrix ( const PermutationBase< OtherDerived > & other)
inline

Copy constructor.

◆ PermutationMatrix() [3/4]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other>
PermutationMatrix ( const MatrixBase< Other > & indices)
inlineexplicit

Generic constructor from expression of the indices. The indices array has the meaning that the permutations sends each integer i to indices[i].

Warning
It is your responsibility to check that the indices array that you passes actually describes a permutation, i.e., each value between 0 and n-1 occurs exactly once, where n is the array's size.

◆ PermutationMatrix() [4/4]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other>
PermutationMatrix ( const TranspositionsBase< Other > & tr)
inlineexplicit

Convert the Transpositions tr to a permutation matrix

Member Function Documentation

◆ applyTranspositionOnTheLeft()

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheLeft ( Index i,
Index j )
inlineinherited

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

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

◆ applyTranspositionOnTheRight()

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheRight ( Index i,
Index j )
inlineinherited

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(int,int)

◆ cols()

Index cols ( ) const
inlineinherited
Returns
the number of columns

◆ derived() [1/2]

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived ( )
inlineinherited
Returns
a reference to the derived object

◆ derived() [2/2]

const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived ( ) const
inlineinherited
Returns
a const reference to the derived object

◆ indices() [1/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
IndicesType & indices ( )
inline
Returns
a reference to the stored array representing the permutation.

◆ indices() [2/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
const IndicesType & indices ( ) const
inline

const version of indices().

◆ inverse()

Transpose< PermutationBase > inverse ( ) const
inlineinherited
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]

PlainPermutationType operator* ( const PermutationBase< Other > & other) const
inlineinherited
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*() [2/2]

PlainPermutationType operator* ( const Transpose< PermutationBase< Other > > & other) const
inlineinherited
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=() [1/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other>
PermutationMatrix & operator= ( const PermutationBase< Other > & other)
inline

Copies the other permutation into *this

◆ operator=() [2/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType>
template<typename Other>
PermutationMatrix & operator= ( const TranspositionsBase< Other > & tr)
inline

Assignment from the Transpositions tr

◆ resize()

void resize ( Index size)
inlineinherited

Resizes to given size.

◆ rows()

Index rows ( ) const
inlineinherited
Returns
the number of rows

◆ setIdentity() [1/2]

void setIdentity ( )
inlineinherited

Sets *this to be the identity permutation matrix

◆ setIdentity() [2/2]

void setIdentity ( Index size)
inlineinherited

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

◆ size()

Index size ( ) const
inlineinherited
Returns
the size of a side of the respective square matrix, i.e., the number of indices

◆ toDenseMatrix()

DenseMatrixType toDenseMatrix ( ) const
inlineinherited
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()

Transpose< PermutationBase > transpose ( ) const
inlineinherited
Returns
the tranpose 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: