Permutation Class

Represents a permutation.

Definition

Namespace: Meta.Numerics.Functions
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public sealed class Permutation : IEquatable<Permutation>, 
	IFormattable
Inheritance
Object    Permutation
Implements
IEquatablePermutation, IFormattable

Remarks

A permutation of dimension D is a re-ordering a set of D distinguishable objects. The most obvious application of permutations in programming is to re-order the elements of an ordered set, but the applications in applied and theoretical mathematics are vast.

You can instantiate a new permutation from its map or cycle notation using the Parse(String) or TryParse(String, Permutation) methods. You can enumerate all permutations of a given dimension using the GetPermutations(Int32) method, or get a random one of a given dimension using GetRandomPermutation(Int32, Random).

Once you have a permutation instance in hand, you can examine its properties (e.g. Order and IsDerangement), obtain its inverse (using Inverse), or combine it with another perumtation using group multiplication (Multiply(Permutation, Permutation)). You can also apply it (in-place!) to any IListT using ApplyT(IListT).

Properties

Dimension Gets the dimension of the permutation.
IsDerangement Gets a Boolean flag indicating whether the permutation is a derangement.
IsEven Gets a Boolean value that is true if the permutation is even and false if the permutation is odd.
IsIdentity Gets a Boolean value indicating whether the permutation is the identity.
IsInvolution Gets a Boolean flag indicating whether the permutation is an involution.
Order Gets the order of the permutation.

Methods

ApplyT Applies the permutation to a list.
Equals(Object) Determines whether the given object is equal to the permutation.
(Overrides ObjectEquals(Object))
Equals(Permutation) Determines whether the given permutation is equal to the permutation instance.
GetHashCodeServes as the default hash function.
(Overrides ObjectGetHashCode)
GetPermutations Generates all permutations of the given dimension.
GetRandomPermutation Get a random permutation.
GetTypeGets the Type of the current instance.
(Inherited from Object)
Identity Returns the identity permutation of the given dimension.
Inverse Gets the inverse of the permutation.
Parse Converts a text representation into a permutation.
ToMatrix Get a matrix representation of the permuation.
ToStringReturns a string that represents the current object.
(Overrides ObjectToString)
ToString(String) Converts the permutation to its string representation in the given format.
ToString(String, IFormatProvider) Converts the permutation to its string representation in the given format.
TryParse Attempts to convert a text representation into a permutation.

Operators

Equality(Permutation, Permutation) Determines whether two permutations are equal.
Inequality(Permutation, Permutation) Determines whether two permutations are not equal.
Multiply(Permutation, Permutation) Multiplies two permutations.

See Also