Go to the documentation of this file.
9 template <
class T,
int rank,
int myStyle>
18 using yakl::componentwise::operator==;
19 using yakl::componentwise::operator&&;
20 using yakl::componentwise::operator!;
24 if (mask.totElems() != arr.totElems()) {
25 yakl_throw(
"Error: pack: arr and mask have a different number of elements");
28 int numTrue =
count( mask );
31 for (
int i=0; i < arr.totElems(); i++) {
32 if (mask.data()[i]) { ret.data()[slot] = arr.data()[i]; slot++; }
39 for (
int i=0; i < arr.totElems(); i++) {
40 ret.data()[i] = arr.data()[i];
47 template <
class T,
int rank,
int myStyle>
57 using yakl::componentwise::operator==;
58 using yakl::componentwise::operator&&;
59 using yakl::componentwise::operator!;
62 return pack(arr.createHostCopy() , mask.createHostCopy()).createDeviceCopy();
64 return pack(arr.createHostCopy() ).createDeviceCopy();
int count(Array< bool, rank, memHost, myStyle > const &mask)
Definition: YAKL_intrinsics_count.h:10
YAKL_INLINE auto shape(T const &arr)
Definition: YAKL_intrinsics_shape.h:9
YAKL_INLINE bool allocated(T const &arr)
Definition: YAKL_intrinsics_allocated.h:9
#define __YAKL_NAMESPACE_WRAPPER_END__
Definition: YAKL.h:20
constexpr bool streams_enabled
If the CPP Macro YAKL_ENABLE_STREAMS is defined, then this bool is set to true
Definition: YAKL_streams_events.h:11
#define __YAKL_NAMESPACE_WRAPPER_BEGIN__
Definition: YAKL.h:19
void fence()
Block the host code until all device code has completed.
Definition: YAKL_fence.h:16
YAKL_INLINE void yakl_throw(const char *msg)
Throw an error message. Works from the host or device.
Definition: YAKL_error.h:17
Array< T, 1, memHost, myStyle > pack(Array< T, rank, memHost, myStyle > const &arr, Array< bool, rank, memHost, myStyle > const &mask=Array< bool, rank, memHost, myStyle >())
Definition: YAKL_intrinsics_pack.h:10
This declares the yakl::Array class. Please see the yakl::styleC and yakl::styleFortran template spec...
Definition: YAKL_Array.h:40
bool any(Array< T, rank, memHost, myStyle > arr)
Definition: YAKL_intrinsics_any.h:10