Template Numerical Library: Overview of Segment Find Functions

Template Numerical Library version\ main:0b2c40fb1

Loading...
Searching...
No Matches
Overview of Segment Find Functions

This page provides an overview of all find functions available for segment operations, helping to understand the differences between variants and choose the right function for your needs.

# Function Categories

The segment find functions are organized into the following categories:

## Basic Find Functions

These functions search for elements satisfying a condition within segments:

Function | Segments Searched | Description
--- | --- | ---
Segments_findInAllSegments | All segments | Searches all segments in the container
Segments_findInSegments_range | Segments [begin, end) | Searches segments in a specified range
Segments_findInSegments_with_segment_indices | Segments in array | Searches only segments whose indices are in the

provided array |

When to use:

- Use findInAllSegments when you need to search through all segments
- Use findInSegments with range when you want to search a contiguous range of segments
- Use findInSegments with array when you have a specific, non-contiguous set of segment indices

## Conditional Find Functions

These functions add an additional segment-level condition, searching only in segments that satisfy both the segment condition and contain elements matching the element condition:

Function | Segments Searched | Description
--- | --- | ---
Segments_findInAllSegmentsIf | All segments matching condition | Searches all segments that satisfy the segment

condition | | Segments_findInSegmentsIf | Segments [begin, end) matching condition | Searches segments in range that satisfy the segment condition |

Note: The segment condition allows to skip entire segments based on segment-level properties, and so to improve performance.

# Common Parameters

All find functions share these common parameters:

- segments: The segments container to search in
- condition: Lambda that tests if an element matches the search criteria (see Condition Lambda)
- storer: Lambda that processes the search results for each segment (see Result Storer Lambda)
- launchConfig: Configuration for parallel execution (optional)

Conditional variants additionally require:

- segmentCondition: Lambda that determines if a segment should be searched (see Segment Condition Lambda)

# Usage Guidelines

Performance considerations:

- Use segment-level conditions (*If variants) to avoid unnecessary work on segments you don't need to search.
- The array overload is useful when you have pre-computed which segments to search. It also skips segments that are not needed and thus can improve performance.

# Related Pages

- Lambda Functions for Segment Find Operations - Detailed lambda function signatures