diff options
author | Arun Isaac | 2021-02-03 19:40:10 +0530 |
---|---|---|
committer | Arun Isaac | 2021-02-03 19:40:10 +0530 |
commit | 983f091af7849f259366f641b438ac1fee3df940 (patch) | |
tree | fd42196b6031638fd906afd8acbc5c26e34ce305 /include | |
parent | 707afdfe66dd9c931af77e4ff73186fd89ed27fd (diff) | |
download | nsmc-983f091af7849f259366f641b438ac1fee3df940.tar.gz nsmc-983f091af7849f259366f641b438ac1fee3df940.tar.lz nsmc-983f091af7849f259366f641b438ac1fee3df940.zip |
Move source files and headers to separate directories.
* extent-sampling.h, gaussian-nd-random.h, nd-random.h, oracles.h,
utils.h: Move into include directory.
* extent-sampling.c, gaussian-nd-random.c, nd-random.c, oracles.c,
utils.c: Move into src directory.
* CMakeLists.txt: Set include as include directory. Look for source
files inside src directory.
Diffstat (limited to 'include')
-rw-r--r-- | include/extent-sampling.h | 39 | ||||
-rw-r--r-- | include/gaussian-nd-random.h | 19 | ||||
-rw-r--r-- | include/nd-random.h | 15 | ||||
-rw-r--r-- | include/oracles.h | 37 | ||||
-rw-r--r-- | include/utils.h | 28 |
5 files changed, 138 insertions, 0 deletions
diff --git a/include/extent-sampling.h b/include/extent-sampling.h new file mode 100644 index 0000000..8ed3fb2 --- /dev/null +++ b/include/extent-sampling.h @@ -0,0 +1,39 @@ +#ifndef EXTENT_SAMPLING_H +#define EXTENT_SAMPLING_H + +#include <gsl/gsl_rng.h> +#include <gsl/gsl_rstat.h> +#include <gsl/gsl_vector.h> + +typedef double (*extent_oracle_t) (const gsl_vector*); +typedef double (*integrand_t) (double, const gsl_vector*); + +void init_random (void); + +double volume +(extent_oracle_t extent_oracle, double true_volume, + const gsl_rng* r, unsigned int dimension, double rtol, + gsl_rstat_workspace* stats); + +double volume_window +(extent_oracle_t extent_oracle, double true_volume, + const gsl_rng* r, unsigned int dimension, double rtol, + unsigned int* number_of_samples); + +double 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); + +double volume_cone +(extent_oracle_t extent_oracle, const gsl_rng* r, + const gsl_vector* mean, double omega_min, double omega_max, + unsigned int number_of_samples, double* variance); + +double volume_experiment +(extent_oracle_t extent_oracle, const gsl_rng* r, + const gsl_vector* mean, unsigned int samples_per_cone, + double solid_angle_factor, double solid_angle_threshold_exponent_factor, + unsigned int* number_of_samples); + +#endif diff --git a/include/gaussian-nd-random.h b/include/gaussian-nd-random.h new file mode 100644 index 0000000..951cb10 --- /dev/null +++ b/include/gaussian-nd-random.h @@ -0,0 +1,19 @@ +#ifndef GAUSSIAN_ND_RANDOM_H +#define GAUSSIAN_ND_RANDOM_H + +#include <gsl/gsl_rng.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_integration.h> + +double planar_angle_to_standard_deviation +(double mean, double theta_max, double truncation, unsigned int dimension); + +unsigned int shifted_gaussian_random_vector +(const gsl_rng* r, const gsl_vector* mean, + double theta_max, double truncation, gsl_vector* x); + +double shifted_gaussian_pdf +(double theta, double mean, double theta_max, + double truncation, unsigned int dimension, gsl_integration_workspace* w); + +#endif diff --git a/include/nd-random.h b/include/nd-random.h new file mode 100644 index 0000000..9637a0e --- /dev/null +++ b/include/nd-random.h @@ -0,0 +1,15 @@ +#ifndef ND_RANDOM_H +#define ND_RANDOM_H + +#include <gsl/gsl_integration.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_vector.h> + +void random_direction_vector (const gsl_rng* r, gsl_vector* x); +void hollow_cone_random_vector (const gsl_rng* r, const gsl_vector* mean, double theta_min, double theta_max, gsl_vector* x); +void subsampling_random_vector (const gsl_rng* r, const gsl_vector* mean, double theta_max, gsl_vector* x); + +double planar_angle_to_solid_angle (double planar_angle, unsigned int dimension); +double solid_angle_to_planar_angle (double solid_angle, unsigned int dimension); + +#endif diff --git a/include/oracles.h b/include/oracles.h new file mode 100644 index 0000000..a661c94 --- /dev/null +++ b/include/oracles.h @@ -0,0 +1,37 @@ +#ifndef ORACLES_H +#define ORACLES_H + +#include <gsl/gsl_blas.h> +#include <gsl/gsl_rng.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); + +double uniform_extent_generator (const gsl_rng* r, double a, double b); +double uniform_true_volume (double a, double b, unsigned int dimension); + +double beta_extent_generator (const gsl_rng* r, double alpha, double beta); +double beta_true_volume (double alpha, double beta, unsigned int dimension); + +double symmetric_spiral_extent_oracle (const gsl_vector* x); + +double right_triangle_extent_oracle (const gsl_vector* x, double base, double height); +double right_triangle_true_volume (double base, double height); + +double sphere_extent_oracle (const gsl_vector* x, double radius); +double sphere_maximum_extent (double radius); + +double plane_extent_oracle (const gsl_vector* x, double displacement); + +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 cube_maximum_extent (double edge, unsigned int dimension); + +double ellipsoid_extent_oracle (const gsl_vector* x, const gsl_vector* axes); +double ellipsoid_true_volume (const gsl_vector* axes); + +double spheroid_extent_oracle (const gsl_vector* x, double eccentricity); +double spheroid_true_volume (double eccentricity, unsigned int dimension); + +#endif diff --git a/include/utils.h b/include/utils.h new file mode 100644 index 0000000..220320e --- /dev/null +++ b/include/utils.h @@ -0,0 +1,28 @@ +#ifndef UTILS_H +#define UTILS_H + +#include <gsl/gsl_roots.h> +#include <gsl/gsl_vector.h> + +#define SIGNUM(x) ((x) < 0 ? -1 : 1) + +double volume_of_ball (unsigned int dimension); +double ln_volume_of_ball (unsigned int dimension); +double surface_area_of_ball (unsigned int dimension); +double ln_surface_area_of_ball (unsigned int dimension); +double lower_incomplete_gamma (double s, double x); + +double angle_between_vectors (const gsl_vector* x, const gsl_vector* y); +double dot_product (const gsl_vector* x, const gsl_vector* y); +double gaussian_pdf (double x); +double gaussian_cdf (double x); + +double rerror (double approx, double exact); + +double gprate (double start, double last, unsigned int n); +double gpterm (double a, double r, int n); + +double bisection (gsl_function* f, double a, double b); +double bisection_rlimit (gsl_function* f, double a, double b); + +#endif |