boostorg / boostorg/compute

how to reduce "array of custom user structures" with custom function ?

Open
#858 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

for example needs something that,

`
__declspec(align(16))
struct Box_aligned {
float3 v0;
float3 v1;
}

`boost::compute::vector boxes(10, context);`
// and do something with values of array "boxes"

Box_aligned bounds;

boost::compute::reduce(boxes.begin(), boxes.end(), &bounds, BoxUnion(), queue);
`

where "some BinaryFunction" is somthing lika that,

struct BoxUnion {
Box_aligned operator()(const Box_aligned b1, const Box_aligned b2) const {
Box_aligned bounds;
bounds.v0 = fmin(b1.v0, b2.v0);
bounds.v1 = fmax(b1.v1, b2.v1);
return bounds;
}
};

how to reduce such array of "Box_aligned" values ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.