search for: norm_rand

Displaying 20 results from an estimated 20 matches for "norm_rand".

2008 Mar 30
1
norm_rand() in R-extension vs rnorm in R ---which is better?
I need to generate good quality of random numbers from univariate normal distribution for further transformation. I tried rnorm in R but it was not good sometimes. Someone said C++ standard library or Fortran's built-in functions for that are good. I found that there is double norm_rand() in R-extension. Does this function, norm_rand() use the same algorithm as rnorm in R or something similar in C/C++? Or does anyone know which one between norm_rand() in R-extension and rnorm in R is better? If anyone could help, I would appreciate it. Kyeongmi University of Memphis
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 PutRNGstate once for the 1st option. For the 2nd option, I...
2012 Jan 27
2
The following code (using rgamma) hangs
...ve a linker error, since the function has been defined in the library already? Dirk also pointed out (in the bug report) that you get the following ########################################################## int main(void) { set_seed(0, 0); cout << "one normal " << norm_rand() << endl; } ########################################################## edd at max:/tmp$ g++ -o faheem faheem.cpp -lRmath; ./faheem one normal -inf One would expect norm_rand to return finite values, even in edge cases. If you want me to report this as a bug, let me know. Thanks....
2010 Jan 28
1
Problem with R math library.
...://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. The interface documentation is here: http://yziquel.homelinux.org/topos/api/ocaml-r/Rmath.html For instance, for the norm_rand symbol, I have the following documentation comment: > val norm_rand : unit -> float > Random variates from the standard normal distribution. Bug: currently systematically returns -8.77332116900134373. Any idea as to why the function systematically returns the same value? Is there a way...
2005 Jun 14
3
Calling C from Fortran
...dstart() 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. Thanks, Gilles
2019 Mar 22
1
Status of R_unif_index
Dear List, section "6.3 Random number generation" of WRE [1] lists unif_rand(), norm_rand() and exp_rand() as the interface to R's RNG. Now R_ext/Random.h also has double R_unif_index(double); Can this be also treated as an official API function that may be called from a package? Thanks Ralf [1] https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Random-numbers --...
2005 Jun 14
1
Calling C from Fortran
...dstart() 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. Thanks, Gilles
2007 Oct 23
0
API for optimization with Simulated annealing
..._my_source/src/main/optim.c 2007-10-23 23:02:43.397529120 +0200 @@ -171,6 +171,13 @@ } } +static void genptry_default(int n, double *p, double *ptry, double scale, void *ex) +{ /* default Gaussian Markov kernel */ + int i; + for (i = 0; i < n; i++) + ptry[i] = p[i] + scale * norm_rand(); /* new candidate point */ +} + static void genptry(int n, double *p, double *ptry, double scale, void *ex) { SEXP s, x; @@ -196,10 +203,8 @@ ptry[i] = REAL(s)[i] / (OS->parscale[i]); UNPROTECT(2); } - else { /* default Gaussian Markov kernel */ - for (i = 0; i...
2002 Oct 21
3
Combinatorial Optimisation
Hi I am looking to perform a discrete mean-variance optimisation, specifically to maximise the ratio of portfolio mean over portfolio standard deviation for a portfolio of several hundred stocks through discrete position size holdings in each stock, where all position sizes must be elements of a small finite set of integer amounts which include zero. I don't think any of the standard R
2002 Oct 21
3
Combinatorial Optimisation
Hi I am looking to perform a discrete mean-variance optimisation, specifically to maximise the ratio of portfolio mean over portfolio standard deviation for a portfolio of several hundred stocks through discrete position size holdings in each stock, where all position sizes must be elements of a small finite set of integer amounts which include zero. I don't think any of the standard R
2002 Jul 03
1
Calling qnorm from Fortran
The R-exts may explicitly state this but I missed it. How do I call qnorm or pnorm from Fortran? Thanks -Frank -- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat
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]]
2016 Jul 01
1
Calling C implementations of rnorm and friends
Well, For this particular use case why not just transform the parameters at the R level and then call the existing function? Is there not a closed form mapping? ~G On Jul 1, 2016 2:50 PM, "Joshua Ulrich" <josh.m.ulrich at gmail.com> wrote: > On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier > <luis.henrique.usier at gmail.com> wrote: > > Gabriel, > > > >
2007 Apr 13
1
Simulated annealing using optim()
I'm preparing some code to compute the optimal geometry of stressed solids. The core of the calculations is the optimization of elastic energy using the simulated annealing method implemented in the R optim() rutine. I've defined a function to compute this "energy" scalar (the fn parameter for optim) and prepared a list with the arrays defining the geometry and the elastic
2008 Aug 06
1
error in installing R packages
...:35: warning: implicit declaration of function ?GetRNGstate? waveform.c:38: warning: implicit declaration of function ?PutRNGstate? waveform.c: In function ?execute?: waveform.c:100: warning: implicit declaration of function ?unif_rand? waveform.c:115: warning: implicit declaration of function ?norm_rand? make: *** [waveform.o] Error 1 ERROR: compilation failed for package 'mlbench' ** Removing '/usr/share/R/library/mlbench' * Installing *source* package 'randomForest' ... ** libs gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe -Wall -...
2007 Jan 30
1
Solaris 10 compilation issue
...arithmetic.o libintl_nl_default_default_domain ../extra/intl/libintl.a(textdomain.o) BZ2_bzWriteOpen connections.o bincode registration.o R_CleanTempDir main.o do_proctime names.o norm_rand optim.o Rf_rnchisq random.o Rf_rnbinom random.o R_running_as_main_program Rmain.o Rf_psigamma arithmetic.o ch2inv_ registration.o BZ2_bzWrite...
2007 Jan 30
1
Difficulty with compiling R-2.4.1 on solaris 10
...arithmetic.o libintl_nl_default_default_domain ../extra/intl/libintl.a(textdomain.o) BZ2_bzWriteOpen connections.o bincode registration.o R_CleanTempDir main.o do_proctime names.o norm_rand optim.o Rf_rnchisq random.o Rf_rnbinom random.o R_running_as_main_program Rmain.o Rf_psigamma arithmetic.o ch2inv_ registration.o BZ2_bzWrite...
2007 Jan 30
0
R Compiling issue
...ntl/libintl.a(bindtextdom.o) libintl_nl_current_default_domain ../extra/intl/libintl.a(textdomain.o) Rf_qwilcox arithmetic.o libintl_nl_default_default_domain ../extra/intl/libintl.a(textdomain.o) BZ2_bzWriteOpen connections.o bincode registration.o R_CleanTempDir main.o do_proctime names.o norm_rand optim.o Rf_rnchisq random.o Rf_rnbinom random.o R_running_as_main_program Rmain.o Rf_psigamma arithmetic.o ch2inv_ registration.o BZ2_bzWrite connections.o inflateInit2_ connections.o Rf_rwilcox random.o R_CleanUp errors.o _nl_find_msg ../extra/intl/libintl.a(loadmsgcat.o) Rf_dsignrank a...
2007 Jan 30
0
Issue with compiling R on solaris 10
...arithmetic.o libintl_nl_default_default_domain ../extra/intl/libintl.a(textdomain.o) BZ2_bzWriteOpen connections.o bincode registration.o R_CleanTempDir main.o do_proctime names.o norm_rand optim.o Rf_rnchisq random.o Rf_rnbinom random.o R_running_as_main_program Rmain.o Rf_psigamma arithmetic.o ch2inv_ registration.o BZ2_bzWrite...
2009 Jan 15
2
Interface to open source Reporting tools
...lepr("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.f frand-helper.c . > > At least this would have helped me in trying to get things to work, but > again - its just a suggestion. &g...