mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-28 23:42:00 +02:00
Erf
This commit is contained in:
parent
b5ee17ca3e
commit
daf96d567b
@ -1,4 +1,5 @@
|
||||
include Constants
|
||||
external erf_float : float -> float = "erf_float_bytecode" "erf_float" [@@unboxed] [@@noalloc]
|
||||
|
||||
let factmax = 150
|
||||
|
||||
@ -12,7 +13,10 @@ let rec boys_function ~maxm t =
|
||||
begin
|
||||
if t = 0. then [| 1. |] else
|
||||
let sq_t = sqrt t in
|
||||
(*
|
||||
[| (sq_pi_over_two /. sq_t) *. Gsl.Sf.erf sq_t |]
|
||||
*)
|
||||
[| (sq_pi_over_two /. sq_t) *. erf_float sq_t |]
|
||||
end
|
||||
| _ ->
|
||||
begin
|
||||
@ -87,3 +91,5 @@ let chop f g =
|
||||
if (abs_float f) < cutoff then 0.
|
||||
else f *. (g ())
|
||||
|
||||
|
||||
|
||||
|
15
Utils/math_functions.c
Normal file
15
Utils/math_functions.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <math.h>
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/alloc.h>
|
||||
|
||||
|
||||
CAMLprim value erf_float_bytecode(value x)
|
||||
{
|
||||
return copy_double(erf(Double_val(x)));
|
||||
}
|
||||
|
||||
CAMLprim double erf_float(double x)
|
||||
{
|
||||
return erf(x);
|
||||
}
|
||||
|
2
_tags
2
_tags
@ -1 +1,3 @@
|
||||
true: package(str,gsl,zarith)
|
||||
<*.byte> : linkdep(Utils/math_functions.o)
|
||||
<*.native>: linkdep(Utils/math_functions.o)
|
||||
|
8
myocamlbuild.ml
Normal file
8
myocamlbuild.ml
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
open Ocamlbuild_plugin;;
|
||||
|
||||
dispatch (function
|
||||
| After_rules ->
|
||||
pdep ["link"] "linkdep" (fun param -> [param])
|
||||
| _ -> ())
|
||||
|
Loading…
Reference in New Issue
Block a user