Click or drag to resize

SubsetSplit(Int32, Subset) Method

Splits this subset into an arbitrary array of subsets.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public Subset[] Split(
	int n,
	Subset binIndices
)

Parameters

n  Int32
The number of subsets into which to split this subset.
binIndices  Subset
A subset the same length as this subset, the ith element of which indicates into which bin to place the ith element of this subset.

Return Value

Subset
An array of subsets.
Exceptions
ExceptionCondition
MismatchedSizeExceptionThrown if the length of binIndices is not equal to the length of this subset.
InvalidArgumentExceptionThrown if an index in binIndices is less than zero or greater than n.
Example
C#
Subset mySub = new Subset( 10 );

// Create a subset indicating how to split mySub into four subsets
Subset bins = new Subset( new int[] { 3, 1, 0, 2, 2, 1, 1, 2, 3, 0 } );

Subset[] subsetArray = mySub.Split( 4, bins );
// subsetArray[0] = 2,0
// subsetArray[1] = 1,5,6
// subsetArray[3] = 3,4,7
// subsetArray[4] = 0,8
See Also