#include <R.h>
#include <Rmath.h>
#include <Rdefines.h>
#include <assert.h>
Go to the source code of this file.
◆ err
Value:Rf_errorcall(R_NilValue,__VA_ARGS__)
Definition at line 18 of file internal.h.
◆ R_NO_REMAP
◆ rprint
Value:Rprintf(
"%s\n",(
S).c_str())
Definition at line 20 of file internal.h.
◆ warn
Value:Rf_warningcall(R_NilValue,__VA_ARGS__)
Definition at line 19 of file internal.h.
◆ name_t
◆ raw_t
◆ slate_t
◆ random_integer()
static int random_integer |
( |
int | n | ) |
|
|
inlinestatic |
Definition at line 48 of file internal.h.
48 {
49 return (
int) floor(R_unif_index((
double)
n));
50}
◆ random_sample_wo_repl()
static void random_sample_wo_repl |
( |
int * | samples, |
|
|
int | N, |
|
|
int | n ) |
|
inlinestatic |
Definition at line 53 of file internal.h.
53 {
54 int k = 0;
55 int m = 0;
56 while (m <
n && k <
N) {
59 samples[m++] = k;
60 }
61 k++;
62 }
63}
static int random_integer(int n)
◆ rcateg()
static int rcateg |
( |
double | erate, |
|
|
double * | rate, |
|
|
int | nrate ) |
|
inlinestatic |
Definition at line 76 of file internal.h.
76 {
77 double u = erate*unif_rand();
78 int e = 0;
79 while (u > rate[e] && e <
nrate) {
80 if (rate[e] < 0)
81 err(
"in '%s': invalid rate rate[%d]=%lg",__func__,e,rate[e]);
82 u -= rate[e++];
83 }
85 return e;
86}
◆ set_list_elem()
static int set_list_elem |
( |
SEXP | list, |
|
|
SEXP | names, |
|
|
SEXP | element, |
|
|
const char * | name, |
|
|
int | pos ) |
|
inlinestatic |
Definition at line 66 of file internal.h.
70 {
71 SET_ELEMENT(list,pos,element);
72 SET_STRING_ELT(names,pos,Rf_mkChar(name));
73 return ++pos;
74}