Math.NET Numerics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.5 KiB

// (c) Microsoft Corporation 2005-2009.
namespace Microsoft.FSharp.Compatibility
open Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Collections
type permutation = int -> int
module 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_array : destinations:int array -> 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 of_pairs : mappings: seq<int * int> -> permutation
/// Return a swaps the given two elements over any size
val swap: n:int -> m:int -> permutation
/// Return a permutation that, when applied, maps index 0 to size-1, size-1 to 0 etc.
val reversal: size:int -> permutation
/// Return a permutation that rotates right by the given distance. If the distance
/// is negative then a left rotation results.
val rotation: size:int -> distance:int -> permutation
/// The identity permutation over any size
val identity : permutation
val inverse : size: int -> p:permutation -> permutation