https://github.com/stevengj/cubature
Raw File
Tip revision: d1955d864f53ecb2b95a802c4b9cceeeccae7b71 authored by Steven G. Johnson on 31 May 2023, 14:27:06 UTC
added citation info
Tip revision: d1955d8
vwrapper.h
/* vectorized wrapper around non-vectorized integrands */
typedef struct fv_data_s { integrand f; void *fdata; } fv_data;
static int fv(unsigned ndim, size_t npt,
	      const double *x, void *d_,
	      unsigned fdim, double *fval)
{
     fv_data *d = (fv_data *) d_;
     integrand f = d->f;
     void *fdata = d->fdata;
     unsigned i;
     /* printf("npt = %u\n", npt); */
     for (i = 0; i < npt; ++i) 
	  if (f(ndim, x + i*ndim, fdata, fdim, fval + i*fdim))
	       return FAILURE;
     return SUCCESS;
}
back to top