У меня device_vector A. У меня есть Map M. Я хочу стереть элементы A, используя Map M. Я пытаюсь следующим образом, но выдает ошибку компиляции «Нет экземпляра перегруженной функции ...»
#include <thrust/sequence.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/permutation_iterator.h>
#include <thrust/fill.h>
void erase_value_using_map( thrust::device_vector<int>& A, thrust::device_vector<int> Map)
{
A.erase(thrust::make_permutation_iterator(A.begin(), Map.begin()),
thrust::make_permutation_iterator(A.begin(), Map.end()));
}
int main(int argc, char * argv[])
{
thrust::device_vector<int> A(20);
thrust::sequence(thrust::device, A.begin(), A.end(),0); // x components of the 'A' vectors
thrust::device_vector<int> Map(10);
Map[0]=2;Map[1]=4;Map[2]=8;Map[3]=10;Map[4]=11;Map[5]=13;Map[6]=15;Map[7]=17;Map[8]=19;Map[9]=6;
erase_value_using_map(A, Map);
return 0;
}
Сообщение об ошибке:
error: no instance of overloaded function "thrust::device_vector<T, Alloc>::erase [with T=int, Alloc=thrust::device_malloc_allocator<int>]" matches the argument list
argument types are: (thrust::permutation_iterator<thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<int>>>, thrust::permutation_iterator<thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<int>>>)
object type is: thrust::device_vector<int, thrust::device_malloc_allocator<int>>