ValLocScalar

ValLocScalar is a class template that stores a value and its corresponding location (index) as a single, convenient unit. It is primarily designed to hold the result of parallel_reduce() operations using the MinLoc and MaxLoc builtin reducers.

It is generally recommended to get this type by using the reducer’s ::value_type member (e.g., MaxLoc<Scalar,Index,Space>::value_type) to ensure the correct template parameters are used.

Header File: <Kokkos_Core.hpp>

Usage

MaxLoc<T,I,S>::value_type result;
parallel_reduce(N,Functor,MaxLoc<T,I,S>(result));
T resultValue = result.val;
I resultIndex = result.loc;

Interface

template<class Scalar, class Index>
struct ValLocScalar
Template Parameters:
  • Scalar – The data type of the value being reduced (e.g., double, int).

  • Index – The data type of the location or iteration index (e.g., int, long long).

Data members

Scalar val

The reduced value.

Index loc

The location (iteration index) of the reduced value