Eigen  3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
 
Loading...
Searching...
No Matches
Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType > Class Template Reference

#include <Eigen/src/Core/Transpositions.h>

Detailed Description

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
class Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >

Represents a sequence of transpositions (row/column interchange)

Template Parameters
SizeAtCompileTimethe number of transpositions, or Dynamic
MaxSizeAtCompileTimethe maximum number of transpositions, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it.

This class represents a permutation transformation as a sequence of n transpositions $[T_{n-1} \ldots T_{i} \ldots T_{0}]$. It is internally stored as a vector of integers indices. Each transposition $ T_{i} $ applied on the left of a matrix ( $ T_{i} M$) interchanges the rows i and indices[i] of the matrix M. A transposition applied on the right (e.g., $ M T_{i}$) yields a column interchange.

Compared to the class PermutationMatrix, such a sequence of transpositions is what is computed during a decomposition with pivoting, and it is faster when applying the permutation in-place.

To apply a sequence of transpositions to a matrix, simply use the operator * as in the following example:

Transpositions tr;
mat = tr * mat;
Matrix< float, Dynamic, Dynamic > MatrixXf
Dynamic×Dynamic matrix of type float.
Definition Matrix.h:478

In this example, we detect that the matrix appears on both side, and so the transpositions are applied in-place without any temporary or extra copy.

See also
class PermutationMatrix

Public Member Functions

IndicesType & indices ()
 
const IndicesType & indices () const
 
template<typename OtherDerived>
Transpositionsoperator= (const TranspositionsBase< OtherDerived > &other)
 
template<typename Other>
 Transpositions (const MatrixBase< Other > &indices)
 
template<typename OtherDerived>
 Transpositions (const TranspositionsBase< OtherDerived > &other)
 
 Transpositions (Index size)
 

Constructor & Destructor Documentation

◆ Transpositions() [1/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
template<typename OtherDerived>
Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Transpositions ( const TranspositionsBase< OtherDerived > & other)
inline

Copy constructor.

◆ Transpositions() [2/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
template<typename Other>
Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Transpositions ( const MatrixBase< Other > & indices)
inlineexplicit

Generic constructor from expression of the transposition indices.

◆ Transpositions() [3/3]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::Transpositions ( Index size)
inline

Constructs an uninitialized permutation matrix of given size.

Member Function Documentation

◆ indices() [1/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
IndicesType & Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::indices ( )
inline
Returns
a reference to the stored array representing the transpositions.

◆ indices() [2/2]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
const IndicesType & Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::indices ( ) const
inline

const version of indices().

◆ operator=()

template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType = int>
template<typename OtherDerived>
Transpositions & Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, IndexType >::operator= ( const TranspositionsBase< OtherDerived > & other)
inline

Copies the other transpositions into *this


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