|
Template Numerical Library version\ main:4e6e2c1
|
This page provides an overview of all reduction functions available for segment operations, helping to understand the differences between variants and choose the right function for your needs.
The segment reduction functions are organized along three independent axes:
| Category | Tracks Position? | Use Case |
|---|---|---|
| Basic | No | Only the reduced value is needed (e.g., sum, product) |
| WithArgument | Yes | Need both the value and its position (e.g., max value and where it occurs) |
| Scope | Segments Processed | Parameters |
|---|---|---|
| All | All segments | No range/array parameters |
| Range | Segments [begin, end) | begin and end indices |
| Array | Specific segments | Array of segment indices |
| If | Segment condition | Process segments based on segment-level properties |
All reduction functions follow this naming pattern: reduce[Scope][WithArgument][If]
| Function | Scope | Conditional | Tracks Position |
|---|---|---|---|
| Segments_reduceAllSegments | All | No | No |
| Segments_reduceSegments_range (range) | Range [begin,end) | No | No |
| Segments_reduceSegments_with_segment_indices (array) | Segment array | No | No |
| Segments_reduceAllSegmentsIf | All | Yes | No |
| Segments_reduceSegmentsIf | Range [begin,end) | Yes | No |
| Function | Scope | Conditional | Tracks Position |
|---|---|---|---|
| Segments_reduceAllSegmentsWithArgument | All | No | Yes |
| Segments_reduceSegmentsWithArgument_range (range) | Range [begin,end) | No | Yes |
| Segments_reduceSegmentsWithArgument_with_segment_indices (array) | Segment array | No | Yes |
| Segments_reduceAllSegmentsWithArgumentIf | All | Yes | Yes |
| Segments_reduceSegmentsWithArgumentIf | Range [begin,end) | Yes | Yes |
All reduction functions share these common parameters:
Additional parameters for specific variants:
Performance considerations: