aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/extent-sampling.h6
-rw-r--r--include/oracles.h51
2 files changed, 43 insertions, 14 deletions
diff --git a/include/extent-sampling.h b/include/extent-sampling.h
index 8ed3fb2..fd11bc4 100644
--- a/include/extent-sampling.h
+++ b/include/extent-sampling.h
@@ -5,7 +5,11 @@
#include <gsl/gsl_rstat.h>
#include <gsl/gsl_vector.h>
-typedef double (*extent_oracle_t) (const gsl_vector*);
+typedef struct {
+ double (*oracle) (const gsl_rng*, const gsl_vector*, void*);
+ void *params;
+} extent_oracle_t;
+
typedef double (*integrand_t) (double, const gsl_vector*);
void init_random (void);
diff --git a/include/oracles.h b/include/oracles.h
index b8421ed..c294b84 100644
--- a/include/oracles.h
+++ b/include/oracles.h
@@ -4,23 +4,48 @@
#include <gsl/gsl_rng.h>
#include <gsl/gsl_vector.h>
-double bernoulli_extent_generator (const gsl_rng* r, double p, double r0, double r1);
-double bernoulli_true_volume (double p, double r0, double r1, unsigned int dimension);
+typedef struct {
+ double p, r0, r1;
+} bernoulli_params;
-double uniform_extent_generator (const gsl_rng* r, double a, double b);
-double uniform_true_volume (double a, double b, unsigned int dimension);
+double bernoulli_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double bernoulli_true_volume (unsigned int dimension, void *params);
-double beta_extent_generator (const gsl_rng* r, double alpha, double beta);
-double beta_true_volume (double alpha, double beta, unsigned int dimension);
+typedef struct {
+ double a, b;
+} uniform_params;
-double cube_extent_oracle (const gsl_vector* x, double edge);
-double cube_extent_oracle_with_center (const gsl_vector* x, const gsl_vector* center, double edge);
-double cube_true_volume (double edge, unsigned int dimension);
+double uniform_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double uniform_true_volume (unsigned int dimension, void *params);
-double ellipsoid_extent_oracle (const gsl_vector* x, const gsl_vector* axes);
-double ellipsoid_true_volume (const gsl_vector* axes);
+typedef struct {
+ double alpha, beta;
+} beta_params;
-double spheroid_extent_oracle (const gsl_vector* x, double eccentricity);
-double spheroid_true_volume (double eccentricity, unsigned int dimension);
+double beta_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double beta_true_volume (unsigned int dimension, void *params);
+
+typedef struct {
+ double edge;
+ const gsl_vector* center;
+} cube_params;
+
+double cube_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double cube_extent_oracle_with_center (const gsl_rng *r, const gsl_vector *x, void *params);
+double cube_true_volume (unsigned int dimension, void *params);
+
+typedef struct {
+ const gsl_vector* axes;
+} ellipsoid_params;
+
+double ellipsoid_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double ellipsoid_true_volume (unsigned int dimension, void *params);
+
+typedef struct {
+ double eccentricity;
+} spheroid_params;
+
+double spheroid_extent_oracle (const gsl_rng *r, const gsl_vector *x, void *params);
+double spheroid_true_volume (unsigned int dimension, void *params);
#endif