MaxLoc#
Specific implementation of ReducerConcept storing the maximum value
Header File: Kokkos_Core.hpp
Usage:
MaxLoc<T,I,S>::value_type result;
parallel_reduce(N,Functor,MaxLoc<T,I,S>(result));
Synopsis#
template<class Scalar, class Index, class Space>
class MaxLoc{
public:
typedef MaxLoc reducer;
typedef ValLocScalar<typename std::remove_cv<Scalar>::type,
typename std::remove_cv<Index>::type > value_type;
typedef Kokkos::View<value_type, Space> result_view_type;
KOKKOS_INLINE_FUNCTION
void join(value_type& dest, const value_type& src) const
KOKKOS_INLINE_FUNCTION
void init( value_type& val) const;
KOKKOS_INLINE_FUNCTION
value_type& reference() const;
KOKKOS_INLINE_FUNCTION
result_view_type view() const;
KOKKOS_INLINE_FUNCTION
MaxLoc(value_type& value_);
KOKKOS_INLINE_FUNCTION
MaxLoc(const result_view_type& value_);
};
Public Class Members#
Typedefs#
reducer: The self type.value_type: The reduction scalar type (specialization of ValLocScalar)result_view_type: AKokkos::Viewreferencing the reduction result
Constructors#
MaxLoc(value_type& result)
Constructs a reducer which references a local variable as its result location.
MaxLoc(const result_view_type result)
Constructs a reducer which references a specific view as its result location.
Functions#
void join(value_type& dest, const value_type& src) const;
Store maximum with index of
srcanddestintodest:dest = (src.val > dest.val) ? src : dest;.void init( value_type& val) const;
Initialize
val.valusing the Kokkos::reduction_identity::max() method. The default implementation sets val=<TYPE>_MIN.Initialize
val.locusing the Kokkos::reduction_identity::min() method. The default implementation sets val=<TYPE>_MAX.value_type& reference() const;
Returns a reference to the result provided in class constructor.
result_view_type view() const;
Returns a view of the result place provided in class constructor.
Additional Information#
MaxLoc<T,I,S>::value_typeis Specialization of ValLocScalar on non-constTand non-constIMaxLoc<T,I,S>::result_view_typeisKokkos::View<T,S,Kokkos::MemoryTraits<Kokkos::Unmanaged>>. Note that the S (memory space) must be the same as the space where the result resides.Requires:
Scalarhasoperator =andoperator >defined.Kokkos::reduction_identity<Scalar>::max()is a valid expression.Requires:
Indexhasoperator =defined.Kokkos::reduction_identity<Index>::min()is a valid expression.In order to use MaxLoc with a custom type of either
ScalarorIndex, a template specialization ofKokkos::reduction_identity<CustomType>must be defined. See Built-In Reducers with Custom Scalar Types for details