Displaying 19 results from an estimated 19 matches for "f77_sub".
2005 Nov 30
1
RNG stuck via Fortran call
...634557
for all the following interations.
Is there any suggestion of explanation for this strange fact ?
Thanks in advance
Gilles
R Version 2.2.0 compiled under Mandrake 10.1
#include <R.h>
#include <Rmath.h>
/******************/
/* random numbers */
/******************/
void F77_SUB(rndstart)(void)
{ GetRNGstate(); }
void F77_SUB(rndend)(void)
{ PutRNGstate(); }
double F77_SUB(ggrnorm)(double *mu, double *sigma)
{ return rnorm(*mu, *sigma); }
double F77_SUB(ggrexp)(double *scale)
{return rexp(*scale);}
double F77_SUB(ggrgam)(double *a, double *scale)
{return rgamma(*a,...
2005 Jun 14
3
Calling C from Fortran
...ith 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 of this C wrapper:
#include <R.h>
void F77_SUB(rndstart)(void) { GetRNGstate(); }
void F77_SUB(rndend)(void) { PutRNGstate(); }
double F77_SUB(normrnd)(void) { return norm_rand(); }
neither how I should compile it.
Could anyone explain how I should compile and link
the C and Fortran files above, and call the Fortran subroutine from R.
Tha...
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
2005 Jun 14
1
Calling C from Fortran
...ith 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 of this C wrapper:
#include <R.h>
void F77_SUB(rndstart)(void) { GetRNGstate(); }
void F77_SUB(rndend)(void) { PutRNGstate(); }
double F77_SUB(normrnd)(void) { return norm_rand(); }
neither how I should compile it.
Could anyone explain how I should compile and link
the C and Fortran files above, and call the Fortran subroutine from R.
Tha...
2017 May 09
2
registering Fortran routines in R packages
...ndeclared identifier ?SOBOL_?. I also tried in lower case sobol and halton.
Looking at expm package https://r-forge.r-project.org/scm/viewvc.php/pkg/src/init.c?view=markup&revision=94&root=expm, I try
static const R_FortranMethodDef FortEntries[] = {
{"halton", (DL_FUNC) &F77_SUB(HALTON), 7},
{"sobol", (DL_FUNC) &F77_SUB(SOBOL), 11},
{NULL, NULL, 0}
};
But the problem remains the same.
Is there a way to have header file for Fortran codes? how to declare routines defined in my Fortran file src/LowDiscrepancy.f?
Any help appreciated
Regards, Christophe
-...
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 F77_SUB(myrbeta)(double *px, double *pa, double *pb){
*px = rbeta(*pa,*pb);
}
Code in Fortran
subroutine mat(x,l,c)
integer l,c
double precision x(l,c)
integer i,j
do j = 1, c
...
2017 May 10
3
registering Fortran routines in R packages
...on2() 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 'halton2'?
{"halton", (DL_FUNC) &F77_SUB(halton), 7},
My current solution is to comment FortEntries array and use R_useDynamicSymbols(dll, TRUE) for a dynamic search of Fortran routines.
Regards, Christophe
---------------------------------------
Christophe Dutang
LMM, UdM, Le Mans, France
web: http://dutangc.free.fr <http://dutangc...
2009 Feb 13
2
Generate random numbers in Fortran
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
2009 Dec 29
2
how can I use R functions in Fortran 90
Hi all,
Is there a way that I can import R functions into Fortran? Especially, I
want to generate random numbers from some not-so-common distributions (e.g.
inverted chi square) but did not find any routines written in Fortran that
deal with distributions other than uniform and normal.
Thanks.
Anny
[[alternative HTML version deleted]]
2000 Aug 11
2
R-devel Aug-09 1.2.0 build on hpux10.20
...(local), as.logical(now)) :
unable to load shared library "/home/absd00t/R-devel/library/modreg/libs/modreg.sl":
can't open /home/absd00t/R-devel/library/modreg/libs/modreg.sl
Error in library(modreg) : .First.lib failed
>
First checked the lowessc.c routine and it had F77_SUB(...) but I
could not find a macro for that in the include files. There was
F77_SYMBOL() so I changed to F77_SUB to F77_SYMBOL, but it still doesn't
load.
Is there a way to get more info why it doesn't open?
TIA,
Osman
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-....
2006 Jan 20
3
Troubles with the function rmultinom.c of the R's Random Number Generator
...os linux-gnu
system i686, linux-gnu
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
Each loop of my Fortran calls the function rmultinom.c of the R's Random
Number Generator through the wrapper:
#include <R.h>
#include <Rmath.h>
void F77_SUB(sarmultinom)(int n,
double* prob,
int K,
int* rN){
rmultinom(n, prob, K, rN);}
My fortran program is:
subroutine testsarmultinom(n,prob,K,rN)
implicit none
integer n,K,rN(K)
double precision prob(K)
call rndstart()...
2009 Nov 16
2
(Parallel) Random number seed question...
Hi All,
I have k identical parallel pieces of code running, each using n.rand
random numbers.? I would like to use the same RNG (for now), and set
the seeds so that I can guarantee that there are no overlaps in the
random numbers sampled by the k pieces of code.? Another side goal is
to have reproducibility of my results.? In?the past I have used C with
SPRNG for this task, but I'm hoping
2017 May 09
0
registering Fortran routines in R packages
...BOL_?. I also tried in lower case sobol and halton.
>
> Looking at expm package https://r-forge.r-project.org/scm/viewvc.php/pkg/src/init.c?view=markup&revision=94&root=expm, I try
>
> static const R_FortranMethodDef FortEntries[] = {
> {"halton", (DL_FUNC) &F77_SUB(HALTON), 7},
> {"sobol", (DL_FUNC) &F77_SUB(SOBOL), 11},
> {NULL, NULL, 0}
> };
>
> But the problem remains the same.
>
> Is there a way to have header file for Fortran codes? how to declare routines defined in my Fortran file src/LowDiscrepancy.f?
>
lowe...
2001 Jul 14
1
Calling rand_unif() from fortran
...oad("forest.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library "/home/warnes/R/forest/forest.so":
/home/warnes/R/forest/forest.so: undefined symbol: unif_rand__
Do I have to write a bit of C code to "wrap" the call using F77_SUB?
-Greg
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request...
2017 May 10
1
registering Fortran routines in R packages
...l2() 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 'halton2'?
> {"halton", (DL_FUNC) &F77_SUB(halton), 7},
>
> My current solution is to comment FortEntries array and use R_useDynamicSymbols(dll, TRUE) for a dynamic search of Fortran routines.
Have a look at my package geigen and its init.c.
Could it be that you are missing extern declarations for the Fortran routines?
Berend
___...
2009 Jan 07
2
Understanding dsyrk_ in C code
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to understand some C code in an R package I'm using. I'm address this question here as
it's matrix algebra...and I'm no pro at that!
the C command reads:
double alpha = 1.0, beta = 0.0;
dsyrk_("L", "N", nGenes, nGenes, & alpha, mat1, nGenes,
& beta, mat2, nGenes);
- From google,
2014 Jan 08
1
CRAN rejects package because of write statement in Fortran
I recently developed an R package to make available a very large legacy
program written in Fortran. My package has been rejected by CRAN due to
this Write statement with the message "As 'Writing R Extensions' warns you
against including Fortran I/O, this will not be allowed."
The issue is that this Write statement does not involve I/O it is inernally
writing an integer to a
2001 Jun 06
1
The old Fortran underscore problem
I have dealt with this on so many platforms in
the past that I should know the answer by now.
I looked in V&R S Programming, R manuals and FAQ
and still can't find the answer.
In the Hmisc library I used the R scripts to build
the package, which creates Hmisc.so. I have
library.dynam('Hmisc', ...) in the .First.lib.
When doing library(Hmisc) I get
Error in dyn.load ....
2009 Jan 15
2
Interface to open source Reporting tools
...t;
> subroutine testit()
> double precision normrnd, x
> call rndstart()
> x = normrnd()
> call dblepr("X was", 5, x, 1)
> call rndend()
> end
>
> frand-helper.c:
>
> #include <R.h>
>
> /* Fortran */
> void F77_SUB(rndstart)(void) { GetRNGstate(); }
> void F77_SUB(rndend)(void) { PutRNGstate(); }
> double F77_SUB(normrnd)(void) { return norm_rand(); }
>
> As a further suggestion, it would also be nice to provide the call for
> generating the dynamic library at this point:
> R CMD SHLIB frand...