all_of
#
Header: <Kokkos_StdAlgorithms.hpp>
Description#
Returns true
if all the elements in a range or rank-1 View
satisfy
a target unary predicate.
Interface#
Warning
This is currently inside the Kokkos::Experimental
namespace.
Overload set accepting execution space#
template <class ExecutionSpace, class InputIterator, class Predicate>
bool all_of(const ExecutionSpace& exespace, (1)
InputIterator first, InputIterator last,
Predicate predicate);
template <class ExecutionSpace, class InputIterator, class Predicate>
bool all_of(const std::string& label, const ExecutionSpace& exespace, (2)
InputIterator first, InputIterator last,
Predicate predicate);
template <class ExecutionSpace, class DataType, class... Properties,
class Predicate>
bool all_of(const ExecutionSpace& exespace,
const ::Kokkos::View<DataType, Properties...>& view, (3)
Predicate predicate);
template <class ExecutionSpace, class DataType, class... Properties,
class Predicate>
bool all_of(const std::string& label, const ExecutionSpace& exespace, (4)
const ::Kokkos::View<DataType, Properties...>& view,
Predicate predicate);
Overload set accepting a team handle#
New in version 4.2.
template <class TeamHandleType, class InputIterator, class Predicate>
KOKKOS_FUNCTION
bool all_of(const TeamHandleType& teamHandle, (5)
InputIterator first, InputIterator last,
Predicate predicate);
template <class TeamHandleType, class DataType, class... Properties,
class Predicate>
KOKKOS_FUNCTION
bool all_of(const TeamHandleType& teamHandle, (6)
const ::Kokkos::View<DataType, Properties...>& view,
Predicate predicate);
Parameters and Requirements#
exespace
: execution space instanceteamHandle
: team handle instance given inside a parallel region when using a TeamPolicylabel
: string forwarded to internal parallel kernels for debugging purposes1: The default string is “Kokkos::all_of_iterator_api_default”.
3: The default string is “Kokkos::all_of_view_api_default”.
NOTE: overloads accepting a team handle do not use a label internally
first, last
: range of elements to search inmust be random access iterators, e.g., returned from
Kokkos::Experimental::(c)begin/(c)end
must represent a valid range, i.e.,
last >= first
must be accessible from
exespace
or from the execution space associated with the team handle
view
:must be rank-1, and have
LayoutLeft
,LayoutRight
, orLayoutStride
must be accessible from
exespace
or from the execution space associated with the team handle
pred
: unary functor returningtrue
if an argument satisfies the desired condition.pred(v)
must be valid to be called from the execution space passed, or the execution space associated with the team handle, and convertible to bool for every argumentv
of typevalue_type
, wherevalue_type
is the value type ofIteratorType
orview
and must not modifyv
.must conform to:
struct CustomPredicate{ KOKKOS_INLINE_FUNCTION bool operator()(const value_type & v) const { return /* true if v satisfies your desired condition */; } };
Return Value#
Returns true
if the unary predicate returns true
for all elements in the range or view
,
or the range or view
are empty. Returns false
otherwise.