aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-06-30 14:56:06 +0530
committerArun Isaac2021-06-30 14:56:06 +0530
commit0eae38289f47dd2fe777e9688d5f770cefc7f404 (patch)
tree47a9d1804600c43f5780f2670e2b398b17f17aab
parente1538eee83ba5d7ce9a84453434473e7a4ed8f8a (diff)
downloadnsmc-0eae38289f47dd2fe777e9688d5f770cefc7f404.tar.gz
nsmc-0eae38289f47dd2fe777e9688d5f770cefc7f404.tar.lz
nsmc-0eae38289f47dd2fe777e9688d5f770cefc7f404.zip
Expose rstats in scheme wrapper.
* scm/nsmc/wrap.scm (rstat-alloc): Export it. (volume, integral): Accept and return rstats object.
-rw-r--r--scm/nsmc/wrap.scm34
1 files changed, 15 insertions, 19 deletions
diff --git a/scm/nsmc/wrap.scm b/scm/nsmc/wrap.scm
index 9226483..14d328f 100644
--- a/scm/nsmc/wrap.scm
+++ b/scm/nsmc/wrap.scm
@@ -185,7 +185,7 @@
;; Running statistics
-(define rstat-alloc
+(define-public rstat-alloc
(make-gsl-alloc "gsl_rstat_alloc" (list) "gsl_rstat_free"))
(define-public rstat-n
@@ -371,24 +371,20 @@
%null-pointer))
(integrand integrand)))
-(define-public (volume extent-oracle true-volume dimension rtol)
- (let ((stats (rstat-alloc)))
- ((pointer->procedure void
- (dynamic-func "volume" lib-nsmc)
- (list '* double '* unsigned-int double '*))
- (maybe-procedure->extent-oracle extent-oracle)
- true-volume %gsl-random-state dimension rtol stats)
- stats))
-
-(define-public (integral integrand extent-oracle true-integral dimension rtol)
- (let ((stats (rstat-alloc)))
- ((pointer->procedure void
- (dynamic-func "integral" lib-nsmc)
- (list '* '* double '* unsigned-int double '*))
- (maybe-procedure->integrand integrand)
- (maybe-procedure->extent-oracle extent-oracle)
- true-integral %gsl-random-state dimension rtol stats)
- stats))
+(define-public (volume extent-oracle true-volume dimension rtol stats)
+ ((pointer->procedure void
+ (dynamic-func "volume" lib-nsmc)
+ (list '* double '* unsigned-int double '*))
+ (maybe-procedure->extent-oracle extent-oracle)
+ true-volume %gsl-random-state dimension rtol stats))
+
+(define-public (integral integrand extent-oracle true-integral dimension rtol stats)
+ ((pointer->procedure void
+ (dynamic-func "integral" lib-nsmc)
+ (list '* '* double '* unsigned-int double '*))
+ (maybe-procedure->integrand integrand)
+ (maybe-procedure->extent-oracle extent-oracle)
+ true-integral %gsl-random-state dimension rtol stats))
(define-public (volume-importance extent-oracle mean samples-per-cone
solid-angle-factor solid-angle-threshold-exponent-factor)