caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* using gsl library....
@ 2005-05-18 10:04 Lars Schouw
  2005-05-18 13:31 ` [Caml-list] " James E. Scott
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Schouw @ 2005-05-18 10:04 UTC (permalink / raw)
  To: caml-list

This is newbii !!!

We are trying to use the ocmlgsl library.

we are trying to call the ugaussian_P function
belonging to Gsl_cdf.

This works:

open Gsl_fun;;

let _ =
Gsl_error.init () ;
Gsl_rng.env_setup ()

let rng = Gsl_rng.make (Gsl_rng.default ())

let sigma = 3.

let _ =
Printf.printf "# gaussian with sigma=%g\n" sigma ;
for i=1 to 10 do
let x = Gsl_randist.gaussian rng 3. in
Printf.printf "%+.7f\n" x
done


This does not compile:
let _ =
Gsl_error.init () ;
Gsl_rng.env_setup ()

let rng = Gsl_rng.make (Gsl_rng.default ())

let sigma = 3.

let _ =
Printf.printf "# gaussian with sigma=%g\n" sigma ;
for i=1 to 10 do
let x = Gsl_cdf.ugaussian_P 3. in

Printf.printf "%+.7f\n" x
done

C:\ocaml\gsl\ocamlgsl-0.4.0\examples>ocamlopt -cclib
gsl.lib -I ..
bigarray.cmxa
..\gsl.cmxa bs.ml
File "bs.ml", line 23, characters 12-31:
Unbound value Gsl_cdf.ugaussian_P

Do you have any ideas what I do wrong?

I am using my own Windows 1.6 build of GSL that I
build yesterday.

Regards
Lars Schouw

BTW. I asked this on the ocaml_beginners mailing list
and they told me this is to Windows specific.

BTW2: From the ocaml_beginner mailing list
It works on Debian if you do
/usr/lib# ln -s libgsl.so.0 libgsl.so
/usr/lib# ln -s libgslcblas.so.0 libgslcblas.so
/usr/lib# ldconfig
> Then I compiled your second example with:
>
> $ ocamlopt -cclib -lgsl -I +gsl gsl.cmxa test.ml -o
test
and ran it with:
> >
> > $ ./test
> > # gaussian with sigma=3
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501
> > +0.9986501

BTW3: If I try this I get an unbound module error
C:\ocaml\gsl\ocamlgsl-0.4.0\examples>ocamlopt -cclib
-lgsl -I +gsl
> gsl.cmxa bs.ml -i bs
> File "bs.ml", line 2, characters 0-12:
> Unbound module Gsl_fun


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] using gsl library....
  2005-05-18 10:04 using gsl library Lars Schouw
@ 2005-05-18 13:31 ` James E. Scott
  0 siblings, 0 replies; 2+ messages in thread
From: James E. Scott @ 2005-05-18 13:31 UTC (permalink / raw)
  To: Lars Schouw, caml-list


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>ocamlopt -cclib gsl.lib -I .. bigarray.cmxa gsl.cmxa bs.ml



James

Lars Schouw wrote:

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-18 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-18 10:04 using gsl library Lars Schouw
2005-05-18 13:31 ` [Caml-list] " James E. Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).