Grouping.Variable Partition<TInput> Method
Constructs a grouping that represents a collection of non-overlapping chunks
based on the specified condition.
Definition
Namespace: Numerics.NET.DataAnalysis
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
public static Grouping<TInput> VariablePartition<TInput>(
IList<TInput> index,
Func<TInput, TInput, bool> condition,
Direction direction = Direction.Forward
)
Parameters
- index IList<TInput>
- The index the grouping is over.
- condition Func<TInput, TInput, Boolean>
- A delegate that indicates whether two keys are in the same window.
- direction Direction (Optional)
- The direction in which index is traversed to validate the condition.
Type Parameters
- TInput
Return Value
Grouping<TInput>Remarks
The extent of each chunk is determined by the first key value and condition. The window is extended as long as condition returns true whe applied to the first key and the subsequent keys.
The direction parameter determines whether chunks are created and extended from the beginning (forward) or the end (backward). The grouping is still in the original order even if going backward.