File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ 2019-03-29 Dirk Eddelbuettel <edd@debian.org>
2+
3+ * inst/skeleton/rcppeigen_hello_world.cpp: Rework first example to
4+ not rely on Eigen RNG which R CMD check would complain about.
5+
162019-02-16 James Joseph Balamuta <balamut2@illinois.edu>
27
38 * R/runit.RcppEigen.R: Removed listing RcppEigen in Imports during
Original file line number Diff line number Diff line change 1717// [[Rcpp::export]]
1818Eigen::MatrixXd rcppeigen_hello_world () {
1919 Eigen::MatrixXd m1 = Eigen::MatrixXd::Identity (3 , 3 );
20- Eigen::MatrixXd m2 = Eigen::MatrixXd::Random (3 , 3 );
21-
20+ // Eigen::MatrixXd m2 = Eigen::MatrixXd::Random(3, 3);
21+ // Do not use Random() here to not promote use of a non-R RNG
22+ Eigen::MatrixXd m2 = Eigen::MatrixXd::Zero (3 , 3 );
23+ for (auto i=0 ; i<m2.rows (); i++)
24+ for (auto j=0 ; j<m2.cols (); j++)
25+ m2 (i,j) = R::rnorm (0 , 1 );
26+
2227 return m1 + 3 * (m1 + m2);
2328}
2429
2530
26- // another simple example: outer product of a vector,
31+ // another simple example: outer product of a vector,
2732// returning a matrix
2833//
2934// [[Rcpp::export]]
You can’t perform that action at this time.
0 commit comments