$treeview $search $mathjax
Eigen  3.2.5
$projectbrief
$projectbrief
$searchbox

PermutationBase< Derived > Class Template Reference
[Core module]

Base class for permutations. More...

Inheritance diagram for PermutationBase< Derived >:

List of all members.

Public Member Functions

Derived & applyTranspositionOnTheLeft (Index i, Index j)
Derived & applyTranspositionOnTheRight (Index i, Index j)
Index cols () const
const Derived & derived () const
Derived & derived ()
Index determinant () const
IndicesType & indices ()
const IndicesType & indices () const
Transpose< PermutationBaseinverse () const
template<typename Other >
PlainPermutationType operator* (const Transpose< PermutationBase< Other > > &other) const
template<typename Other >
PlainPermutationType operator* (const PermutationBase< Other > &other) const
template<typename OtherDerived >
Derived & operator= (const TranspositionsBase< OtherDerived > &tr)
template<typename OtherDerived >
Derived & operator= (const PermutationBase< OtherDerived > &other)
void resize (Index newSize)
Index rows () const
void setIdentity (Index newSize)
void setIdentity ()
Index size () const
DenseMatrixType toDenseMatrix () const
Transpose< PermutationBasetranspose () const

Friends

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

Detailed Description

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

Base class for permutations.

Parameters:
Derived the 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.

See also:
class PermutationMatrix, class PermutationWrapper

Member Function Documentation

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(int,int): this has linear complexity and requires a lot of branching.
See also:
applyTranspositionOnTheRight(int,int)
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(int,int)

Referenced by FullPivLU< _MatrixType >::compute(), FullPivHouseholderQR< _MatrixType >::compute(), ColPivHouseholderQR< _MatrixType >::compute(), and PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::operator=().

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

Reimplemented from EigenBase< Derived >.

const Derived& derived (  )  const [inline, inherited]
Returns:
a const reference to the derived object
Derived& derived (  )  [inline, inherited]
Returns:
a reference to the derived object

Referenced by PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::applyTranspositionOnTheLeft(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::applyTranspositionOnTheRight(), EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::cols(), MatrixBase< TriangularProduct< Mode, true, Lhs, false, Rhs, true > >::cwiseEqual(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::cwiseSqrt(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::indices(), SparseMatrixBase< Derived >::innerVector(), SparseMatrixBase< Derived >::innerVectors(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::inverse(), Translation< _Scalar, _Dim >::operator*(), Transform< _Scalar, _Dim, _Mode, _Options >::operator*(), SparseSelfAdjointView< MatrixType, UpLo >::operator*(), SparseMatrixBase< Derived >::operator*(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::operator*(), RotationBase< Derived, 3 >::operator*(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::operator*(), Transform< _Scalar, _Dim, _Mode, _Options >::operator=(), PlainObjectBase< Matrix< int, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::operator=(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::operator=(), DenseBase< Derived >::operator=(), MatrixBase< Derived >::operator=(), PlainObjectBase< Matrix< int, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::PlainObjectBase(), PlainObjectBase< Matrix< int, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::resizeLike(), EigenBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::rows(), UmfPackLU< _MatrixType >::solve(), SuperLUBase< _MatrixType, SuperILU< _MatrixType > >::solve(), SparseLU< _MatrixType, _OrderingType >::solve(), SimplicialCholeskyBase< SimplicialLDLT< _MatrixType, _UpLo, _Ordering > >::solve(), IterativeSolverBase< ConjugateGradient< _MatrixType, _UpLo, _Preconditioner > >::solve(), CholmodBase< _MatrixType, _UpLo, CholmodSimplicialLLT< _MatrixType, _UpLo > >::solve(), SparseMatrix< Scalar, RowMajor >::SparseMatrix(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::toDenseMatrix(), Transform< _Scalar, _Dim, _Mode, _Options >::Transform(), and PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, Index > >::transpose().

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

Referenced by SparseLU< _MatrixType, _OrderingType >::factorize().

Transpose<PermutationBase> 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).

Referenced by SparseQR< _MatrixType, _OrderingType >::analyzePattern(), SparseQR< _MatrixType, _OrderingType >::factorize(), SparseLU< _MatrixType, _OrderingType >::factorize(), PartialPivLU< _MatrixType >::reconstructedMatrix(), and FullPivLU< _MatrixType >::reconstructedMatrix().

PlainPermutationType operator* ( const Transpose< PermutationBase< Other > > &  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).
PlainPermutationType 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).
Derived& operator= ( const TranspositionsBase< OtherDerived > &  tr  )  [inline]

Assignment from the Transpositions tr

Derived& operator= ( const PermutationBase< OtherDerived > &  other  )  [inline]

Copies the other permutation into *this

Referenced by PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::operator=().

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

Reimplemented from EigenBase< Derived >.

void setIdentity ( Index  newSize  )  [inline]

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

DenseMatrixType 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<PermutationBase> transpose (  )  const [inline]
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< Derived > &  perm 
) [friend]
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: