<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2005/05/ea2188ebdcfcb2c153d6fa92a75855b7"
  from="James E. Scott &lt;james.scott@l...&gt;"
  author="James E. Scott"
  date="2005-05-18T13:32:38"
  subject="Re: [Caml-list] using gsl library...."
  prev="2005/05/725ad833bf2d3b144a9847221542e80d"
  next="2005/05/1fafad7f0c1581c0398bc91c183d7000"
  prev-in-thread="2005/05/725ad833bf2d3b144a9847221542e80d"
  prev-thread="2005/05/57a93b75afa283d5253a4b19199a197b"
  next-thread="2005/05/1fafad7f0c1581c0398bc91c183d7000"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="using gsl library....">
<msg 
  url="2005/05/725ad833bf2d3b144a9847221542e80d"
  from="Lars Schouw &lt;schouwla@y...&gt;"
  author="Lars Schouw"
  date="2005-05-18T10:04:55"
  subject="using gsl library....">
<msg 
  url="2005/05/ea2188ebdcfcb2c153d6fa92a75855b7"
  from="James E. Scott &lt;james.scott@l...&gt;"
  author="James E. Scott"
  date="2005-05-18T13:32:38"
  subject="Re: [Caml-list] using gsl library....">
</msg>
</msg>
</thread>

<contents>

Hi Lars,

it depends on how exactly you've installed it, but the following works 
here (on an MSVC build of both ocaml and GSL)

$ ocamlopt bigarray.cmxa -I +gsl gsl.cmxa  bs.ml -cclib gsl.lib

$ ./camlprog.exe
# gaussian with sigma=3
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501
+0.9986501

If gsl.cmxa is in ".." you should have:

C:\ocaml\gsl\ocamlgsl-0.4.0\examples&gt;ocamlopt -cclib gsl.lib -I .. bigarray.cmxa gsl.cmxa bs.ml



James

Lars Schouw wrote:

&gt;This is newbii !!!
&gt;
&gt;We are trying to use the ocmlgsl library.
&gt;
&gt;we are trying to call the ugaussian_P function
&gt;belonging to Gsl_cdf.
&gt;
&gt;This works:
&gt;
&gt;open Gsl_fun;;
&gt;
&gt;let _ =
&gt;Gsl_error.init () ;
&gt;Gsl_rng.env_setup ()
&gt;
&gt;let rng = Gsl_rng.make (Gsl_rng.default ())
&gt;
&gt;let sigma = 3.
&gt;
&gt;let _ =
&gt;Printf.printf "# gaussian with sigma=%g\n" sigma ;
&gt;for i=1 to 10 do
&gt;let x = Gsl_randist.gaussian rng 3. in
&gt;Printf.printf "%+.7f\n" x
&gt;done
&gt;
&gt;
&gt;This does not compile:
&gt;let _ =
&gt;Gsl_error.init () ;
&gt;Gsl_rng.env_setup ()
&gt;
&gt;let rng = Gsl_rng.make (Gsl_rng.default ())
&gt;
&gt;let sigma = 3.
&gt;
&gt;let _ =
&gt;Printf.printf "# gaussian with sigma=%g\n" sigma ;
&gt;for i=1 to 10 do
&gt;let x = Gsl_cdf.ugaussian_P 3. in
&gt;
&gt;Printf.printf "%+.7f\n" x
&gt;done
&gt;
&gt;C:\ocaml\gsl\ocamlgsl-0.4.0\examples&gt;ocamlopt -cclib
&gt;gsl.lib -I ..
&gt;bigarray.cmxa
&gt;..\gsl.cmxa bs.ml
&gt;File "bs.ml", line 23, characters 12-31:
&gt;Unbound value Gsl_cdf.ugaussian_P
&gt;
&gt;Do you have any ideas what I do wrong?
&gt;
&gt;I am using my own Windows 1.6 build of GSL that I
&gt;build yesterday.
&gt;
&gt;Regards
&gt;Lars Schouw
&gt;
&gt;BTW. I asked this on the ocaml_beginners mailing list
&gt;and they told me this is to Windows specific.
&gt;
&gt;BTW2: From the ocaml_beginner mailing list
&gt;It works on Debian if you do
&gt;/usr/lib# ln -s libgsl.so.0 libgsl.so
&gt;/usr/lib# ln -s libgslcblas.so.0 libgslcblas.so
&gt;/usr/lib# ldconfig
&gt;  
&gt;
&gt;&gt;Then I compiled your second example with:
&gt;&gt;
&gt;&gt;$ ocamlopt -cclib -lgsl -I +gsl gsl.cmxa test.ml -o
&gt;&gt;    
&gt;&gt;
&gt;test
&gt;and ran it with:
&gt;  
&gt;
&gt;&gt;&gt;$ ./test
&gt;&gt;&gt;# gaussian with sigma=3
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;+0.9986501
&gt;&gt;&gt;      
&gt;&gt;&gt;
&gt;
&gt;BTW3: If I try this I get an unbound module error
&gt;C:\ocaml\gsl\ocamlgsl-0.4.0\examples&gt;ocamlopt -cclib
&gt;-lgsl -I +gsl
&gt;  
&gt;
&gt;&gt;gsl.cmxa bs.ml -i bs
&gt;&gt;File "bs.ml", line 2, characters 0-12:
&gt;&gt;Unbound module Gsl_fun
&gt;&gt;    
&gt;&gt;
&gt;
&gt;
&gt;		
&gt;__________________________________ 
&gt;Yahoo! Mail Mobile 
&gt;Take Yahoo! Mail with you! Check email on your mobile phone. 
&gt;http://mobile.yahoo.com/learn/mail 
&gt;
&gt;_______________________________________________
&gt;Caml-list mailing list. Subscription management:
&gt;http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
&gt;Archives: http://caml.inria.fr
&gt;Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
&gt;Bug reports: http://caml.inria.fr/bin/caml-bugs
&gt;
&gt;
&gt;  
&gt;

</contents>

</message>

