esso::Permutation< N > Class Template Reference

Represents a permutation of dimensions. More...

#include <permutation.h>

Inheritance diagram for esso::Permutation< N >:

esso::Ix< N, T0 >

List of all members.

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


Detailed Description

template<int N>
class esso::Permutation< N >

Represents a permutation of dimensions.

If n is a dimension, then the transformed dimension is p[n] where p is a Permutation object.


Constructor & Destructor Documentation

template<int N>
esso::Permutation< N >::Permutation (  )  [inline]

Default constructor. Creates unity permutation.

Referenced by esso::Permutation< N >::operator~().

template<int N>
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


Member Function Documentation

template<int N>
DIMT esso::Permutation< N >::operator[] ( DIMT  n  )  const [inline]

Returns:
permuted dimension for dimension n

Reimplemented from esso::Ix< N, T0 >.

template<int N>
bool esso::Permutation< N >::operator== ( const Permutation< N > &  src  )  const [inline]

Returns:
true iff this object is equal to src

template<int N>
bool esso::Permutation< N >::operator!= ( const Permutation< N > &  src  )  const [inline]

Returns:
true iff this object is not equal to src

template<int N>
template<class TT>
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.

Returns:
vector i transformed into permuted space

template<int N>
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.

Returns:
product of two permutations i.e.

References esso::Ix< N, T0 >::d.

template<int N>
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.

Returns:
permutation p transformed into permuted space i.e.

References esso::Ix< N, T0 >::d.

template<int N>
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.

Returns:
true iff this object is an 'even' permutation.

References esso::Ix< N, T0 >::d.

template<int N>
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.

Returns:
true iff successful

template<int N>
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.

Returns:
true iff successful

template<int N>
Permutation<N>& esso::Permutation< N >::Invert (  )  [inline]

Set this object to it's own inverse

Returns:
reference to this object

References esso::Ix< N, T0 >::d.

template<int N>
Permutation<N> esso::Permutation< N >::operator~ (  )  const [inline]

Returns:
A permutation which is the inverse of this permutation.
See also:
Permutation::Inverse

References esso::Permutation< N >::Permutation().

template<int N>
template<int N1>
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

Returns:
new permutation object

Referenced by esso::Permutation< N >::operator|().

template<int N>
template<int M>
Permutation<N+M> esso::Permutation< N >::operator| ( const Permutation< M > &  p2  )  const [inline]

Returns:
A permutation which is the concatenation of this object with p2
See also:
Permutation::Concat

References esso::Permutation< N >::Concat().


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

Generated on Mon Feb 23 19:15:47 2009 for Expresso by  doxygen 1.5.6