Abhängig davon, ob RcppArmadillo für den C++ 98-Standard (derzeit Standard) oder für C++ 11 (optional) kompiliert wurde, können zwei verschiedene RNGs verwendet werden. [...] Für C++ 98 wird die Systembibliothek RNG verwendet. Möglicherweise ist die Leistung schlecht, insbesondere bei älteren Windows-Versionen. Für C++ 11 wird der in seiner Bibliothek enthaltene RNG verwendet. - RcppArmadillo Documentation
"Für C++ 98 wird die Systembibliothek RNG verwendet." - Die Systembibliothek RNG ist std::rand()
, obwohl es scheint, als ob RcppArmadillo den RNG von R als Fallback verwendet (wenn C++ 11 nicht ausgewählt ist, so dass der C++ 11-basierte RNG nicht verfügbar ist), der die Verwendung des älteren C vermeidet ++ 98-basiert std::rand()
.
"Für C++ 11 wird der in seiner Bibliothek enthaltene RNG verwendet." - Dies bezieht sich auf die C++ 11 <random>
Bibliothek.
Auf der anderen Seite, sollten Sie auch this comment in RcppArmadilloForward.h:
// using this define makes the R RNG have precedent over both the
// C++11-based RNG provided by Armadillo, as well as the C++98-based
// fallback.
//
// One can use the C++11-based on by commenting out the following
// #define and also selecting C++11 (eg via src/Makevars* or the
// DESCRIPTION file) and/or defining #define-ing ARMA_USE_CXX11_RNG
#define ARMA_RNG_ALT RcppArmadillo/Alt_R_RNG.h
die für RcppArmadillo auf der R RNGs als Motor dreht.
R-bloggers | RcppArmadillo 0.4.450.1.0
Je nachdem, welche Zufallsfunktion Sie verwenden, verwendet Armadillo entweder eine gleichmäßige Verteilung oder eine Gaußsche Verteilung für seine RNG. – birryree
@birrreee Ich meinte, welcher Algorithmus verwendet es. Ist es ein linearer kongruenter Generator oder Mersenne Twister oder etwas anderes? – eleanora
@JonnyHenly Danke. Auf welche Bibliothek bezieht sich der C++ 11-Fall? Und ist die Systembibliothek RNG std: rand()? – eleanora