thrust::transform(
thrust::make_permutation_iterator(h1.begin(),
thrust::make_transform_iterator(thrust::make_counting_iterator(0),
IndexDivFunctor(n))),
thrust::make_permutation_iterator(h1.begin(),
thrust::make_transform_iterator(thrust::make_counting_iterator(0),
IndexDivFunctor(n))) + n * n,
thrust::make_permutation_iterator(a1.begin(),
thrust::make_transform_iterator(thrust::make_counting_iterator(0),
Indexa1Functor(n, pos))),
y.begin(),
thrust::multiplies<double>());