Re: [Rd] Problem with R math library.

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Thu, 28 Jan 2010 11:23:47 -0600

On 28 January 2010 at 17:59, Guillaume Yziquel wrote:
| Guillaume Yziquel a écrit :
| > Dirk Eddelbuettel a écrit :
| >>
| >> Salut Guilluame,
| >>
| >> | > 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 the math library should be initialised?
| >>
| >> I think it is pretty clearly documented in R-exts:
| >>
| >> However, before these are used, the user must call
| >> GetRNGstate();
| >> and after all the required variates have been generated, call
| >> PutRNGstate();
| >> These essentially read in (or create) `.Random.seed' and write it out
| >> after use.
| >
| > Fair enough. I admit I've been busy with low detail stuff, and omitted
| > to come back to R-exts.
| >
| > However, I have another question on which I do not find information (I
| > found it once, but do not know how to find it again...): What's the big
| > difference between using the R mathematical library in standalone mode
| > and not in standalone mode? How does it translate in terms of C
| > directives and linking modalities? I've noticed the MATHLIB_STANDALONE
| > macro, but I do not know how I should use it...
| >
| > All the best,
|
| OK. So concerning the headers:
|
| #define MATHLIB_STANDALONE
| #include <Rmath.h>
|
| Concerning dependencies: compile against only libRmath.so. Not against
| libR.so. (I wonder why this is so crucial, though...)

By design as libRmath is meanth to __standalone__ hence indepdent of R. This is a a feature.

This is probably not what _you_ want as you are embedding R, so you need libR.  

| Concerning documentation: Section 9 The standalone Rmath library from
| the R-admin.pdf documentation.
|
| This solved my problem, since I'm able to generated random values with
| norm_rand, unif_rand, etc...
|
| Thank you for your help.

Always a pleasure.

Dirk

-- 
Three out of two people have difficulties with fractions.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 28 Jan 2010 - 17:27:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Jan 2010 - 18:00:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive