Iterators.Product Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2

Overload List

Product(Int32[]) Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
Product(Int32, Int32) Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
Product(Int32[], Int32[]) Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
Product(Int32, Int32, Int32[]) Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
Product<T>(IList<T>, Int32) Enumerates the Cartesian product of the specified length from a set of items.

Product(Int32[])

Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Product(
	int[] counts
)

Parameters

counts  Int32[]
An array containing the length of each dimension.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all selections of elements from sets of size counts.

Exceptions

ArgumentNullException

counts is null.

Product<T>(IList<T>, Int32)

Enumerates the Cartesian product of the specified length from a set of items.
C#
public static IEnumerable<T[]> Product<T>(
	IList<T> items,
	int length
)

Parameters

items  IList<T>
A list of items to draw selections from.
length  Int32
The length of the selections.

Type Parameters

T
The type of the items.

Return Value

IEnumerable<T[]>
A sequence of arrays that contain all selections of length elements with replacement from items.

Exceptions

ArgumentNullException

items is null.

ArgumentOutOfRangeException

length is less than zero.

Product(Int32, Int32)

Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Product(
	int count,
	int length
)

Parameters

count  Int32
The size of the set to draw selections from.
length  Int32
The length of the selections.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all selections of length elements with replacement from a set of size count.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

Product(Int32[], Int32[])

Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Product(
	int[] counts,
	int[] result
)

Parameters

counts  Int32[]
An array containing the length of each dimension.
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 selections of elements from sets of size counts.

Remarks

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.

Exceptions

ArgumentNullException

counts is null.

DimensionMismatchException

The length of result is not equal to the length of counts.

Product(Int32, Int32, Int32[])

Enumerates the indexes of the Cartesian product of the specified length from a set of the specified size.
C#
public static IEnumerable<int[]> Product(
	int count,
	int length,
	int[] result
)

Parameters

count  Int32
The size of the set to draw selections from.
length  Int32
The length of the selections.
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 selections of length elements with replacement from a set of size count.

Remarks

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.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

See Also