similar to: GetRNGstate and PutRNGstate

Displaying 20 results from an estimated 5000 matches similar to: "GetRNGstate and PutRNGstate"

2004 Mar 03
1
generating normal numbers: GetRNGstate, PutRNGstate
Hi I'd like to generate thousands of normal numbers from my C function using the C API functions provided R. I have two options: 1. double norm_rand(); (page 61 of R extension 1.8.1) 2. double rnorm(double mu, double sigma); (page 58 of R extension 1.8.1) If my understanding of R-exts is correct, then I only need to call GetRNGstate once, and then call 1000 norm_rand, and then call
2002 Jan 24
2
random number generation issues with r and compiled C code
Dear People, I have been writing a simulation routine that is currently entirely written in c++. I've been using the R standalone math library to give me random number generation for this. However, I have had to set the seed myself, and I am using set_seed(time(NULL), clock) for every call to unif_rand(). However, this works really badly. The random numbers aren't uniform at all. Does
2005 Jun 28
1
GetRNGstate() crashes in Windows
Hi, Has anyone managed to successfully call GetRNGstate() / PutRNGstate() without crashing in a Windows environment (spec. XP)? I've compiled successfully using both the latest Cygwin, latest Mingw, and the version of Mingw suggested in "Building R for Windows" website, but when the executable runs, it crashes; the functions themselves can run when I omit
2002 Jan 14
1
trouble using R Mathlib as standalone
Dear People, I am trying to use R's Math library as standalone, as documented in /src/nmath/standalone. I am using C++ in Debian testing, and the versions are as follows: ii g++-3.0 3.0.3-1 The GNU C++ compiler. ii r-mathlib 1.4.0-1 `GNU S' - Standalone R math library I have a file (rand.cc) as follows. I don't think that lattice.hh or mh.hh are very
2009 Nov 13
2
random numbers in C
I need some random numbers in my C program. Here a small example: //////////////////////////////////////////////////////////////////////////////// #include <R.h> void rand (int* n) { int len = *n; for (int i = 0; i < len; i++) Rprintf("%1.5f ", unif_rand()); } dyn.load("rand.dll") .C("rand", as.integer(10)) dyn.unload("rand.dll")
2015 Apr 21
2
shlib problems with Intel compiler
Hi, I'm encountering trouble compiling caTools_1.17.1.tar.gz and e1071_1.6-4.tar.gz on a Linux system using the Intel compiler suite. 14 other packages I generally use installed without any trouble. I notice both of these trouble packages have a C++ component, so I wonder if that might be the issue. Below, there's information on my platform, compiler, and some diagnostic output showing
2006 Jun 08
1
Problems Building R-2.3.1 on Alpha server ES40 running Tru64 V5.1B PK#5
R Listers, One of the list contributors suggested I abandon attempts to build R-1.9.1 and focus on building R-2.3.1. I believe the main set of packages have been built properly (with some changes to the code) - however, when building the Recommended packages, the build fails. CODE CHANGES: ============= 1. My C compiler requires a ";" on line 589 of ..../src/main/printutils.c. Here
2006 Jan 05
2
random seed question
Greetings, I am trying to write a C++ subroutine of my random number generator. Based on tutorial in Writing R Extensions, one should call GetRNGstate() before and PutRNGstate() after calling R's random variate generation routines. Now suppose my function would generate n(n>1) numbers by a loop, do I need to call these two functions at each iteration? This certainly increases computation
2008 Aug 06
1
error in installing R packages
Hello, I am trying to install R packages under linux, some of the packages can not be installed and I got the following error, could anybody give me suggestion on where the problem is and how to fix it? Thanks-e > .libPaths() [1] "/usr/lib64/R/library" [2] "/usr/share/R/library" [3]
2010 Jan 28
1
Problem with R math library.
Hello. I've been working on my OCaml-R binding, and I quite pleased to see that it is functional, though far from being perfect or polished. You can find the gitweb webpage and the interface documentation at http://yziquel.homelinux.org/gitweb/?p=ocaml-r.git;a=tree http://yziquel.homelinux.org/topos/api/ocaml-r/index.html I'm having unexpected trouble with the math library, though.
2006 Feb 21
4
simple C function segfaults
Hello, I use the simplest of examples that somebody can think of in order to generate a matrix of random numbers from within C, calling appropriate R functions. The concrete example is below: --- file pico.c #include <stdio.h> #include <stdlib.h> #include <math.h> #include <R.h> #include <Rmath.h> #define COLM( i, j, m ) ( m*j + i) void pico ( double *y, int n,
2006 Mar 07
2
double pointer matrix
Hello, I'm having some difficulty to understand how I could take the proper result from the following listing: -- cut --- #include <stdlib.h> #include <R.h> #include <Rmath.h> void retMat ( double **y, int *n, int *m, double *a, double *b) { int i, j; y = malloc( (*n) * sizeof( double ) ); for (i=0; i<*n; i++) { y[i] = malloc (
2015 Apr 22
1
shlib problems with Intel compiler
Hi Martyn, Thanks for your insight, that seems pretty direct. Unfortunately, I did not compile this version of R (it's on a large supercomputer system and this version of R was installed by the admins). Using "R CMD config", I see the following relevant settings: DYLIB_LD = icc -std=gnu99 DYLIB_LDFLAGS = -shared -openmp LDFLAGS = -L/opt/compilers/intel/cce/9.1.039/lib
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
2010 Jun 15
1
Error when callin g C-Code
Hi when I call the function below in R, i get the error: Object 'pairlist' can't be converted to 'double'. #include <R.h> #include <Rdefines.h> #include <Rmath.h> SEXP CSimPoisson(SEXP lambda, SEXP tgrid, SEXP T2M, SEXP Ni, SEXP NT) { double sign, EVar; double *xlambda, *xtgrid, *xT2M, *xNi, *xNT, *xtau; SEXP tau; int ltgrid =0; int i = 0; int j = 0;
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
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:
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
2006 Aug 03
1
question about dll crashing R
I have ported some R code to C to make it faster. I can perform .Call("foobar",....) once and it works fine. Absolutely correct answer. If I put a loop inside foobar and run the main code routine more than 100 times, it crashes R. Or if I call .Call("foobar"....) seperately more than two tims it crashes R. For the most part I am doing matirx multiplies using EXP
2000 Aug 22
0
Using RNG from MS [forwarded message from Xiaoqiang Li]
This had a VERY WRONG `To:' address and went straight into my "spam box" into which I don't look too often .. Martin ------- start of forwarded message ------- Message-ID: <Pine.A41.4.05.10008212237300.18590-100000 at fisher.stats.uwo.ca> MIME-Version: 1.0 From: Xiaoqiang Li <lxq at stats.uwo.ca> To: Majordomo-Owner at stat.math.ethz.ch Subject: r-help Date: Mon,