aboutsummaryrefslogtreecommitdiff
path: root/scm/extent-sampling/wrap.scm
diff options
context:
space:
mode:
authorArun Isaac2021-02-23 16:29:44 +0530
committerArun Isaac2021-02-23 16:29:44 +0530
commitb712756e74e3e3c101064bbefc1d062b73d11443 (patch)
tree92d8aca35291af75195a819b271515a9643a1f20 /scm/extent-sampling/wrap.scm
parent25343d3723ae70690f056b0a501f5941892fbf93 (diff)
downloadnsmc-b712756e74e3e3c101064bbefc1d062b73d11443.tar.gz
nsmc-b712756e74e3e3c101064bbefc1d062b73d11443.tar.lz
nsmc-b712756e74e3e3c101064bbefc1d062b73d11443.zip
Implement the lower incomplete gamma function as a scheme wrapper.
With this change, the wrapper around the gsl lower incomplete gamma function is directly in scheme. Earlier, there was one layer of wrapping in C which needed to be wrapped again in scheme. * include/utils.h (lower_incomplete_gamma): Delete function. * src/utils.sc (lower-incomplete-gamma): Delete function. * scm/extent-sampling/wrap.scm (lower-incomplete-gamma): New function.
Diffstat (limited to 'scm/extent-sampling/wrap.scm')
-rw-r--r--scm/extent-sampling/wrap.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/scm/extent-sampling/wrap.scm b/scm/extent-sampling/wrap.scm
index 65fd7ad..0e32452 100644
--- a/scm/extent-sampling/wrap.scm
+++ b/scm/extent-sampling/wrap.scm
@@ -30,6 +30,16 @@
(dynamic-func "surface_area_of_ball" lib-extentsampling)
(list int)))
+(define-public (lower-incomplete-gamma s x)
+ (* ((pointer->procedure double
+ (dynamic-func "gsl_sf_gamma" lib-gsl)
+ (list double))
+ s)
+ ((pointer->procedure double
+ (dynamic-func "gsl_sf_gamma_inc_P" lib-gsl)
+ (list double double))
+ s x)))
+
(define-public angle-between-vectors
(pointer->procedure double
(dynamic-func "angle_between_vectors" lib-extentsampling)