推力を使用してアクティブな配列要素のインデックスを返すにはどうすればよいですか?つまり、配列要素が1に等しいインデックスのベクトルを返しますか?
これを拡張すると、配列の次元が与えられた多次元インデックスの場合、これはどのように機能しますか?
編集:現在、関数は次のようになっています
template<class VoxelType>
void VoxelVolumeT<VoxelType>::cudaThrustReduce(VoxelType *cuda_voxels)
{
device_ptr<VoxelType> cuda_voxels_ptr(cuda_voxels);
int active_voxel_count = thrust::count(cuda_voxels_ptr, cuda_voxels_ptr + dim.x*dim.y*dim.z, 1);
device_vector<VoxelType> active_voxels;
thrust::copy_if(make_counting_iterator(0),
make_counting_iterator(dim.x*dim.y*dim.z),
cuda_voxels_ptr,
active_voxels.begin(),
_1 == 1);
}
エラーを引き起こしている
Error 15 error : no instance of overloaded function "thrust::copy_if" matches the argument list