find#
Find values in an operator based on a selection operator and returns the values. Users can define their own custom comparator function or choose from a built-in set of common comparators. The values meeting the selection criteria are returned in a_out, while the number of elements found are in num_found. It’s important that a_out is sized large enough to store all elements found or the behavior is undefined.
-
template<typename OpA, typename SelectType>
__MATX_INLINE__ auto matx::find(const OpA &a, SelectType sel)# Reduce values that meet a certain criteria
Finds all values meeting the criteria specified in SelectOp, and saves them out to an output tensor. This function is different from the MatX IF operator in that this performs a reduction on the input, whereas IF is only for element-wise output. Output tensor must be large enough to hold unique entries. To be safe, this can be the same size as the input, but if something is known about the data to indicate not as many entries are needed, the output can be smaller.
- Template Parameters:
SelectType – Type of select functor
InputOperator – Input type
- Parameters:
a – Input tensor
sel – Select functor
Examples#
// Find values greater than 0.5
TestType thresh = (TestType)0.5;
(mtie(t1o, num_found) = find(t1, GT{thresh})).run(exec);