MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / operator()

Method operator()

inst/include/Rcpp/stats/random/rt.h:33–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 TGenerator( double df_ ) : df(df_), df_2(df_/2.0) {}
32
33 inline double operator()() const {
34 /* Some compilers (including MW6) evaluated this from right to left
35 return norm_rand() / sqrt(rchisq(df) / df); */
36 double num = norm_rand();
37
38 // return num / sqrt(rchisq(df) / df);
39 // replaced by the followoing line to skip the test in
40 // rchisq because we already know
41 return num / ::sqrt( ::Rf_rgamma(df_2, 2.0) / df);
42 }
43
44private:
45 double df, df_2 ;

Callers

nothing calls this directly

Calls 2

norm_randFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected