Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/array/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,10 @@ template <class Shape, class Ptr, class Fn,
class = internal::enable_if_callable<Fn, typename std::remove_pointer<Ptr>::type&>>
NDARRAY_UNIQUE NDARRAY_HOST_DEVICE void for_each_value_in_order(
const Shape& shape, Ptr base, Fn&& fn) {
if (!base) {
assert(shape.empty());
return;
}
// TODO: This is losing compile-time constant extents and strides info
// (https://github.com/dsharlet/array/issues/1).
auto base_and_stride = std::make_pair(base, shape.stride());
Expand All @@ -1698,6 +1702,10 @@ template <class Shape, class ShapeA, class PtrA, class ShapeB, class PtrB, class
typename std::remove_pointer<PtrB>::type&>>
NDARRAY_UNIQUE NDARRAY_HOST_DEVICE void for_each_value_in_order(const Shape& shape,
const ShapeA& shape_a, PtrA base_a, const ShapeB& shape_b, PtrB base_b, Fn&& fn) {
if (!base_a || !base_b) {
assert(shape.empty());
return;
}
base_a += shape_a[shape.min()];
base_b += shape_b[shape.min()];
// TODO: This is losing compile-time constant extents and strides info
Expand Down