aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/extent-sampling.h4
-rw-r--r--scm/nsmc/wrap.scm4
-rw-r--r--src/extent-sampling.sc16
3 files changed, 9 insertions, 15 deletions
diff --git a/include/extent-sampling.h b/include/extent-sampling.h
index edf8b19..376a52f 100644
--- a/include/extent-sampling.h
+++ b/include/extent-sampling.h
@@ -38,12 +38,12 @@ typedef struct {
void init_random (void);
-double volume
+void volume
(extent_oracle_t *extent_oracle, double true_volume,
const gsl_rng* r, unsigned int dimension, double rtol,
gsl_rstat_workspace* stats);
-double integral
+void 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);
diff --git a/scm/nsmc/wrap.scm b/scm/nsmc/wrap.scm
index 005dd86..9789795 100644
--- a/scm/nsmc/wrap.scm
+++ b/scm/nsmc/wrap.scm
@@ -362,7 +362,7 @@
(define-public (volume extent-oracle true-volume dimension rtol)
(let ((stats (rstat-alloc)))
- ((pointer->procedure double
+ ((pointer->procedure void
(dynamic-func "volume" lib-nsmc)
(list '* double '* unsigned-int double '*))
(maybe-procedure->extent-oracle extent-oracle)
@@ -371,7 +371,7 @@
(define-public (integral integrand extent-oracle true-integral dimension rtol)
(let ((stats (rstat-alloc)))
- ((pointer->procedure double
+ ((pointer->procedure void
(dynamic-func "integral" lib-nsmc)
(list '* '* double '* unsigned-int double '*))
(maybe-procedure->integrand integrand)
diff --git a/src/extent-sampling.sc b/src/extent-sampling.sc
index 971f196..8cddb80 100644
--- a/src/extent-sampling.sc
+++ b/src/extent-sampling.sc
@@ -50,17 +50,14 @@
(pre-define CONFIDENCE-INTERVAL-FACTOR 1.96)
(define (volume extent-oracle true-volume r dimension rtol stats)
- (double extent-oracle-t* double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
- (declare volume double)
+ (void 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 volume true-volume)
+ (do-while (> (rerror (gsl-rstat-mean stats) true-volume)
rtol)
(random-direction-vector r x)
(gsl-rstat-add (exp (+ vn (* dimension (log (invoke-extent-oracle extent-oracle r x)))))
- stats)
- (set volume (gsl-rstat-mean stats)))))
- (return volume))
+ stats)))))
(sc-define-syntax (invoke-integrand integrand r x)
((: integrand integrand) r x (: integrand params)))
@@ -89,17 +86,14 @@
result))))
(define (integral integrand extent-oracle true-integral r dimension rtol stats)
- (double integrand-t* extent-oracle-t* double (const gsl-rng*) (unsigned int) double gsl-rstat-workspace*)
- (declare integral double)
+ (void integrand-t* 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)
(random-direction-vector r x)
(gsl-rstat-add (integral-per-direction integrand x r dimension
(invoke-extent-oracle extent-oracle r x) rtol)
- stats)
- (set integral (gsl-rstat-mean stats))))
- (return integral))
+ 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*)