Specific implementation of ReducerConcept storing both the minimum and maximum values
Header File: <Kokkos_Core.hpp>
MinMax<T,S>::value_type result;
parallel_reduce(N,Functor,MinMax<T,S>(result));
template<class Scalar, class Space>
class MinMax{
public:
typedef MinMax reducer;
typedef MinMaxScalar<typename std::remove_cv<Scalar>::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
MinMax(value_type& value_);
KOKKOS_INLINE_FUNCTION
MinMax(const result_view_type& value_);
};
MinMax<T,S>::value_type
is Specialization of MinMaxScalar on non-constT
MinMax<T,S>::result_view_type
isKokkos::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:
Scalar
hasoperator =
,operator <
andoperator >
defined.Kokkos::reduction_identity<Scalar>::min()
andKokkos::reduction_identity<Scalar>::max()
are a valid expressions. - In order to use MinMax with a custom type of
Scalar
, a template specialization ofKokkos::reduction_identity<CustomType>
must be defined. See Built-In Reducers with Custom Scalar Types for details