Eigne Matrix Class Library

Dependents:   Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more

Embed: (wiki syntax)

« Back to documentation index

PermutationWrapper< _IndicesType > Class Template Reference

PermutationWrapper< _IndicesType > Class Template Reference
[Core module]

Class to view a vector of integers as a permutation matrix. More...

#include <PermutationMatrix.h>

Inherits PermutationBase< PermutationWrapper< _IndicesType > >.

Public Member Functions

const internal::remove_all
< typename IndicesType::Nested >
::type & 
indices () const
 const version of indices().
Index rows () const
Index cols () const
Index size () const
DenseMatrixType toDenseMatrix () const
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.
PermutationWrapper
< _IndicesType > & 
applyTranspositionOnTheLeft (Index i, Index j)
 Multiplies *this by the transposition $(ij)$ on the left.
PermutationWrapper
< _IndicesType > & 
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
PermutationWrapper
< _IndicesType > & 
derived ()
const PermutationWrapper
< _IndicesType > & 
derived () const

Friends

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

Detailed Description

template<typename _IndicesType>
class Eigen::PermutationWrapper< _IndicesType >

Class to view a vector of integers as a permutation matrix.

Parameters:
_IndicesTypethe type of the vector of integer (can be any compatible expression)

This class allows to view any vector expression of integers as a permutation matrix.

See also:
class PermutationBase, class PermutationMatrix

Definition at line 512 of file PermutationMatrix.h.


Member Function Documentation

PermutationWrapper< _IndicesType > & 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.

PermutationWrapper< _IndicesType > & 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< PermutationWrapper< _IndicesType > >.

Definition at line 111 of file PermutationMatrix.h.

const PermutationWrapper< _IndicesType > & derived (  ) const [inherited]
Returns:
a const reference to the derived object

Definition at line 36 of file EigenBase.h.

PermutationWrapper< _IndicesType > & derived (  ) [inherited]
Returns:
a reference to the derived object

Definition at line 34 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 (  ) [inherited]
Returns:
a reference to the stored array representing the permutation.

Definition at line 138 of file PermutationMatrix.h.

const internal::remove_all<typename IndicesType::Nested>::type& indices (  ) const

const version of indices().

Reimplemented from PermutationBase< PermutationWrapper< _IndicesType > >.

Definition at line 528 of file PermutationMatrix.h.

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.

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< PermutationWrapper< _IndicesType > >.

Definition at line 108 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.

void setIdentity (  ) [inherited]

Sets *this to be the identity permutation matrix.

Definition at line 148 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< PermutationWrapper< _IndicesType > >.

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< PermutationWrapper< _IndicesType > > &  perm 
) [friend, inherited]
Returns:
the product of an inverse permutation with another permutation.
Note:

Definition at line 251 of file PermutationMatrix.h.