Rによって呼び出される関数をCで記述しようとしています。その中で、ベクトルから置換せずにランダムサンプルを取得する必要があります。Rmath.hでRでsample()のようなものを使用することは可能ですか?そうでない場合、誰かが私が得るかもしれない理由を知っていますか
Symbol not found: _gsl_rng_mt19937
(適切なヘッダーを使用して)次を含むコードをdyn.load()しようとすると、次のようになります。
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
void update_infs (int *inds,
int *inf_times,
int *n,
int *n_inf,
int *locs,
int *Rinds,
double *logmean,
double *logsd,
double *alpha,
double *wts,
int *indices /* a vector 1:n */
) {
...
/* set up GSL RNG */
gsl_rng * rng = gsl_rng_alloc(gsl_rng_mt19937);
/* end of GSL setup */
...
gsl_ran_choose(rng, tmp_inf_me, Rinds[i], indices, *n, sizeof (double));
... }