Grouping.Partition Method
Definition
Namespace: Numerics.NET.DataAnalysis
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Overload List
Partition( | Constructs a grouping that represents a collection of non-overlapping chunks of fixed length. |
Partition( | Constructs a grouping that represents a collection of non-overlapping chunks of fixed length. |
Partition<TInput>(IList<TInput>, Int32, Boolean, Boolean) | Constructs a grouping that represents a collection of non-overlapping chunks of fixed length. |
Partition(IList<Int32>)
Constructs a grouping that represents a collection of
non-overlapping chunks of fixed length.
public static Grouping<int> Partition(
IList<int> offsets
)
Parameters
Return Value
Grouping<Int32>A grouping object that represents the chunking.
Exceptions
Argument | offsets is null. |
Argument | The values in offsets are not in ascending order. |
Partition(Int32, Int32)
Constructs a grouping that represents a collection of
non-overlapping chunks of fixed length.
public static Grouping<int> Partition(
int length,
int size
)
Parameters
Return Value
Grouping<Int32>A grouping object that represents the chunking.
Partition<TInput>(IList<TInput>, Int32, Boolean, Boolean)
Constructs a grouping that represents a collection
of non-overlapping chunks of fixed length.
public static Grouping<TInput> Partition<TInput>(
IList<TInput> values,
int size,
bool alignToEnd = false,
bool skipIncomplete = false
)
Parameters
- values IList<TInput>
- The collection the grouping is over.
- size Int32
- The size of the chunks. Must be greater than zero.
- alignToEnd Boolean (Optional)
- Indicates whether groups should be aligned starting from the end of the index.
- skipIncomplete Boolean (Optional)
- Indicates whether the first or last group should be skipped if it does not have full size.
Type Parameters
- TInput
Return Value
Grouping<TInput>A grouping object that represents the chunking.
Remarks
If alignToEnd is false (the default) then first element of values in each group is used as the key for the group. If alignToEnd is true then the last element of values in each group is used as the key for the group.
Exceptions
Argument | values is null. |
Argument | size is less than or equal to zero. |