[Home] Type Microsoft.FSharp.Collections.Permutation


Full Type Signature

type Permutation = class
                   end
                   with
                     interface IComparable
                     new : size:int * mappings:seq<int * int> -> Permutation
                     new : int array -> Permutation
                     static member Compose : p1:Permutation * p2:Permutation -> Permutation
                     static member Identity : size:int -> Permutation
                     static member Reverse : size:int -> Permutation
                     static member Rotate : size:int * ?distance:int -> Permutation
                     static member Swap : size:int * n:int * m:int -> Permutation
                     member Inverse : Permutation
                     member Item : int -> int with get
                     member Length : int
                   end

Instance Members

MemberDescription
member Inverse : Permutation
Compute the inverse of the permutation
member Item : int -> int with get
Apply the composition to an index within the range 0..Length-1
member Length : int
The number of indices maintained by the permutation

Static Members

MemberDescription
new : size:int * mappings: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.
new : int array -> Permutation
Create a permutation by specifying the result of permuting [| 0 .. n-1 |]. For example, Permutation([| 1;2;0 |]) specifies a permutation that rotates all elements left one place.
member Compose : p1:Permutation * p2:Permutation -> Permutation
Return a permutation that, when applied, first applies p1 then applies p2.
member Identity : size:int -> Permutation
Return the iddentity permutation
member Reverse : size:int -> Permutation
Return a permutation that, when applied, maps index 0 to N-1, N-1 to 0 etc.
member Rotate : size:int * ?distance:int -> Permutation
Return a permutation that rotates right by the given distance. If the distance is negative then a left rotation results.
member Swap : size:int * n:int * m:int -> Permutation
Return a swaps the given two elements.

See Also

Microsoft.FSharp.Collections


Documentation for assembly FSharp.Core, version 1.9.4.19, generated using F# version 1.9.4.19