#include <permutation.h>
Public Member Functions | |
construction | |
Permutation () | |
Permutation (int r) | |
const | |
DIMT | operator[] (DIMT n) const |
bool | operator== (const Permutation< N > &src) const |
bool | operator!= (const Permutation< N > &src) const |
template<class TT> | |
Ix< N, TT > | operator* (const Ix< N, TT > &i) const |
Permutation< N > | operator* (const Permutation< N > &p) const |
Permutation< N > | operator[] (const Permutation< N > &p) const |
bool | IsEven () const |
nonconst | |
bool | Setup (const Ix< N, DIMT > &src) |
bool | SetupSwap (DIMT n1, DIMT n2) |
Permutation< N > & | Invert () |
Permutation< N > | operator~ () const |
template<int N1> | |
Permutation< N > & | Concat (const Permutation< N1 > &p1, const Permutation< N-N1 > &p2) |
template<int M> | |
Permutation< N+M > | operator| (const Permutation< M > &p2) const |
If n is a dimension, then the transformed dimension is p[n] where p is a Permutation object.
esso::Permutation< N >::Permutation | ( | ) | [inline] |
Default constructor. Creates unity permutation.
Referenced by esso::Permutation< N >::operator~().
esso::Permutation< N >::Permutation | ( | int | r | ) | [inline, explicit] |
Create a permutation that is a cyclic rotation of dimensions, that is p[n] == (n+r) modulo N. Negative values for r are allowed
DIMT esso::Permutation< N >::operator[] | ( | DIMT | n | ) | const [inline] |
bool esso::Permutation< N >::operator== | ( | const Permutation< N > & | src | ) | const [inline] |
bool esso::Permutation< N >::operator!= | ( | const Permutation< N > & | src | ) | const [inline] |
Ix<N,TT> esso::Permutation< N >::operator* | ( | const Ix< N, TT > & | i | ) | const [inline] |
Transform an Ix object by this permutation. I.e. if n is a dimension then (p*i)[p[n]] = i[n]
Note that this works just like matrix-vector multiplication where the Permutation object acts like a permutation matrix with respect to multiplication.
Permutation<N> esso::Permutation< N >::operator* | ( | const Permutation< N > & | p | ) | const [inline] |
Compose a Permutation from two objects. I.e. if if p1 and p2 are permutations and n is a dimension then (p1*p2)[n] == p1[p2[n]] Note that this works just like matrix-matrix multiplication where the Permutation object acts like a permutation matrix with respect to multiplication.
References esso::Ix< N, T0 >::d.
Permutation<N> esso::Permutation< N >::operator[] | ( | const Permutation< N > & | p | ) | const [inline] |
Transform a permutation by another permutation. I.e. if p1 and p2 are permutations and n is a dimension then (p1[p2])[n] == p1[p2[~p1[n]]]
Note that this means that p1[p2] is equivalent to p1*p2*~p1.
References esso::Ix< N, T0 >::d.
bool esso::Permutation< N >::IsEven | ( | ) | const [inline] |
Find out if this is an 'even' permutation, that is if it can be composed by an even number of 'elementary permutations'. An elementary permutation in this context is a permutation of two consecutive dimensions e.g. (1,2)->(2,1).
Knowing the 'even' property of a permutation is important in many applications.
References esso::Ix< N, T0 >::d.
bool esso::Permutation< N >::Setup | ( | const Ix< N, DIMT > & | src | ) | [inline] |
Create object.and checks so that arguments are ok. On failure the contents of this object is unchanged.
bool esso::Permutation< N >::SetupSwap | ( | DIMT | n1, | |
DIMT | n2 | |||
) | [inline] |
Create object as single permutation of two dimensions. Checks so that arguments are ok. On failure this object is unchanged.
Permutation<N>& esso::Permutation< N >::Invert | ( | ) | [inline] |
Set this object to it's own inverse
References esso::Ix< N, T0 >::d.
Permutation<N> esso::Permutation< N >::operator~ | ( | ) | const [inline] |
References esso::Permutation< N >::Permutation().
Permutation<N>& esso::Permutation< N >::Concat | ( | const Permutation< N1 > & | p1, | |
const Permutation< N-N1 > & | p2 | |||
) | [inline] |
Concatenate two permutations. if p1 has dim n1 and p2 has dim n2 then (p1|p2)[n] == p1[n] if n<n1 and p2[n-n1]+n1 otherwise
Referenced by esso::Permutation< N >::operator|().
Permutation<N+M> esso::Permutation< N >::operator| | ( | const Permutation< M > & | p2 | ) | const [inline] |
References esso::Permutation< N >::Concat().