Hello,
looking this BOOST_COMPUTE_FUNCTION as a template (
https://groups.google.com/forum/#!topic/boost-compute/hn4pOiVojvk),
I tempted to do something similar with BOOST_COMPUTE_CLOSURE.
But despite my best efforts I was unable to use correctly BOOST_COMPUTE_CLOSURE.
This is my problem:
class Point3d
{
private:
float p[3];
}
Point3d *points; // raw vector of thousand of points and more;
const Matrix4d matrix;
namespace compute = boost::compute;
compute::device device = compute::system::default_device();
compute::context context(device);
compute::command_queue queue(context, device);
compute::vector<Point3d> device_vector(groupDescriptor->gpc->getNumPoints(), context);
compute::copy(points, points + groupDescriptor->gpc->getNumPoints(), device_vector.begin(), queue);
auto foo = [&]<typename T>(const T& point)->compute::function<T(T)>
{
BOOST_COMPUTE_CLOSURE(T, apply_matrix, (const T point), (matrix), { return matrix*point; }); // In matrix*point the * operator is oveloaded, but I can perform multiplication without this, no problem.
return apply_matrix;
};
using boost::compute::lambda::_1;
compute::transform(
device_vector.begin(), device_vector.end(), device_vector.begin(), foo<Vector3fl>(), queue
);
compute::copy(device_vector.begin(), device_vector.end(), points, queue);
can sameone help me in this?
In boost compute there is a way to perform the multiplication matrix*point ? How to do?
many thanks,
Best regards
Gianluigi