#include <Permutation.hh>
Public Member Functions | |
| Permutation (int n) | |
| Create a permutation of n objects. | |
| Permutation & | operator= (Permutation &prm) |
| assignment | |
| bool | IsIdentity () |
| Whether this is an identity permutation. | |
| bool | Element (int i) |
| checks that index i is in the appropriate range | |
| int | operator[] (int i) |
| Content of the i'th slot, no range check. | |
| int | Transpose (int i) |
| Slot location for the integer i. | |
| void | reset (int i) |
| Change size to i. | |
| void | SetToIdentity () |
| Restore to the identity permutation. | |
| int | Assign (int indx, int val) |
| Assign val to the location indx. | |
| int | FlipContents (int i, int j) |
| Exchange objects at positions i and j. | |
| int | FlipLocations (int a, int b) |
| Exchange the integers i and j, wherever they are. | |
| int prf_utils::Permutation::FlipContents | ( | int | i, | |
| int | j | |||
| ) |
Exchange objects at positions i and j, irrespective of what they are. This means that if the current state of the permutation of 3 integers is {b,a,c}, and you call FlipContents(1,3) you get {c,a,b}, i.e., contents of positions i and j are exchanged.
| int prf_utils::Permutation::FlipLocations | ( | int | a, | |
| int | b | |||
| ) |
Exchange objects a and b, irrespective of where they are. This means that if the current state of the permutation of 3 integers is {b,a,c}, and you call FlipLocations(a,b) you get {a,b,c}, i.e., the locations of the objects represented by integers a and b, are exchanged, so that a ends up where b was, and vice versa.