All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kernels.double.binomial.kh Maven / Gradle / Ivy

#include 
#include 
__global  double doBinomial(int n, double p, double *randomNumbers,curandGenerator_t s) {
  int x = 0;
  int tid = get_local_id(0) + get_group_id(0) * get_local_size(0);

  for(int i = tid; i < n; i++) {
    if(randomNumbers[i]< p )
      x++;
  }
  return x;
}


extern "C"
__kernel void binomial_double(int len,int n,double *ps,double *randomNumbers,double *result, curandGenerator_t s) {
          int tid = get_local_id(0) + get_group_id(0) * get_local_size(0);
          for(int i = tid; i < len; i += get_local_size(0) * get_num_groups(0)) {
              result[i] = doBinomial(n,ps[i],randomNumbers,s);
          }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy