aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/integrands.sc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/integrands.sc b/src/integrands.sc
new file mode 100644
index 0000000..750530c
--- /dev/null
+++ b/src/integrands.sc
@@ -0,0 +1,19 @@
+(pre-include "gsl/gsl_math.h")
+(pre-include "gsl/gsl_poly.h")
+(pre-include "integrands.h")
+
+(define (polynomial-integrand r x -params) (double double (const gsl-vector*) void*)
+ (let* ((params polynomial-integrand-params*
+ (convert-type -params polynomial-integrand-params*)))
+ (return (gsl-poly-eval (: params coefficients)
+ (+ (: params degree) 1)
+ r))))
+
+(define (gaussian-integrand r x -params) (double double (const gsl-vector*) void*)
+ ;; This is a workaround to fix negation bug in sph-sc. See
+ ;; https://github.com/sph-mn/sph-sc/issues/5 . TODO: Remove
+ ;; workaround once bug is fixed upstream.
+ (return (exp (- 0 (/ (gsl-pow-2 r) 2)))))
+
+(define (x-coordinate-integrand r x -params) (double double (const gsl-vector*) void*)
+ (return (fabs (* r (gsl-vector-get x 0)))))