Template Numerical Library version\ main:be918e6f
|
Classes | |
struct | TNL::AnyWithArg |
Function object implementing argany(x, y, i, j) , i.e. returning the first true value and its index. More... | |
struct | TNL::MaxWithArg |
Function object implementing argmax(x, y, i, j) , i.e. returning the maximum value and its index. More... | |
struct | TNL::MinWithArg |
Function object implementing argmin(x, y, i, j) , i.e. returning the minimum value and its index. More... | |
Function objects in this group implement a similar concept as the function objects in the Function objects for reduction operations group. They are intended for reductions with argument, such as the TNL::Algorithms::reduceWithArgument function. Here the reduction operation works not only with values, but also indexes of the values, which can be used to compute e.g. the position of a minimum or maximum in a sequence of values.
In general, each reduction operation with argument is implemented as a generic operator()
of the form auto operator()( Value& x, Value y, Index& i, Index j ) const -> void
, which computes an appropriate associative and commutative binary operation on the x
and y
values, updates the result into the x
, and also updates the index i
as appropriate.
The function objects in this group also implement the getIdentity()
method, which returns the identity element for the operation in the same way as function objects in the Function objects for reduction operations group.