Eigen  3.2.2
PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

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
+ 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
 
Derived & derived ()
 
const Derived & 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 > &a_indices)
 
template<typename Other >
 PermutationMatrix (const TranspositionsBase< Other > &tr)
 
void resize (Index newSize)
 
Index rows () const
 
void setIdentity ()
 
void setIdentity (Index newSize)
 
Index size () const
 
DenseMatrixType toDenseMatrix () const
 
Transpose< PermutationBasetranspose () const
 

Constructor & Destructor Documentation

◆ PermutationMatrix() [1/4]

PermutationMatrix ( int  size)
inline

Constructs an uninitialized permutation matrix of given size.

◆ PermutationMatrix() [2/4]

PermutationMatrix ( const PermutationBase< OtherDerived > &  other)
inline

Copy constructor.

◆ PermutationMatrix() [3/4]

PermutationMatrix ( const MatrixBase< Other > &  a_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]

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 ( void  ) const
inlineinherited
Returns
the number of columns

◆ derived() [1/2]

Derived& derived ( )
inlineinherited
Returns
a reference to the derived object

Referenced by MatrixBase< DiagonalProduct< MatrixType, DiagonalType, ProductOrder > >::applyOnTheLeft(), MatrixBase< DiagonalProduct< MatrixType, DiagonalType, ProductOrder > >::applyOnTheRight(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::binaryExpr(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::bottomLeftCorner(), EigenBase< SparseSymmetricPermutationProduct< MatrixType, UpLo > >::cols(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::cols(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::eval(), SparseQR< _MatrixType, _OrderingType >::factorize(), PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime >::indices(), PermutationWrapper< _IndicesType >::indices(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::innerSize(), SparseVector< _Scalar, _Options, _Index >::nonZeros(), RotationBase< Derived, 3 >::operator*(), SparseSelfAdjointView< MatrixType, UpLo >::operator*(), Translation< _Scalar, _Dim >::operator*(), PermutationBase< PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > >::operator*(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::operator*(), Transform< _Scalar, _Dim, _Mode, _Options >::operator*(), MatrixBase< DiagonalProduct< MatrixType, DiagonalType, ProductOrder > >::operator*=(), MatrixBase< DiagonalProduct< MatrixType, DiagonalType, ProductOrder > >::operator=(), DenseBase< Derived >::operator=(), Transform< _Scalar, _Dim, _Mode, _Options >::operator=(), PlainObjectBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::operator=(), PlainObjectBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::PlainObjectBase(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::real(), PlainObjectBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::resizeLike(), EigenBase< SparseSymmetricPermutationProduct< MatrixType, UpLo > >::rows(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::rows(), SparseMatrix< Scalar, RowMajor >::setFromTriplets(), SparseMatrix< Scalar, RowMajor >::setIdentity(), EigenBase< SparseSymmetricPermutationProduct< MatrixType, UpLo > >::size(), SimplicialCholeskyBase< SimplicialLDLT< _MatrixType, _UpLo, _Ordering > >::solve(), IterativeSolverBase< ConjugateGradient< _MatrixType, _UpLo, _Preconditioner > >::solve(), SparseLU< _MatrixType, _OrderingType >::solve(), SparseQR< _MatrixType, _OrderingType >::solve(), UmfPackLU< _MatrixType >::solve(), CholmodBase< _MatrixType, _UpLo, CholmodSimplicialLLT< _MatrixType, _UpLo > >::solve(), SuperLUBase< _MatrixType, SuperILU< _MatrixType > >::solve(), SparseMatrix< Scalar, RowMajor >::SparseMatrix(), SparseVector< _Scalar, _Options, _Index >::swap(), SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::topLeftCorner(), Transform< _Scalar, _Dim, _Mode, _Options >::Transform(), SparseSelfAdjointView< MatrixType, UpLo >::twistedBy(), and SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::unaryViewExpr().

◆ derived() [2/2]

const Derived& derived ( ) const
inlineinherited
Returns
a const reference to the derived object

◆ indices() [1/2]

◆ indices() [2/2]

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

◆ 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).

References EigenBase< Derived >::derived().

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

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

Copies the other permutation into *this

◆ operator=() [2/2]

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

Assignment from the Transpositions tr

◆ resize()

void resize ( Index  newSize)
inlineinherited

Resizes to given size.

◆ rows()

Index rows ( void  ) 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  newSize)
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

References DenseBase< Derived >::setZero(), and PermutationBase< Derived >::size().

◆ 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).

References PermutationBase< Derived >::indices().


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