Splits this subset into an arbitrary array of subsets.

Namespace:  CenterSpace.NMath.Stats
Assembly:  NMathStats (in NMathStats.dll) Version: 3.4.0.0

Syntax

C#
public Subset[] Split(
	int n,
	Subset binIndices
)
Visual Basic (Declaration)
Public Function Split ( _
	n As Integer, _
	binIndices As Subset _
) As Subset()
Visual C++
public:
array<Subset^>^ Split(
	int n, 
	Subset^ binIndices
)

Parameters

n
Type: System..::.Int32
The number of subsets into which to split this subset.
binIndices
Type: CenterSpace.NMath.Stats..::.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

An array of subsets.

Examples

CopyC#
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

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.MismatchedSizeExceptionThrown if the length of binIndices is not equal to the length of this subset.
CenterSpace.NMath.Core..::.InvalidArgumentExceptionThrown if an index in binIndices is less than zero or greater than n.

See Also