Eigne Matrix Class Library

Dependents:   Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more

Embed: (wiki syntax)

« Back to documentation index

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference
[Core module]

Permutation matrix. More...

#include <PermutationMatrix.h>

Inherits PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >.

Public Member Functions

 PermutationMatrix (int size)
 Constructs an uninitialized permutation matrix of given size.
template<typename OtherDerived >
 PermutationMatrix (const PermutationBase< OtherDerived > &other)
 Copy constructor.
 PermutationMatrix (const PermutationMatrix &other)
 Standard copy constructor.
template<typename Other >
 PermutationMatrix (const MatrixBase< Other > &a_indices)
 Generic constructor from expression of the indices.
template<typename Other >
 PermutationMatrix (const TranspositionsBase< Other > &tr)
 Convert the Transpositions tr to a permutation matrix.
template<typename Other >
PermutationMatrixoperator= (const PermutationBase< Other > &other)
 Copies the other permutation into *this.
template<typename Other >
PermutationMatrixoperator= (const TranspositionsBase< Other > &tr)
 Assignment from the Transpositions tr.
PermutationMatrixoperator= (const PermutationMatrix &other)
 This is a special case of the templated operator=.
const IndicesType & indices () const
 const version of indices().
IndicesType & indices ()
Index rows () const
Index cols () const
Index size () const
DenseMatrixType toDenseMatrix () const
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.
PermutationMatrix
< SizeAtCompileTime,
MaxSizeAtCompileTime,
IndexType > & 
applyTranspositionOnTheLeft (Index i, Index j)
 Multiplies *this by the transposition $(ij)$ on the left.
PermutationMatrix
< SizeAtCompileTime,
MaxSizeAtCompileTime,
IndexType > & 
applyTranspositionOnTheRight (Index i, Index j)
 Multiplies *this by the transposition $(ij)$ on the right.
Transpose< PermutationBaseinverse () const
Transpose< PermutationBasetranspose () const
PlainPermutationType operator* (const PermutationBase< Other > &other) const
PlainPermutationType operator* (const Transpose< PermutationBase< Other > > &other) const
Index determinant () const
PermutationMatrix
< SizeAtCompileTime,
MaxSizeAtCompileTime,
IndexType > & 
derived ()
const PermutationMatrix
< SizeAtCompileTime,
MaxSizeAtCompileTime,
IndexType > & 
derived () 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

Definition at line 312 of file PermutationMatrix.h.


Constructor & Destructor Documentation

PermutationMatrix ( int  size )

Constructs an uninitialized permutation matrix of given size.

Definition at line 327 of file PermutationMatrix.h.

PermutationMatrix ( const PermutationBase< OtherDerived > &  other )

Copy constructor.

Definition at line 332 of file PermutationMatrix.h.

PermutationMatrix ( const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > &  other )

Standard copy constructor.

Defined only to prevent a default copy constructor from hiding the other templated constructor

Definition at line 338 of file PermutationMatrix.h.

PermutationMatrix ( const MatrixBase< Other > &  a_indices ) [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.

Definition at line 349 of file PermutationMatrix.h.

PermutationMatrix ( const TranspositionsBase< Other > &  tr ) [explicit]

Convert the Transpositions tr to a permutation matrix.

Definition at line 354 of file PermutationMatrix.h.


Member Function Documentation

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

Definition at line 171 of file PermutationMatrix.h.

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

Definition at line 190 of file PermutationMatrix.h.

Index cols ( void   ) const [inherited]
Returns:
the number of columns

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

Definition at line 111 of file PermutationMatrix.h.

PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived (  ) [inherited]
Returns:
a reference to the derived object

Definition at line 34 of file EigenBase.h.

const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > & derived (  ) const [inherited]
Returns:
a const reference to the derived object

Definition at line 36 of file EigenBase.h.

Index determinant (  ) const [inherited]
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.

Definition at line 258 of file PermutationMatrix.h.

IndicesType& indices (  )
Returns:
a reference to the stored array representing the permutation.

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

Definition at line 389 of file PermutationMatrix.h.

const IndicesType& indices (  ) const
Transpose<PermutationBase> inverse (  ) const [inherited]
Returns:
the inverse permutation matrix.
Note:

Definition at line 201 of file PermutationMatrix.h.

PlainPermutationType operator* ( const PermutationBase< Other > &  other ) const [inherited]
Returns:
the product permutation matrix.
Note:

Definition at line 235 of file PermutationMatrix.h.

PlainPermutationType operator* ( const Transpose< PermutationBase< Other > > &  other ) const [inherited]
Returns:
the product of a permutation with another inverse permutation.
Note:

Definition at line 243 of file PermutationMatrix.h.

PermutationMatrix& operator= ( const PermutationBase< Other > &  other )

Copies the other permutation into *this.

Definition at line 362 of file PermutationMatrix.h.

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

Assignment from the Transpositions tr.

Definition at line 370 of file PermutationMatrix.h.

PermutationMatrix& operator= ( const PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > &  other )

This is a special case of the templated operator=.

Its purpose is to prevent a default operator= from hiding the templated operator=.

Definition at line 379 of file PermutationMatrix.h.

void resize ( Index  newSize ) [inherited]

Resizes to given size.

Definition at line 142 of file PermutationMatrix.h.

Index rows ( void   ) const [inherited]
Returns:
the number of rows

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

Definition at line 108 of file PermutationMatrix.h.

void setIdentity (  ) [inherited]

Sets *this to be the identity permutation matrix.

Definition at line 148 of file PermutationMatrix.h.

void setIdentity ( Index  newSize ) [inherited]

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

Definition at line 156 of file PermutationMatrix.h.

Index size (  ) const [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 > >.

Definition at line 114 of file PermutationMatrix.h.

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

Definition at line 130 of file PermutationMatrix.h.

Transpose<PermutationBase> transpose (  ) const [inherited]
Returns:
the tranpose permutation matrix.
Note:

Definition at line 207 of file PermutationMatrix.h.


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:

Definition at line 251 of file PermutationMatrix.h.