Hi Dirk,

After some time spent trying to debug this, I discovered I can make the hang disappear by defining (or possibly redefining) get_seed and set_seed. If I rewrite my example to be instead

##########################################################################

#define MATHLIB_STANDALONE
#include <Rmath.h>
#include <iostream>
using std::cout;
using std::endl;

/* A version of Marsaglia-MultiCarry */

static unsigned int I1=1234, I2=5678;

void set_seed(unsigned int i1, unsigned int i2)
{
    I1 = i1; I2 = i2;
}

void get_seed(unsigned int *i1, unsigned int *i2)
{
    *i1 = I1; *i2 = I2;
}

// double rgamma(double a, double scale)
// Input: a = parameter (mean) of the standard gamma distribution.
int main(void)
{
  set_seed(0, 0);
  cout << "gets to here" << endl;
  rgamma(1, 1);
}

#####################################################################

taking the definitions of `get_seed` and `set_seed` directly from `src/nmath/standalone/sunif.c` then the hang disappears. Now, I used set_seed many times before, and have never needed to do this before.

However, when thinking about this a little more, I realised that though I have used `set_seed` many times, I didn't have any idea where it was defined. I then did a `grep -r set_seed *` in the R sources, and the only definition that came up was the `src/nmath/standalone/sunif.c` one. So, now I'm puzzled. Where is the definition I have been using?

                                                          Regards, Faheem



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to