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

Represents a sequence of transpositions (row/column interchange)

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

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;
MatrixXf mat;
mat = tr * mat;

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.

Constructors, destructors, conversion operators

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

Public functions

auto indices() const -> const IndicesType&
auto indices() -> IndicesType&
template<typename OtherDerived>
auto operator=(const TranspositionsBase<OtherDerived>& other) -> Transpositions&

Function documentation

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

Copy constructor.

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

Generic constructor from expression of the transposition indices.

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

Constructs an uninitialized permutation matrix of given size.

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

const version of indices().

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

Returns a reference to the stored array representing the transpositions.

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

Copies the other transpositions into *this