about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-02-23 16:09:02 +0530
committerArun Isaac2021-02-23 16:09:02 +0530
commit50a7e81541b7b10a09df6cf5e85e8569ea3cec77 (patch)
tree041cbf7912e2f662d6213bc5ce3f0ab11c1e3ec1
parent13a224b6a3497b448eac4ffb86b0db707f6957a7 (diff)
downloadnsmc-50a7e81541b7b10a09df6cf5e85e8569ea3cec77.tar.gz
nsmc-50a7e81541b7b10a09df6cf5e85e8569ea3cec77.tar.lz
nsmc-50a7e81541b7b10a09df6cf5e85e8569ea3cec77.zip
Wrap gsl polynomial evaluation function.
* scm/extent-sampling/wrap.scm (polyval): New function.
-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 63d3d9e..65fd7ad 100644
--- a/scm/extent-sampling/wrap.scm
+++ b/scm/extent-sampling/wrap.scm
@@ -158,6 +158,16 @@
                       (dynamic-func "gsl_rstat_n" lib-extentsampling)
                       (list '*)))
 
+;; Polynomial functions
+
+(define-public (polyval coefficients x)
+  ((pointer->procedure double
+                       (dynamic-func "gsl_poly_eval" lib-gsl)
+                       (list '* int double))
+   (bytevector->pointer (list->typed-array 'f64 1 coefficients))
+   (length coefficients)
+   x))
+
 ;; nd-random
 
 (define-public (random-direction-vector dimension)