Commits

Chris_T committed b7f7c07

Replace the deprecated Diff by the Deriv module

  • Participants
  • Parent commits 57bdddb

Comments (0)

Files changed (16)

 # OASIS_START
-# DO NOT EDIT (digest: abb8ae7353f835703db3ce4139a9e87e)
+# DO NOT EDIT (digest: 70c771b61e921ff6b11bed153866720d)
 lib/Blas
 lib/Blas_flat
 lib/Blas_gen
 lib/Cheb
 lib/Combi
 lib/Const
-lib/Diff
+lib/Deriv
 lib/Eigen
 lib/Error
 lib/Fft
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 20f1320c01a6d305f75f59bdd25a283e) *)
+(* DO NOT EDIT (digest: a7cf00a89a707c213ca63e4a81991dbd) *)
 This is the INSTALL file for the gsl distribution.
 
 This package uses OASIS to generate its build system. See section OASIS for
-full information. 
+full information.
 
 Dependencies
 ============
                   Cheb,
                   Combi,
                   Const,
-                  Diff,
+                  Deriv,
                   Eigen,
                   Error,
                   Fft,
                   mlgsl_cheb.c,
                   mlgsl_combi.c,
                   mlgsl_complex.c,
-                  mlgsl_diff.c,
+                  mlgsl_deriv.c,
                   mlgsl_eigen.c,
                   mlgsl_error.c,
                   mlgsl_fft.c,
   Install:        false
   CompiledObject: best
 
-Executable diff_ex
+Executable deriv_ex
   Path:           examples
-  MainIs:         diff_ex.ml
+  MainIs:         deriv_ex.ml
   Build$:         flag(examples)
   BuildDepends:   gsl
   Install:        false
 # OASIS_START
-# DO NOT EDIT (digest: 96ceb4fb71bb23697d1c261c38f69996)
+# DO NOT EDIT (digest: 31e14fe3d1192ecb11b8777f406b3b65)
 # Ignore VCS directories, you can use the same kind of rule outside
 # OASIS_START/STOP if you want to exclude directories that contains
 # useless stuff for the build process
 "lib/cheb.cmx": for-pack(Gsl)
 "lib/combi.cmx": for-pack(Gsl)
 "lib/const.cmx": for-pack(Gsl)
-"lib/diff.cmx": for-pack(Gsl)
+"lib/deriv.cmx": for-pack(Gsl)
 "lib/eigen.cmx": for-pack(Gsl)
 "lib/error.cmx": for-pack(Gsl)
 "lib/fft.cmx": for-pack(Gsl)
 "lib/mlgsl_cheb.c": oasis_library_gsl_ccopt
 "lib/mlgsl_combi.c": oasis_library_gsl_ccopt
 "lib/mlgsl_complex.c": oasis_library_gsl_ccopt
-"lib/mlgsl_diff.c": oasis_library_gsl_ccopt
+"lib/mlgsl_deriv.c": oasis_library_gsl_ccopt
 "lib/mlgsl_eigen.c": oasis_library_gsl_ccopt
 "lib/mlgsl_error.c": oasis_library_gsl_ccopt
 "lib/mlgsl_fft.c": oasis_library_gsl_ccopt
 "lib/mlgsl_cheb.c": pkg_bigarray
 "lib/mlgsl_combi.c": pkg_bigarray
 "lib/mlgsl_complex.c": pkg_bigarray
-"lib/mlgsl_diff.c": pkg_bigarray
+"lib/mlgsl_deriv.c": pkg_bigarray
 "lib/mlgsl_eigen.c": pkg_bigarray
 "lib/mlgsl_error.c": pkg_bigarray
 "lib/mlgsl_fft.c": pkg_bigarray
 # Executable const_ex
 <examples/const_ex.{native,byte}>: use_gsl
 <examples/const_ex.{native,byte}>: pkg_bigarray
-# Executable diff_ex
-<examples/diff_ex.{native,byte}>: use_gsl
-<examples/diff_ex.{native,byte}>: pkg_bigarray
+# Executable deriv_ex
+<examples/deriv_ex.{native,byte}>: use_gsl
+<examples/deriv_ex.{native,byte}>: pkg_bigarray
 # Executable eigen_ex
 <examples/eigen_ex.{native,byte}>: use_gsl
 <examples/eigen_ex.{native,byte}>: pkg_bigarray

File examples/deriv_ex.ml

+open Gsl
+open Fun
+
+let f x =
+  (* raise Exit ;*)
+  x ** 1.5
+
+let test () =
+  let gslfun = f in
+  Printf.printf "f(x) = x^(3/2)\n" ;
+  flush stdout ;
+
+  begin
+    let { res=result; err=abserr } = Deriv.central ~f:gslfun ~x:2.0 ~h:1e-3 in
+    Printf.printf "x = 2.0\n" ;
+    Printf.printf "f'(x) = %.10f +/- %.5f\n" result abserr ;
+    Printf.printf "exact = %.10f\n\n" (1.5 *. sqrt 2.0)
+  end ;
+
+  flush stdout ;
+
+  begin
+    let { res=result; err=abserr } = Deriv.forward ~f:gslfun ~x:0.0 ~h:1e-3 in
+    Printf.printf "x = 0.0\n" ;
+    Printf.printf "f'(x) = %.10f +/- %.5f\n" result abserr ;
+    Printf.printf "exact = %.10f\n\n" 0.0
+  end
+
+let _ =
+  Error.init ();
+  test ()

File examples/diff_ex.ml

-open Gsl
-open Fun
-
-let f x = 
-  (* raise Exit ;*)
-  x ** 1.5
-
-let test () = 
-  let gslfun = f in
-  Printf.printf "f(x) = x^(3/2)\n" ;
-  flush stdout ;
-
-  begin
-    let { res=result; err=abserr } = Diff.central gslfun 2.0 in
-    Printf.printf "x = 2.0\n" ;
-    Printf.printf "f'(x) = %.10f +/- %.5f\n" result abserr ;
-    Printf.printf "exact = %.10f\n\n" (1.5 *. sqrt 2.0)
-  end ;
-
-  flush stdout ; 
-
-  begin
-    let { res=result; err=abserr } = Diff.forward gslfun 0.0 in
-    Printf.printf "x = 0.0\n" ;
-    Printf.printf "f'(x) = %.10f +/- %.5f\n" result abserr ;
-    Printf.printf "exact = %.10f\n\n" 0.0
-  end
-
-let _ = 
-  Error.init ();
-  test ()

File lib/deriv.ml

+(* gsl-ocaml - OCaml interface to GSL                       *)
+(* Copyright (©) 2002-2012 - Olivier Andrieu                *)
+(* Distributed under the terms of the GPL version 3         *)
+
+
+(* C code in mlgsl_deriv.c *)
+
+external central : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_central"
+
+external forward : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_forward"
+
+external backward : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_backward"

File lib/deriv.mli

+(* gsl-ocaml - OCaml interface to GSL                       *)
+(* Copyright (©) 2002-2012 - Olivier Andrieu                *)
+(* Distributed under the terms of the GPL version 3         *)
+
+(** Numerical Differentiation *)
+
+external central : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_central"
+(** [central f x h] computes the numerical derivative of the function
+    [f] at the point [x] using an adaptive central difference
+    algorithm with a step-size of [h].  The function returns a value
+    [r] with the derivative being in [r.res] and an estimate of its
+    absolute error in [r.err].  *)
+
+external forward : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_forward"
+(** [forward f x h] computes the numerical derivative of the function
+    [f] at the point [x] using an adaptive forward difference
+    algorithm with a step-size of [h].  The function is evaluated only
+    at points greater than [x], and never at [x] itself.  The function
+    returns [r] with the derivative in [r.res] and an estimate of its
+    absolute in [r.err].  This function should be used if f(x) has a
+    discontinuity at [x], or is undefined for values less than [x].  *)
+
+external backward : f:(float -> float) -> x:float -> h:float -> Fun.result
+  = "ml_gsl_deriv_backward"
+(** [forward f x h] computes the numerical derivative of the function
+    [f] at the point [x] using an adaptive backward difference
+    algorithm with a step-size of [h].  The function is evaluated only
+    at points less than [x], and never at [x] itself.  The function
+    returns a value [r] with the derivative in [r.res] and an estimate
+    of its absolute error in [r.err].  This function should be used if
+    f(x) has a discontinuity at [x], or is undefined for values greater
+    than [x].  *)

File lib/diff.ml

-(* gsl-ocaml - OCaml interface to GSL                       *)
-(* Copyright (©) 2002-2012 - Olivier Andrieu                *)
-(* Distributed under the terms of the GPL version 3         *)
-
-
-external central  : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_central"
-
-external forward  : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_forward"
-
-external backward : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_backward"

File lib/diff.mli

-(* gsl-ocaml - OCaml interface to GSL                       *)
-(* Copyright (©) 2002-2012 - Olivier Andrieu                *)
-(* Distributed under the terms of the GPL version 3         *)
-
-(** Numerical Differentiation *)
-
-external central  : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_central"
-
-external forward  : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_forward"
-
-external backward : Fun.gsl_fun -> float -> Fun.result
-    = "ml_gsl_diff_backward"

File lib/gsl.mlpack

 # OASIS_START
-# DO NOT EDIT (digest: 89abe9643e9172b3a72237fe167e75cc)
+# DO NOT EDIT (digest: d309bcd6e16e850d9e427eb17069b202)
 Blas
 Blas_flat
 Blas_gen
 Cheb
 Combi
 Const
-Diff
+Deriv
 Eigen
 Error
 Fft

File lib/libgsl_stubs.clib

 # OASIS_START
-# DO NOT EDIT (digest: aace118cbbb06f99495946c5af2c0c2e)
+# DO NOT EDIT (digest: ed754c8d7d248f374d490c5e4f80764f)
 mlgsl_blas.o
 mlgsl_blas_complex.o
 mlgsl_blas_complex_float.o
 mlgsl_cheb.o
 mlgsl_combi.o
 mlgsl_complex.o
-mlgsl_diff.o
+mlgsl_deriv.o
 mlgsl_eigen.o
 mlgsl_error.o
 mlgsl_fft.o

File lib/mlgsl_deriv.c

+/* gsl-ocaml - OCaml interface to GSL                       */
+/* Copyright (©) 2002-2012 - Olivier Andrieu                */
+/* Distributed under the terms of the GPL version 3         */
+
+
+#include <gsl/gsl_deriv.h>
+
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+
+#include "wrappers.h"
+#include "mlgsl_fun.h"
+
+value ml_gsl_deriv_central(value f, value x, value h)
+{
+  CAMLparam1(f);
+  double result,abserr;
+  GSLFUN_CLOSURE(gf, f);
+  gsl_deriv_central(&gf, Double_val(x), Double_val(h),
+                    &result, &abserr);
+  CAMLreturn(copy_two_double_arr(result, abserr));
+}
+
+value ml_gsl_deriv_forward(value f, value x, value h)
+{
+  CAMLparam1(f);
+  double result,abserr;
+  GSLFUN_CLOSURE(gf, f);
+  gsl_deriv_forward(&gf, Double_val(x), Double_val(h),
+                    &result, &abserr);
+  CAMLreturn(copy_two_double_arr(result, abserr));
+}
+
+value ml_gsl_deriv_backward(value f, value x, value h)
+{
+  CAMLparam1(f);
+  double result,abserr;
+  GSLFUN_CLOSURE(gf, f);
+  gsl_deriv_backward(&gf, Double_val(x), Double_val(h),
+                     &result, &abserr);
+  CAMLreturn(copy_two_double_arr(result, abserr));
+}

File lib/mlgsl_diff.c

-/* gsl-ocaml - OCaml interface to GSL                       */
-/* Copyright (©) 2002-2012 - Olivier Andrieu                */
-/* Distributed under the terms of the GPL version 3         */
-
-
-#include <gsl/gsl_diff.h>
-
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-
-#include "wrappers.h"
-#include "mlgsl_fun.h"
-
-value ml_gsl_diff_central(value f, value x)
-{
-  CAMLparam1(f);
-  double result,abserr;
-  GSLFUN_CLOSURE(gf, f);
-  gsl_diff_central(&gf, Double_val(x),
-		   &result, &abserr);
-  CAMLreturn(copy_two_double_arr(result, abserr));
-}
-
-value ml_gsl_diff_forward(value f, value x)
-{
-  CAMLparam1(f);
-  double result,abserr;
-  GSLFUN_CLOSURE(gf, f);
-  gsl_diff_forward(&gf, Double_val(x),
-		   &result, &abserr);
-  CAMLreturn(copy_two_double_arr(result, abserr));
-}
-
-value ml_gsl_diff_backward(value f, value x)
-{
-  CAMLparam1(f);
-  double result,abserr;
-  GSLFUN_CLOSURE(gf, f);
-  gsl_diff_backward(&gf, Double_val(x),
-		    &result, &abserr);
-  CAMLreturn(copy_two_double_arr(result, abserr));
-}

File myocamlbuild.ml

 (* OASIS_START *)
-(* DO NOT EDIT (digest: 94a4bf2323d0e17e0e2ada6d046d19cb) *)
+(* DO NOT EDIT (digest: 4055289e3214db6e2faf0968cfd9f923) *)
 module OASISGettext = struct
 (* # 22 "src/oasis/OASISGettext.ml" *)
 
           flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
           flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
           flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
-          flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
+          flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
+          flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
 
       | _ ->
           ()
 end
 
 
-# 550 "myocamlbuild.ml"
+# 554 "myocamlbuild.ml"
 open Ocamlbuild_plugin;;
 let package_default =
   {
 
 let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
 
-# 636 "myocamlbuild.ml"
+# 640 "myocamlbuild.ml"
 (* OASIS_STOP *)
 
 let () =
 (* setup.ml generated for the first time by OASIS v0.3.0~rc6 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: bf646a69adaaed0d8cc0f826333f676b) *)
+(* DO NOT EDIT (digest: 11944a93f4b6ee855f15bb3b61163874) *)
 (*
-   Regenerated by OASIS v0.4.0
+   Regenerated by OASIS v0.4.1
    Visit http://oasis.forge.ocamlcore.org for more information and
    documentation about functions used in this file.
 *)
     create "section_object" beta
       (fun () ->
          s_ "Implement an object section.")
+
+
+  let dynrun_for_release =
+    create "dynrun_for_release" alpha
+      (fun () ->
+         s_ "Make '-setup-update dynamic' suitable for releasing project.")
 end
 
 module OASISUnixPath = struct
 end
 
 
-# 2760 "setup.ml"
+# 2766 "setup.ml"
 module BaseEnvLight = struct
 (* # 22 "src/base/BaseEnvLight.ml" *)
 
 end
 
 
-# 2864 "setup.ml"
+# 2870 "setup.ml"
 module BaseContext = struct
 (* # 22 "src/base/BaseContext.ml" *)
 
 end
 
 
-# 5271 "setup.ml"
+# 5277 "setup.ml"
 module InternalConfigurePlugin = struct
 (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
 
 end
 
 
-# 6120 "setup.ml"
+# 6126 "setup.ml"
 module OCamlbuildCommon = struct
 (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
 
 end
 
 
-# 6522 "setup.ml"
+# 6528 "setup.ml"
 open OASISTypes;;
 
 let setup_t =
             ];
           homepage = Some "https://bitbucket.org/mmottl/gsl-ocaml";
           synopsis = "GSL - Bindings to the GNU Scientific Library";
-          description = Some "GSL - Bindings to the GNU Scientific Library";
+          description =
+            Some
+              "GSL - Bindings to the GNU Scientific Library\nThis version branched off from Olivier Andrieu's distribution\n(ocamlgsl) and includes patches as well as numerous\nAPI improvements.";
           categories = [];
           conf_type = (`Configure, "internal", Some "0.4");
           conf_custom =
                            "mlgsl_cheb.c";
                            "mlgsl_combi.c";
                            "mlgsl_complex.c";
-                           "mlgsl_diff.c";
+                           "mlgsl_deriv.c";
                            "mlgsl_eigen.c";
                            "mlgsl_error.c";
                            "mlgsl_fft.c";
                            "Cheb";
                            "Combi";
                            "Const";
-                           "Diff";
+                           "Deriv";
                            "Eigen";
                            "Error";
                            "Fft";
                    {exec_custom = false; exec_main_is = "const_ex.ml"});
                Executable
                  ({
-                     cs_name = "diff_ex";
+                     cs_name = "deriv_ex";
                      cs_data = PropList.Data.create ();
                      cs_plugin_data = []
                   },
                       bs_byteopt = [(OASISExpr.EBool true, [])];
                       bs_nativeopt = [(OASISExpr.EBool true, [])]
                    },
-                   {exec_custom = false; exec_main_is = "diff_ex.ml"});
+                   {exec_custom = false; exec_main_is = "deriv_ex.ml"});
                Executable
                  ({
                      cs_name = "eigen_ex";
           plugin_data = []
        };
      oasis_fn = Some "_oasis";
-     oasis_version = "0.4.0";
-     oasis_digest = Some "\135~\030�MP\132oet\159\152��pI";
+     oasis_version = "0.4.1";
+     oasis_digest =
+       Some "\206\172\250\233\194\225'\198\194\187\167~\129\142\175\026";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 7775 "setup.ml"
+# 7784 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;