Displaying 20 results from an estimated 500 matches similar to: "registering Fortran routines in R packages"
2017 May 10
3
registering Fortran routines in R packages
Thanks for your email.
I try to change the name in lowercase but it conflicts with a C implementation also named halton. So I rename the C function halton2() and sobol2() while the Fortran function are HALTON() and SOBOL() (I also try lower case in the Fortran code). Unfortunately, it does not help since I get
init.c:97:25: error: use of undeclared identifier 'halton_'; did you mean
2017 May 10
1
registering Fortran routines in R packages
Have you tried using tools:::package_native_routine_registration_skeleton()? If you don't like its output, you can easily edit its results and still avoid most pitfalls.
Cheers, Jari Oksanen
________________________________________
From: R-devel <r-devel-bounces at r-project.org> on behalf of Berend Hasselman <bhh at xs4all.nl>
Sent: 10 May 2017 09:48
To: Christophe Dutang
Cc:
2017 May 09
0
registering Fortran routines in R packages
> On 9 May 2017, at 13:44, Christophe Dutang <dutangc at gmail.com> wrote:
>
> Dear list,
>
> I?m trying to register Fortran routines in randtoolbox (in srt/init.c file), see https://r-forge.r-project.org/scm/viewvc.php/pkg/randtoolbox/src/init.c?view=markup&root=rmetrics.
>
> Reading
2009 Oct 10
2
[R-SIG-Mac] rnorm.halton
Hi all,
I need to transform classic 32bit Fortran code to 64bit Fortran code,
see the discussion [R-SIG-Mac] rnorm.halton. But I'm clearly a
beginner in Fortran...
Does someone already do this for his package?
From here, http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_Developer/Porting_Guide/ch03.html
, I identify the following changes
2008 Apr 26
6
quasi-random sequences
Dear list useRs,
I have to generate a random set of coordinates (x,y) in [-1 ; 1]^2
for say, N points. At each of these points is drawn a circle (later
on, an ellipse) of random size, as in:
> N <- 100
>
> positions <- matrix(rnorm(2 * N, mean = 0 , sd= 0.5), nrow=N)
> sizes<-rnorm(N, mean = 0 , sd= 1)
> plot(positions,type="p",cex=sizes)
My problem is to
2008 May 23
1
van der Corput sequences
In package fOptions, there are functions that generate
Halton sequences.
The van der Corput sequence for base 2 is a particular case
of the Halton sequence generated by:
n <- 8 # anything here...
x <- runif.halton(n, 1)
In fact, x <- runif.halton(n, dim) will generate the van der Corput
sequences for the base b as the i-th prime number in x[,i].
(in other words, if I want the van der
2006 Mar 31
1
Fortran and C entry point problem.
Dear All,
I have seen a number of e mails on this topic but I have not seen a
general solution to date. I have Fortran and C source codes and they
have been compiled successfully using:
R CMD build mypackage
And
R CMD install mypackage
Without error messages.
I then open R and tests out two functions and get:
> pgl(0.2,1,2,3,4)
Error in
2006 Mar 31
1
Fortran and C entry point problem.
Dear All,
I have seen a number of e mails on this topic but I have not seen a
general solution to date. I have Fortran and C source codes and they
have been compiled successfully using:
R CMD build mypackage
And
R CMD install mypackage
Without error messages.
I then open R and tests out two functions and get:
> pgl(0.2,1,2,3,4)
Error in
2011 Oct 22
2
Segfault and bad output with fOptions::rnorm.sobol
I have had the following problem with R 2.10, 2.13.1, and 2.13.2, running on
Ubuntu linux 10.04, xubuntu 11.10, and a version of Redhat (I think 5).
rnorm.sobol is producing impossible random values, and occasionally the
routine crashes. Here are samples of the output and the crash message.
library(fOptions)
Zs <- rnorm.sobol(50, dimension=1)
produces this:
[,1]
[1,]
2005 Nov 30
1
RNG stuck via Fortran call
Having not much success with my previous question I try to reformulate it:
I'm simulating a Markow chain in Fortran interfaced with R.
Each loop of my Fortran calls various functions of the R RNG through
the wrapper given below.
In a run of 100 iterations of the Markov kernel,
after 20 iterations, the RNG seems like frozen.
For example, the first call to the RNG in my loop is:
2005 Jun 14
3
Calling C from Fortran
I would like to call C routines from Fortran under linux as suggested in
section 5.6 of
the "Writing R extensions" documentation.
I'm familiar with Fortran but not with C.
I understand the example provided in Fortran:
subroutine testit()
double precision normrnd, x
call rndstart()
x = normrnd()
call dblepr("X was", 5, x, 1)
call rndend()
end
but I don't understand
2011 Feb 14
3
CDF of Sample Quantile
I need to calculate the probability that a sample quantile will exceed a
threshold given the size of the iid sample and the parameters describing the
distribution of each observation (normal, in my case). I can compute the
probability with brute force simulation: simulate a size N sample, apply R's
quantile() function on it, compare it to the threshold, replicate this MANY
times, and count the
2005 Nov 30
2
R binomial RNG stuck at 1 via Fortran call
Hi,
I have some trouble with the result of a fortran function calling the R
binomial RNG:
The C function rbinom is wrapped as in the file attached.
My main fortran program starts as
call rndstart()
and ends as
call rndend()
I happen to call the binomial RNG within a loop as
b = ggrbinom(1.d0,0.5d0)
write(*,*) 'b=',b
In certain cases, after a few iterations in the loop,
b get
2008 Aug 12
3
aligned memory allocation in C
Hi,
I'm currently R porting SF Mersenne Twister algorithm of Matsumoto and
Saito. To get the full power of their code, I want to use their
fonction fill_array32 which need aligned memory. That is to say I need
to use the C function memalign on windows, posix_memalign on linux and
classic malloc on Mac OS. In 'writing R extenstion', they recommand to
use R_alloc function to
2008 Aug 12
3
aligned memory allocation in C
Hi,
I'm currently R porting SF Mersenne Twister algorithm of Matsumoto and
Saito. To get the full power of their code, I want to use their
fonction fill_array32 which need aligned memory. That is to say I need
to use the C function memalign on windows, posix_memalign on linux and
classic malloc on Mac OS. In 'writing R extenstion', they recommand to
use R_alloc function to
2005 Oct 13
1
About Qusi-Monte carlo program
Dear Listers;
Does anybody has experience in doing simulation via Qusi-Monte carlo in R or S-plus, if so, could you like to send a small copy of your program to me, I appreciate and thanks in advance!!
Frankly speaking, I am struggling to write this kind of program, while I could not figure out, painful!!!!!
Best regards,
Tony
---------------------------------
[[alternative HTML
2008 Jul 18
1
system time - windows specific problem
Hi all,
I'm currently implementing quasi random generation (torus) on R
(package randtoolbox available on CRAN). Even if it is not a great
idea, I decided to use the machine time to initiate the seed. So when
the seed is not specified by the user, the pkg uses the time machine
time.
Hence the following R code should produce different uniform variates :
> for(i in
2008 Jun 18
0
Low-discrepancy sequences
Is there any way to _test_ if a given sequence is a
low-discrepancy sequence?
Or, equivalently, is there any way to measure the "discrepancy"
of a sequence?
WTIW, ...
http://en.wikipedia.org/wiki/Low-discrepancy_sequence
... doesn't look like something implementation-friendly :-)
Alberto Monteiro
PS: low discrepany sequences are easily generated in R by
the functions
2005 Jun 14
1
Calling C from Fortran
I would like to call C routines from Fortran as suggested in section 5.6 of
the "Writing R extensions" documentation.
I'm familiar with Fortran but not with C.
I understand the example provided in Fortran:
subroutine testit()
double precision normrnd, x
call rndstart()
x = normrnd()
call dblepr("X was", 5, x, 1)
call rndend()
end
but I don't understand the purpose
2009 Jun 30
3
Matrix with random number
Hello!
I have a program in Fortran and would like to build a matrix with random numbers, I have a function in C.
However, I have problems with the use of function in R.
Code to compile: R CMD SHLIB mat.f myrbeta.c -o func.so
Code in C.
#include <R.h>
#include <Rmath.h>
void F77_SUB(fseedi)(void){
GetRNGstate();
}
void F77_SUB(fseedo)(void){
PutRNGstate();
}
void