Displaying 20 results from an estimated 300 matches similar to: "Calling C from Fortran"
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
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
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]]
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:
2006 Jan 20
3
Troubles with the function rmultinom.c of the R's Random Number Generator
Hi,
I'm simulating a Markov chain in Fortran interfaced with R-2.2.1 in order
to generate data according to a Markov Random Field called the Potts model.
R Version:
platform i686-pc-linux-gnu
arch i686
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
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
2005 Jul 05
1
calling fortran functions CHOL and DPOTRF form Fortran
Hi all,
I'm working out some Fortran code for which
I want to compute the Choleski decomposition of a covariance matrix
in Fortran.
I tried to do it by two methods :
1) Calling the lapack function DPOTRF.
I can see the source code and check that my call is correct,
but it does not compile with:
system("R CMD SHLIB ~/main.f")
dyn.load("~/main.so")
I get:
Error in
2004 Oct 25
5
building a package under windows
Hi,
I have a package of my own which seems to work fine under linux.
I want to make a compiled version for windows.
(I work with windows 2000 and R 2.0)
I have followed the steps described in the file
readme.packages (in the top-level directory of the binary installation)
and I had a trouble at this step (which aim is not documented):
C:\Program Files\R\rw2000\src\gnuwin32>make libR.a
2004 Oct 22
1
building an R package : where and how should my fortran library be loaded ?
Hi ,
I'm currently trying to make available
a few fortran subroutines and R functions
(which make interface to these subroutines),
as an R package.
I'm doing it under linux with R 1.9.0
(but hope to do it for windows too).
I have trouble for loading my fortran code.
Here are the steps involved :
1) In R:
# Create tree for package
2005 Oct 26
1
pb with dyn.load - fortran code now attached
Hi,
here are a couple of strange things happening with R.2.2.0 compiled
under Mandrake-10.1
At the begining of the story I have segmentation fault
using package RandomFields in conjuction with some Fortran code of mine
loaded with dyn.load.
One of my fortran programs contains a subroutine named fstat
Trying to trace , I simplified the sequence as much as possible
and I end up with the the
2014 Oct 09
1
live migration to localhost with lvm based storage
I have lvm based (thin pool) storage on local disks. I need to move
vps from one vg on one disk to another. Does it possible to migrate to
localhost with blockcopy migration to another vg?
I'm understand that i can move lv from one vg to another, but i don't need that.
--
Vasiliy Tolstov,
e-mail: v.tolstov@selfip.ru
jabber: vase@selfip.ru
2004 Jul 08
7
Problem with the grep function
Let me present to you my problem :
I have a character vector x and I would like to obtain the indices of the
elements of
this vector that yielded exactly a match.
For example, x=nom, pattern="b", I would to obtain 2 because "b" is on the
second position.
First program :
nom <- c("a","b","ab")
grep("b",nom)
2 3
Then I try the
2017 May 09
2
registering Fortran routines in R packages
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 https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-native-routines and looking at what is done in stats package, I first thought that the following code will do the job:
2011 Feb 09
3
precision of gamma function
Dear R users,
I have to calculate gamma functions for negative numbers beyond -171.4.
e.x. gamma(-500.4)
I got following:
> gamma(-170.4)
[1] -5.824625e-308
> gamma(-171.4)
[1] 0
Warning message:
underflow occurred in 'gammafn'
I have tried to use a recursion getting values a little futher -180.
How could I solve this problem? Thank you beforehand.
Chuse.
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
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
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
2005 Nov 08
1
R build under mandriva 10.2
After upgrading from mandrake 10.1 to mandriva 10.2
I can't build shared archive with R 2.2.0
[guillot at laplace src]$ R CMD SHLIB main.f sub.f wrapper.c
gcc -shared -L/usr/local/lib -o main.so main.o sub.o wrapper.o -lg2c -lm
-lgcc_s
/usr//bin/ld: cannot find -lg2c
collect2: ld returned 1 exit status
make: *** [main.so] Erreur 1
I guess the information in
2008 Oct 23
1
distribution fitting
Dear R-help readers,
I am writing to you in order to ask you a few questions about distribution
fitting in R.
I am trying to find out whether the set of event interarrival times that I
am currently analyzing is distributed with a Gamma or General Pareto
distribution. The event arrival granularity is in minutes and interarrival
times are in seconds, so the values I have are 0, 60, 120, 180, and
2004 Dec 03
2
Status of linux 2.6 support
I'm sure that this question gets asked frequently, but a quick perusal
of the list archives shows that it hasn't been asked in a least a month
or so, so pardon any repetition.
What is the current state of asterisk on linux 2.6?
I ask, because I spent yesterday giving it a whirl, and everything
seems to go just fine till the very last minute.
Zaptel, libpri and asterisk compile just