aboutsummaryrefslogtreecommitdiff
path: root/scm/extent-sampling
diff options
context:
space:
mode:
Diffstat (limited to 'scm/extent-sampling')
-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)))
+