Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > Class Template Reference

Represents a sequence of transpositions (row/column interchange) More...

+ Inheritance diagram for Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >:

Public Types

typedef TranspositionsBase< TranspositionsBase
 
typedef Traits::IndicesType IndicesType
 
typedef IndicesType::Scalar StorageIndex
 
- Public Types inherited from Eigen::TranspositionsBase< Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > >
typedef Eigen::Index Index
 
typedef Traits::IndicesType IndicesType
 
typedef IndicesType::Scalar StorageIndex
 

Public Member Functions

IndicesTypeindices ()
 
const IndicesTypeindices () const
 
template<typename OtherDerived >
Transpositionsoperator= (const TranspositionsBase< OtherDerived > &other)
 
 Transpositions ()
 
template<typename Other >
 Transpositions (const MatrixBase< Other > &indices)
 
template<typename OtherDerived >
 Transpositions (const TranspositionsBase< OtherDerived > &other)
 
 Transpositions (Index size)
 
- Public Member Functions inherited from Eigen::TranspositionsBase< Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > >
const StorageIndexcoeff (Index i) const
 
StorageIndexcoeffRef (Index i)
 
Index cols () const
 
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > & derived ()
 
const Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > & derived () const
 
IndicesTypeindices ()
 
const IndicesTypeindices () const
 
Transpose< TranspositionsBaseinverse () const
 
StorageIndexoperator() (Index i)
 
const StorageIndexoperator() (Index i) const
 
Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ > & operator= (const TranspositionsBase< OtherDerived > &other)
 
StorageIndexoperator[] (Index i)
 
const StorageIndexoperator[] (Index i) const
 
void resize (Index newSize)
 
Index rows () const
 
void setIdentity ()
 
Index size () const
 
Transpose< TranspositionsBasetranspose () const
 

Protected Attributes

IndicesType m_indices
 

Private Types

typedef internal::traits< TranspositionsTraits
 

Detailed Description

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

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:

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

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

Definition at line 157 of file Transpositions.h.

Member Typedef Documentation

◆ Base

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
typedef TranspositionsBase<Transpositions> Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::Base

Definition at line 162 of file Transpositions.h.

◆ IndicesType

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
typedef Traits::IndicesType Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::IndicesType

Definition at line 163 of file Transpositions.h.

◆ StorageIndex

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
typedef IndicesType::Scalar Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::StorageIndex

Definition at line 164 of file Transpositions.h.

◆ Traits

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
typedef internal::traits<Transpositions> Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::Traits
private

Definition at line 159 of file Transpositions.h.

Constructor & Destructor Documentation

◆ Transpositions() [1/4]

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::Transpositions ( )
inline

Definition at line 166 of file Transpositions.h.

166 {}

◆ Transpositions() [2/4]

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

Copy constructor.

Definition at line 170 of file Transpositions.h.

171  : m_indices(other.indices()) {}

◆ Transpositions() [3/4]

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

Generic constructor from expression of the transposition indices.

Definition at line 175 of file Transpositions.h.

175  : m_indices(indices)
176  {}
const IndicesType & indices() const

◆ Transpositions() [4/4]

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

Constructs an uninitialized permutation matrix of given size.

Definition at line 187 of file Transpositions.h.

Member Function Documentation

◆ indices() [1/2]

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

Definition at line 195 of file Transpositions.h.

195 { return m_indices; }

◆ indices() [2/2]

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

const version of indices().

Definition at line 192 of file Transpositions.h.

192 { return m_indices; }

◆ operator=()

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

Copies the other transpositions into *this

Definition at line 180 of file Transpositions.h.

181  {
182  return Base::operator=(other);
183  }
Derived & operator=(const TranspositionsBase< OtherDerived > &other)

Member Data Documentation

◆ m_indices

template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename StorageIndex_ >
IndicesType Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_ >::m_indices
protected

Definition at line 199 of file Transpositions.h.


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