Hi!!! It would like to know if it exists a form to use the functions to generate variates in FORTRAN with the same easiness I use that them in C? Or not? If yes. They would have some example? I would like to use the functions rbeta, rlnorm and others! Sorry my english..rsrsrs Thanks!!! Fábio Mathias Corrêa University Federal of the Lavras - Brazil Veja quais são os assuntos do momento no Yahoo! +Buscados [[alternative HTML version deleted]]
Take a look at section 6.6 in Writing R Extensions. It describes how to call C functions from FORTRAN. Basically it just boils down to this, in a C file define the functions void F77_SUB(fseedi)(void) { int x = 100; seed_in(&x); } void F77_SUB(fseedo)(void) { int x = 100; seed_out(&x); } void F77_SUB(myrunif)(double* px) { *px = unif_rand(); } Then you could write a FORTRAN subroutine like subroutine blah() implicit double precision (a-h,o-z) call fseedi() call myrunif(RND) call fseedo() end The fseed* subroutines only need to be called once, fseedi at the beginning of your FORTRAN code and fseedo at the end. HTH, Kjell On 13 f?vr. 09, at 17:32, Fabio Mathias wrote:> Hi!!! > It would like to know if it exists a form to use the functions to > generate variates in FORTRAN with the same easiness I use that them in > C? Or not? > If yes. They would have some example? I would like to use the > functions rbeta, rlnorm and others! > > > Sorry my english..rsrsrs > > Thanks!!! > > > F?bio Mathias Corr?a University Federal of the > Lavras - Brazil > > > > Veja quais s?o os assuntos do momento no Yahoo! +Buscados > > [[alternative HTML version deleted]] > > <ATT00001.txt>
you can always try to get hold of the extensive nag fortran libraries: http://www.nag.co.uk/numeric/fl/FLdescription.asp comsider also 'numerical recipes' by press et al., of which there are fortran, c, and c++ editions (i think there was a pascal edition too), and where there are a choice of routines for random number generation, statistics, and much more. a good read, too. vQ Fabio Mathias wrote:> Hi!!! > It would like to know if it exists a form to use the functions to > generate variates in FORTRAN with the same easiness I use that them in > C? Or not? > If yes. They would have some example? I would like to use the functions rbeta, rlnorm and others! > > > Sorry my english..rsrsrs > > Thanks!!! > > > ? ? ? ? ? ? ? ? ? ? ? ? F??bio Mathias Corr??a? ? ? University Federal of the Lavras - Brazil > > > > Veja quais s??o os assuntos do momento no Yahoo! +Buscados > > [[alternative HTML version deleted]] > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >