aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-05-07 17:08:13 +0530
committerArun Isaac2021-05-07 17:08:13 +0530
commitfb92e453de4c5317d8f1304dece8281dce859cb4 (patch)
tree60e88d5fbb1134a3cfcf59626895f624f4b1ee68
parentb8fbf7aca272022c6e1e298636da789f31cd6fc4 (diff)
downloadnsmc-fb92e453de4c5317d8f1304dece8281dce859cb4.tar.gz
nsmc-fb92e453de4c5317d8f1304dece8281dce859cb4.tar.lz
nsmc-fb92e453de4c5317d8f1304dece8281dce859cb4.zip
Treat extent oracles and integrands as const arguments.
* include/extent-sampling.h (volume, volume_cone, volume_importance, integral): Pass extent oracle and integrand as const arguments. * src/extent-sampling.sc (volume, volume_cone, volume_importance, integral, integral-per-direction): Likewise.
-rw-r--r--include/extent-sampling.h8
-rw-r--r--src/extent-sampling.sc10
2 files changed, 9 insertions, 9 deletions
diff --git a/include/extent-sampling.h b/include/extent-sampling.h
index 376a52f..d1736b8 100644
--- a/include/extent-sampling.h
+++ b/include/extent-sampling.h
@@ -39,22 +39,22 @@ typedef struct {
void init_random (void);
void volume
-(extent_oracle_t *extent_oracle, double true_volume,
+(const extent_oracle_t *extent_oracle, double true_volume,
const gsl_rng* r, unsigned int dimension, double rtol,
gsl_rstat_workspace* stats);
void integral
-(integrand_t *integrand, extent_oracle_t *extent_oracle, double true_integral,
+(const integrand_t *integrand, const 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 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_importance
-(extent_oracle_t *extent_oracle, const gsl_rng* r,
+(const 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);
diff --git a/src/extent-sampling.sc b/src/extent-sampling.sc
index dd9427c..71051fd 100644
--- a/src/extent-sampling.sc
+++ b/src/extent-sampling.sc
@@ -39,7 +39,7 @@
(pre-define CONFIDENCE-INTERVAL-FACTOR 1.96)
(define (volume extent-oracle true-volume r dimension rtol stats)
- (void extent-oracle-t* double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
+ (void (const extent-oracle-t*) double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
(let* ((vn double (ln-volume-of-ball dimension)))
(with-vector x dimension
(do-while (> (rerror (gsl-rstat-mean stats) true-volume)
@@ -53,7 +53,7 @@
(pre-let* (INTEGRATION-INTERVALS 1000)
(define (integral-per-direction integrand direction n radius rtol)
- (double integrand-t* (const gsl-vector*) (unsigned int) double double)
+ (double (const integrand-t*) (const gsl-vector*) (unsigned int) double double)
(define (f r params) (double double void*)
(return (* (gsl-pow-uint r (- n 1))
(invoke-integrand integrand r direction))))
@@ -75,7 +75,7 @@
result))))
(define (integral integrand extent-oracle true-integral r dimension rtol stats)
- (void integrand-t* extent-oracle-t* double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
+ (void (const integrand-t*) (const extent-oracle-t*) double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
(with-vector x dimension
(do-while (> (rerror (gsl-rstat-mean stats) true-integral)
rtol)
@@ -85,7 +85,7 @@
stats))))
(define (volume-cone extent-oracle r mean omega-min omega-max number-of-samples variance)
- (double extent-oracle-t* (const gsl-rng*) (const gsl-vector*) double double (unsigned int) double*)
+ (double (const extent-oracle-t*) (const gsl-rng*) (const gsl-vector*) double double (unsigned int) double*)
(declare volume double)
(let* ((dimension (unsigned int) (: mean size))
(vn double (ln-volume-of-ball dimension))
@@ -105,7 +105,7 @@
(define (volume-importance extent-oracle r mean samples-per-cone solid-angle-factor
solid-angle-threshold-exponent-factor number-of-samples)
- (double extent-oracle-t* (const gsl-rng*) (const gsl-vector*)
+ (double (const extent-oracle-t*) (const gsl-rng*) (const gsl-vector*)
(unsigned int) double double (unsigned int*))
(define
volume double 0