Template Numerical Library: Lambda Functions for Segment Find Operations

Template Numerical Library version\ main:c7077e4fd

Loading...
Searching...
No Matches
Lambda Functions for Segment Find Operations

This page describes the lambda function signatures used in segment find operations.

# Condition Lambda

The condition lambda determines whether an element within a segment satisfies the search condition. It has the following signature:

auto condition = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx ) -> bool
{
// Return true if element satisfies the condition
return ...;
};
__cuda_callable__
#define __cuda_callable__
Definition Macros.h:49

- segmentIdx is the index of the segment.
- localIdx is the rank of the element within the segment.
- globalIdx is the index of the element in the corresponding container.

The lambda should return true if the element satisfies the search condition.

# Result Storer Lambda

The result storer lambda manages the results of the search operation. It has the following signature:

auto storer = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, bool found )
{
// Process the search result
if( found ) {
// localIdx points to the position where element was found
}
};

- segmentIdx is the index of the segment.
- localIdx is the index of the element within the segment (valid only if found is true).
- found is a boolean indicating whether the element was found.

This lambda is called for each processed segment. If found is true, localIdx points at the position in the segment where the element was found.

# Segment Condition Lambda

The segment condition lambda determines which segments should be searched. It has the following signature:

auto segmentCondition = [=] __cuda_callable__ ( IndexType segmentIdx ) -> bool
{
// Return true if segment should be searched
return ...;
};

- segmentIdx is the index of the segment.

The lambda should return true if the segment should be searched.