aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-02-23 16:38:41 +0530
committerArun Isaac2021-02-23 16:38:41 +0530
commite2bce25ab0f7eb0065812ebdc4f251206b86b446 (patch)
tree33482a9836257b95899f9789800f7d9374342d21
parentc9bbe9be613e0a035a4d030778d85f4effc4cfaa (diff)
downloadnsmc-e2bce25ab0f7eb0065812ebdc4f251206b86b446.tar.gz
nsmc-e2bce25ab0f7eb0065812ebdc4f251206b86b446.tar.lz
nsmc-e2bce25ab0f7eb0065812ebdc4f251206b86b446.zip
Wrap volume function.
* scm/extent-sampling/wrap.scm (maybe-procedure->extent-oracle, maybe-procedure->integrand): New functions.
-rw-r--r--scm/extent-sampling/wrap.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/scm/extent-sampling/wrap.scm b/scm/extent-sampling/wrap.scm
index 25b9970..6bf0972 100644
--- a/scm/extent-sampling/wrap.scm
+++ b/scm/extent-sampling/wrap.scm
@@ -311,3 +311,25 @@
(make-integrand (dynamic-func "x_coordinate_integrand" lib-extentsampling)
%null-pointer))
+;; extent-sampling
+
+(define maybe-procedure->extent-oracle
+ (match-lambda
+ ((? procedure? proc)
+ (make-extent-oracle
+ (procedure->pointer double
+ (lambda (r x params)
+ (proc r x))
+ (list '* '* '*))
+ %null-pointer))
+ (extent-oracle extent-oracle)))
+
+(define-public (volume extent-oracle true-volume dimension rtol)
+ (let ((stats (rstat-alloc)))
+ ((pointer->procedure double
+ (dynamic-func "volume" lib-extentsampling)
+ (list '* double '* unsigned-int double '*))
+ (maybe-procedure->extent-oracle extent-oracle)
+ true-volume %gsl-random-state dimension rtol stats)
+ (rstat-n stats)))
+