Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use R random number generator inside Fortran #17

Open
cjvanlissa opened this issue Oct 23, 2019 · 0 comments
Open

Use R random number generator inside Fortran #17

cjvanlissa opened this issue Oct 23, 2019 · 0 comments

Comments

@cjvanlissa
Copy link
Collaborator

cjvanlissa commented Oct 23, 2019

Here is some code that I found, that might be helpful:

myrandom.c:

#include <R.h>
#include <Rmath.h>

void F77_SUB(fseedi)(void)
{
   GetRNGstate();
}


void F77_SUB(fseedo)(void)
{
   PutRNGstate();
}


void F77_SUB(myrbeta)(double* px, double* pa, double* pb)
{
        *px = rbeta(*pa, *pb);
}


and example.f

       subroutine example(x, a, b)
       implicit double precision (a-h,o-z)
       call fseedi()
       call myrbeta(x, a, b)
       call fseedo()
       end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant