From 59c0f5d621d665a2ab48cc760b561a7b610ab5fd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 23 Feb 2021 16:21:51 +0530 Subject: Redefine integrand_t as a struct. This change will make it easier for the scheme wrapper to curry integrands. * include/extent-sampling.h (integrand_t): Redefine type as struct. (integral): Pass pointer to integrand_t. * src/extent-sampling.sc (integral-per-direction, integral): Handle new integrand-t type. (invoke-integrand): New sc macro. --- include/extent-sampling.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/extent-sampling.h b/include/extent-sampling.h index 27314a3..ef64fe3 100644 --- a/include/extent-sampling.h +++ b/include/extent-sampling.h @@ -10,7 +10,10 @@ typedef struct { void *params; } extent_oracle_t; -typedef double (*integrand_t) (double, const gsl_vector*); +typedef struct { + double (*integrand) (double, const gsl_vector*, void*); + void *params; +} integrand_t; void init_random (void); @@ -25,7 +28,7 @@ double volume_window unsigned int* number_of_samples); double integral -(integrand_t integrand, extent_oracle_t *extent_oracle, double true_integral, +(integrand_t *integrand, extent_oracle_t *extent_oracle, double true_integral, const gsl_rng* r, unsigned int dimension, double rtol, gsl_rstat_workspace* stats); -- cgit v1.2.3