|
TiledArray
0.7.0
|
Permutation of a sequence of objects indexed by base-0 indices. More...
#include <permutation.h>
Public Types | |
| typedef Permutation | Permutation_ |
| typedef unsigned int | index_type |
| typedef std::map< index_type, index_type > | Map |
| typedef Map::const_iterator | const_iterator |
Public Member Functions | |
| Permutation ()=default | |
| Permutation (const Permutation &)=default | |
| Permutation (Permutation &&)=default | |
| ~Permutation ()=default | |
| Permutation & | operator= (const Permutation &)=default |
| Permutation & | operator= (Permutation &&other)=default |
| template<typename InIter , typename std::enable_if< TiledArray::detail::is_input_iterator< InIter >::value >::type * = nullptr> | |
| Permutation (InIter first, InIter last) | |
| Construct permutation using its 1-line form given by range [first,last) More... | |
| Permutation (const std::vector< index_type > &a) | |
| std::vector constructor More... | |
| Permutation (std::initializer_list< index_type > list) | |
| Construct permutation with an initializer list. More... | |
| Permutation (Map p) | |
| Construct permutation using its compressed 2-line form given by std::map. More... | |
| unsigned int | domain_size () const |
| Permutation domain size. More... | |
| index_type | operator[] (index_type e) const |
| Computes image of an element under this permutation. More... | |
| template<typename Set > | |
| Set | domain () const |
| Computes the domain of this permutation. More... | |
| template<typename Integer , typename std::enable_if< std::is_integral< Integer >::value >::type * = nullptr> | |
| bool | is_in_domain (Integer i) const |
| Test if an index is in the domain of this permutation. More... | |
| std::vector< std::vector< index_type > > | cycles () const |
| Cycles decomposition. More... | |
| Permutation | mult (const Permutation &other) const |
Product of this permutation by other. More... | |
| Permutation | inv () const |
| Construct the inverse of this permutation. More... | |
| Permutation | pow (int n) const |
| Raise this permutation to the n-th power. More... | |
| const Map & | data () const |
| Data accessor. More... | |
| Permutation | identity () const |
| Idenity permutation factory method. More... | |
| template<typename Archive > | |
| void | serialize (Archive &ar) |
| Serialize permutation. More... | |
Iterator accessors | |
Permutation iterators dereference into | |
| const_iterator | begin () const |
| Begin element iterator factory function. More... | |
| const_iterator | cbegin () const |
| Begin element iterator factory function. More... | |
| const_iterator | end () const |
| End element iterator factory function. More... | |
| const_iterator | cend () const |
| End element iterator factory function. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &output, const Permutation &p) |
| Add permutation to an output stream. More... | |
Permutation of a sequence of objects indexed by base-0 indices.
Permutation class is used as an argument in all permutation operations on other objects. Permutations can be applied to sequences of objects:
Permutations can also be composed, e.g. multiplied and inverted:
, is represented in compressed form as
. This means that 0th element of a sequence is mapped by this permutation into the 0th element of the permuted sequence (hence 0 is referred to as a fixed point of this permutation; so is 4); similarly, 1st element of a sequence is mapped by this permutation into the 2nd element of the permuted sequence (hence 2 is referred as the image of 1 under the action of this Permutation; similarly, 1 is the image of 3, etc.). Set
is referred to as domain (or support) of this Permutation. Note that (by definition) Permutation maps its domain into itself (i.e. it's a bijection).
is represented in one-line form as
. Note that the one-line representation is redundant as multiple distinct one-line representations correspond to the same compressed form, e.g.
and
correspond to the same
compressed form.
is represented uniquely as the following set of cycles: (0,3)(1,2). The canonical format for the cycle decomposition used by Permutation class is defined as follows: Definition at line 141 of file permutation.h.
| typedef Map::const_iterator TiledArray::symmetry::Permutation::const_iterator |
Definition at line 146 of file permutation.h.
| typedef unsigned int TiledArray::symmetry::Permutation::index_type |
Definition at line 144 of file permutation.h.
| typedef std::map<index_type,index_type> TiledArray::symmetry::Permutation::Map |
Definition at line 145 of file permutation.h.
Definition at line 143 of file permutation.h.
|
default |

|
default |
|
default |
|
default |
|
inline |
Construct permutation using its 1-line form given by range [first,last)
| InIter | An input iterator type |
| first | The beginning of the iterator range |
| last | The end of the iterator range |
| TiledArray::Exception | if invalid input is given. |
Definition at line 220 of file permutation.h.
|
inlineexplicit |
std::vector constructor
Construct permutation using 1-line form input as a vector
| a | vector that specifies permutation in 1-line form |
Definition at line 234 of file permutation.h.
|
inlineexplicit |
Construct permutation with an initializer list.
| list | An initializer list of integers |
Definition at line 242 of file permutation.h.
|
inline |
Construct permutation using its compressed 2-line form given by std::map.
| p | the map |
Definition at line 250 of file permutation.h.
|
inline |
Begin element iterator factory function.
Definition at line 270 of file permutation.h.
|
inline |
Begin element iterator factory function.
Definition at line 275 of file permutation.h.
|
inline |
End element iterator factory function.
Definition at line 285 of file permutation.h.
|
inline |
Cycles decomposition.
Certain algorithms are more efficient with permutations represented as a set of cyclic transpositions. This function returns the set of cycles that represent this permutation. For example, permutation
is represented as the following set of cycles: (0,3)(1,2). The canonical format for the cycles is:
Definition at line 338 of file permutation.h.
|
inline |
Data accessor.
gives direct access to std::map that encodes the Permutation
std::map<index_type,index_type> object encoding the permutation in compressed two-line form Definition at line 443 of file permutation.h.

|
inline |
Computes the domain of this permutation.
| Set | a container type in which the result will be returned |
Definition at line 306 of file permutation.h.

|
inline |
Permutation domain size.
Definition at line 258 of file permutation.h.

|
inline |
End element iterator factory function.
Definition at line 280 of file permutation.h.
|
inline |
Idenity permutation factory method.
Definition at line 448 of file permutation.h.

|
inline |
Construct the inverse of this permutation.
The inverse of permutation
is defined as
, where
is the identity permutation.
Definition at line 399 of file permutation.h.


|
inline |
Test if an index is in the domain of this permutation.
| Integer | an integer type |
| i | an index whose presence in domain is tested |
true , if i is in the domain, false otherwise Definition at line 322 of file permutation.h.
|
inline |
Product of this permutation by other.
| other | a Permutation |
other * this, i.e. this applied first, then other Definition at line 377 of file permutation.h.


|
default |
|
default |
|
inline |
Computes image of an element under this permutation.
| e | input index |
e; if e is in the domain of this permutation, returns its image, otherwise returns e Definition at line 293 of file permutation.h.
|
inline |
Raise this permutation to the n-th power.
Constructs the permutation
, where
is this permutation.
| n | Exponent value |
Definition at line 415 of file permutation.h.


|
inline |
Serialize permutation.
MADNESS compatible serialization function
| Archive | The serialization archive type |
| [in,out] | ar | The serialization archive |
Definition at line 458 of file permutation.h.
|
friend |
Add permutation to an output stream.
| [out] | output | The output stream |
| [in] | p | The permutation to be added to the output stream |
Definition at line 502 of file permutation.h.