| Value | Description |
val identity : permutation |
The identity permutation over any size
|
val inverse : int -> permutation -> permutation | |
val of_array : int array -> permutation |
Create a permutation by specifying the result of permuting [| 0 .. n-1 |]. For example,
Permutation.of_array [| 1;2;0 |] specifies a permutation that rotates all elements right one place.
|
val of_pairs : seq<int * int> -> permutation |
Create a permutation by specifying (source,destination) index pairs. For example,
Permutation(3,[ (0,2);(1,0); (2,1) ]) specifies a permutation that rotates
all elements left one place. Not all elements need be given, e.g.
Permutation(5,[ (1,2);(2,1) |]) specifies a permutation that swaps elements at indexes
1 and 2.
|
val reversal : int -> permutation |
Return a permutation that, when applied, maps index 0 to size-1, size-1 to 0 etc.
|
val rotation : int -> int -> permutation |
Return a permutation that rotates right by the given distance. If the distance
is negative then a left rotation results.
|
val swap : int -> int -> permutation |
Return a swaps the given two elements over any size
|