#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 57 of file internal.h.
57 {
58 return (
int) floor(R_unif_index((
double)
n));
59}
◆ random_sample_wo_repl()
| static void random_sample_wo_repl |
( |
int * | samples, |
|
|
int | N, |
|
|
int | n ) |
|
inlinestatic |
Definition at line 62 of file internal.h.
62 {
63 int k = 0;
64 int m = 0;
65 while (m <
n && k <
N) {
68 samples[m++] = k;
69 }
70 k++;
71 }
72}
static int random_integer(int n)
◆ rcateg()
| static int rcateg |
( |
double | erate, |
|
|
double * | rate, |
|
|
int | nrate ) |
|
inlinestatic |
Definition at line 85 of file internal.h.
85 {
86 double u = erate*unif_rand();
87 int e = 0;
88 while (u > rate[e] && e <
nrate) {
89 if (rate[e] < 0)
90 err(
"in '%s': invalid rate rate[%d]=%lg",__func__,e,rate[e]);
91 u -= rate[e++];
92 }
94 return e;
95}
◆ set_list_elem()
| static int set_list_elem |
( |
SEXP | list, |
|
|
SEXP | names, |
|
|
SEXP | element, |
|
|
const char * | name, |
|
|
int | pos ) |
|
inlinestatic |
Definition at line 75 of file internal.h.
79 {
80 SET_ELEMENT(list,pos,element);
81 SET_STRING_ELT(names,pos,Rf_mkChar(name));
82 return ++pos;
83}