Iterators.Permutations Method

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Permutations(Int32, Boolean) Enumerates the indexes of all permutations from a set of the specified size.
Permutations(Int32, Boolean, Int32[]) Enumerates the indexes of all permutations from a set of the specified size.
Permutations(Int32, Int32, Boolean) Enumerates the indexes of all permutations of the specified length from a set of the specified size.
Permutations(Int32, Int32, Boolean, Int32[]) Enumerates the indexes of all permutations of the specified length from a set of the specified size.
Permutations<T>(IList<T>, Boolean) Enumerates the indexes of all permutations from a set of items.
Permutations<T>(IList<T>, Int32, Boolean) Enumerates the indexes of all permutations of the specified length from a set of items.

Permutations<T>(IList<T>, Boolean)

Enumerates the indexes of all permutations from a set of items.
C#
public static IEnumerable<T[]> Permutations<T>(
	IList<T> items,
	bool lexicographic
)

Parameters

items  IList<T>
A list of items.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.

Type Parameters

T

Return Value

IEnumerable<T[]>
A sequence of arrays that contain all permutations of the elements of items. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

Permutations(Int32, Boolean)

Enumerates the indexes of all permutations from a set of the specified size.
C#
public static IEnumerable<int[]> Permutations(
	int count,
	bool lexicographic
)

Parameters

count  Int32
The size of the set to draw permutations from.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all permutations from a set of size count. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

Permutations<T>(IList<T>, Int32, Boolean)

Enumerates the indexes of all permutations of the specified length from a set of items.
C#
public static IEnumerable<T[]> Permutations<T>(
	IList<T> items,
	int length,
	bool lexicographic
)

Parameters

items  IList<T>
A list of items.
length  Int32
The length of each permutation.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.

Type Parameters

T

Return Value

IEnumerable<T[]>
A sequence of arrays that contain all permutations of the elements of items. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

Permutations(Int32, Boolean, Int32[])

Enumerates the indexes of all permutations from a set of the specified size.
C#
public static IEnumerable<int[]> Permutations(
	int count,
	bool lexicographic,
	int[] result
)

Parameters

count  Int32
The size of the set to draw permutations from.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.
result  Int32[]
An array that is to hold the result.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all permutations from a set of size count. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

The indexes are returned each time in the same array, result. Its elements should not be modified. If they are modified, the results are unpredictable.

Permutations(Int32, Int32, Boolean)

Enumerates the indexes of all permutations of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Permutations(
	int count,
	int length,
	bool lexicographic
)

Parameters

count  Int32
The size of the set to draw permutations from.
length  Int32
The length of each permutation.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all permutations from a set of size count. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

Permutations(Int32, Int32, Boolean, Int32[])

Enumerates the indexes of all permutations of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Permutations(
	int count,
	int length,
	bool lexicographic,
	int[] result
)

Parameters

count  Int32
The size of the set to draw permutations from.
length  Int32
The length of each permutation.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.
result  Int32[]
An array that is to hold the result.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all permutations from a set of size count. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

The indexes are returned each time in the same array, result. Its elements should not be modified. If they are modified, the results are unpredictable.

See Also