Public Member Functions | Friends
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

Permutation matrix. More...

#include <PermutationMatrix.h>

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

List of all members.

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
const IndicesType & indices () const
IndicesType & indices ()
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)
 PermutationMatrix (int size)
template<typename OtherDerived >
 PermutationMatrix (const PermutationBase< OtherDerived > &other)
template<typename Other >
 PermutationMatrix (const MatrixBase< Other > &indices)
template<typename Other >
 PermutationMatrix (const TranspositionsBase< Other > &tr)
void resize (Index size)
Index rows () const
void setIdentity ()
void setIdentity (Index size)
Index size () const
DenseMatrixType toDenseMatrix () const
Transpose< PermutationBasetranspose () const

Friends

PlainPermutationType operator* (const Transpose< PermutationBase< Other > > &other, const PermutationBase &perm)

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 ( int  size) [inline]

Constructs an uninitialized permutation matrix of given size.

PermutationMatrix ( const PermutationBase< OtherDerived > &  other) [inline]

Copy constructor.

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

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 ( const TranspositionsBase< Other > &  tr) [inline, explicit]

Convert the Transpositions tr to a permutation matrix


Member Function Documentation

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheLeft ( Index  i,
Index  j 
) [inline, inherited]

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)
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & applyTranspositionOnTheRight ( Index  i,
Index  j 
) [inline, inherited]

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)
Index cols ( void  ) const [inline, inherited]
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived ( ) [inline, inherited]
Returns:
a reference to the derived object
const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived ( ) const [inline, inherited]
Returns:
a const reference to the derived object
const IndicesType& indices ( ) const [inline]
IndicesType& indices ( ) [inline]
Returns:
a reference to the stored array representing the permutation.

Reimplemented from PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >.

Transpose<PermutationBase> inverse ( ) const [inline, inherited]
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).
PlainPermutationType operator* ( const PermutationBase< Other > &  other) const [inline, inherited]
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).
PlainPermutationType operator* ( const Transpose< PermutationBase< Other > > &  other) const [inline, inherited]
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).
PermutationMatrix& operator= ( const PermutationBase< Other > &  other) [inline]

Copies the other permutation into *this

PermutationMatrix& operator= ( const TranspositionsBase< Other > &  tr) [inline]

Assignment from the Transpositions tr

void resize ( Index  size) [inline, inherited]

Resizes to given size.

Index rows ( void  ) const [inline, inherited]
void setIdentity ( ) [inline, inherited]

Sets *this to be the identity permutation matrix

void setIdentity ( Index  size) [inline, inherited]

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

Index size ( ) const [inline, inherited]
Returns:
the size of a side of the respective square matrix, i.e., the number of indices

Reimplemented from EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >.

DenseMatrixType toDenseMatrix ( ) const [inline, inherited]
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<PermutationBase> transpose ( ) const [inline, inherited]
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).

Friends And Related Function Documentation

PlainPermutationType operator* ( const Transpose< PermutationBase< Other > > &  other,
const PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > > &  perm 
) [friend, inherited]
Returns:
the product of an inverse permutation with another 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).

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