File: vwrapper.h

package info (click to toggle)
cubature 1.0.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 268 kB
  • sloc: ansic: 1,513; makefile: 80; sh: 34
file content (16 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* 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;
}