Who could rewrite this example in cuda?

template
typename Spherical_covariance::result_type
Spherical_covariance::
compute(const typename Spherical_covariance::EuclideanVector& vec) const{
double h=euclidean_norm(vec);

if( h >= this->a_ )
return 0;
else
return this->c_ * (1 - 1.5h/this->a_ + 0.5pow(h/this->a_ , 3));
}

template
typename Spherical_covariance::result_type
Spherical_covariance::isotrop_compute(double h) const{
if( h >= this->a_ )
return 0.0;
else
return this->c_ * (1 - 1.5h/this->a_ + 0.5pow(h/this->a_ , 3));
}

Do you need to compute 100000 covariances? Btw, it is slighly better to store inverse (this->a_)

And then replace “pow(h/this->a_ , 3)” with “double quot = h*(this->a_reciprocal); double quot3 = quotquotquot;”