PermutationGetPermutations Method

Generates all permutations of the given dimension.

Definition

Namespace: Meta.Numerics.Functions
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public static IEnumerable<Permutation> GetPermutations(
	int dimension
)

Parameters

dimension  Int32
The number of elements on which the permutations act.

Return Value

IEnumerablePermutation
All permutations of the given dimension.

Remarks

The number of permutations of dimension n is n!, which increases very rapidly as n increases. Even in cases where n! would overflow a Int32 or Int64, this method will successfully produce all permutations. Of course, in such cases, it will take a long time to enumerate them all.

Exceptions

ArgumentOutOfRangeExceptiondimension is negative.

See Also