Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Thanks for the comment. It resolved now. I have edited my namespace file. -V On Thu, Jun 16, 2016 at 3:20 PM, Uwe Ligges wrote: > > > On 16.06.2016 20:17, Kodalore Vijayan, Vineetha W wrote: > >> Hi, >> >> Its running in R separately using dyn.load(). Thanks!

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Thank you Don. I did send an email to R-sig-mac. -Vineetha On Thu, Jun 16, 2016 at 10:36 AM, MacQueen, Don wrote: > You might want to take this question to R-sig-mac. > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Thanks for the suggestion Berend. I just tried with numeric(n) and its working for x and y. But my issue is different and its not resolved yet. -Vineetha On Thu, Jun 16, 2016 at 1:19 PM, Berend Hasselman wrote: > > > On 16 Jun 2016, at 21:04, Eduardo M. A. M.Mendes

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Berend Hasselman
> On 16 Jun 2016, at 21:04, Eduardo M. A. M.Mendes wrote: > > >> On Jun 16, 2016, at 3:50 PM, Berend Hasselman wrote: >> >> >>> On 16 Jun 2016, at 20:02, Eduardo M. A. M.Mendes >>> wrote: >>> >>> Thanks Bill for pointing this

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Eduardo M. A. M.Mendes
> On Jun 16, 2016, at 3:50 PM, Berend Hasselman wrote: > > >> On 16 Jun 2016, at 20:02, Eduardo M. A. M.Mendes >> wrote: >> >> Thanks Bill for pointing this out. I haven’t noticed it. >> >> Vineetha, try as.double(rep(0,n)) or as.matrix(rep(0,n)), >>

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Berend Hasselman
> On 16 Jun 2016, at 20:02, Eduardo M. A. M.Mendes wrote: > > Thanks Bill for pointing this out. I haven’t noticed it. > > Vineetha, try as.double(rep(0,n)) or as.matrix(rep(0,n)), > Why not simply numeric(n)? Berend Hasselman

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Hi, Its running in R separately using dyn.load(). Thanks! But my original issue is still there. I still can not build my package. My source code file name in SRC folder is "randomepi.f95" , the package name is "NEpidemic". and the wrapper function in the R folder is "randomepi.r". Not sure if

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Hi, @Eduardo: I do have statements like, double preciosion :: y(n) in my fortran code. Will change the code and run again. @ William : Yes I was initializing X ,Y,and tau, each have a vector of length "n". Thanks, Vineetha On Thu, Jun 16, 2016 at 11:54 AM, William Dunlap

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Eduardo M. A. M.Mendes
Thanks Bill for pointing this out. I haven’t noticed it. Vineetha, try as.double(rep(0,n)) or as.matrix(rep(0,n)), Ed > On Jun 16, 2016, at 2:54 PM, William Dunlap wrote: > > > 1: .Fortran("dataxy", n = as.integer(n), tmax = as.integer(tmax), > > alpha =

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread William Dunlap via R-help
> 1: .Fortran("dataxy", n = as.integer(n), tmax = as.integer(tmax), alpha = as.double(alpha), beta = as.double(beta), x = as.double(0, length = n), y = as.double(0, length = n), tau = as.integer(0, length = n)) Are you expecting that as.integer(0, length=n) and as.double(0, length =

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Eduardo M. A. M.Mendes
Hi Vineetha It seems that there are some problems in the Fortran code as far as allocating memory is concerned. If you have statements such as double preciosion :: y(n) you will need to allocate memory for the vector within the Fortran code or in the R wrapper-function. It is hard to

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Kodalore Vijayan, Vineetha W
Hi Eduardo, Thanks for your comments. I haven't tried the way you told me. Now when I tried, got the following error: *** caught segfault *** address 0x0, cause 'memory not mapped' Traceback: 1: .Fortran("dataxy", n = as.integer(n), tmax = as.integer(tmax), alpha = as.double(alpha), beta =

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread MacQueen, Don
You might want to take this question to R-sig-mac. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/15/16, 1:20 PM, "R-help on behalf of Kodalore Vijayan, Vineetha W"

Re: [R] Writing R package that call Fortran codes

2016-06-15 Thread Eduardo M. A. M.Mendes
Hi Have you tried to load and run the fortran code using just a wrapper function in R? I do that as the first step in order to build a package. Example: fortran sources -> rk4_mod_r.f90 ,derive_henonheilles.f90, poincare_section.f90 a) I use R CMD SHLIB rk4_mod_r.f90