aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArun Isaac2021-04-20 17:03:28 +0530
committerArun Isaac2021-04-20 17:04:32 +0530
commitfa8fd4b94d5d03eda98a34fb6039925f2f9cd90e (patch)
tree5a288e4f0c102614d8e7b5c670f5d37c39ec15ae /src
parent9266f4ce5213ea3197484ca22cb82ca082382fc6 (diff)
downloadnsmc-fa8fd4b94d5d03eda98a34fb6039925f2f9cd90e.tar.gz
nsmc-fa8fd4b94d5d03eda98a34fb6039925f2f9cd90e.tar.lz
nsmc-fa8fd4b94d5d03eda98a34fb6039925f2f9cd90e.zip
Do not return volume or integral estimate.
We are already passing in the true volume or integral, and checking that the estimate is within the required tolerance. What is the point in returning the estimate to the caller. * include/extent-sampling.h (volume, integral): Return nothing. * src/extent-sampling.sc (volume, integral): Return nothing. * scm/nsmc/wrap.scm (volume, integral): Accept no return value from C function.
Diffstat (limited to 'src')
-rw-r--r--src/extent-sampling.sc16
1 files changed, 5 insertions, 11 deletions
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*)