0
当我想执行浮动的阵列上减少我通常做到以下几点:Cuda的推力 - 最大VEC3
float res = *thrust::max_element(thrust::device,
thrust::device_ptr<float>(dDensities),
thrust::device_ptr<float>(dDensities+numParticles)
);
但是我想现在做的是非常对VEC 3同样的事情(GLM的库类型)数组:
float res = *thrust::max_element(thrust::device,
thrust::device_ptr<glm::vec3>(dDensities),
thrust::device_ptr<glm::vec3>(dDensities+numParticles)
);
正如你所看到的,这有因为“<”运营商未在规定毫无意义。但我想根据他的长度得到最大的vec3:
len = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z);
这可能吗?