Dear All,<br>Why the following code is not working:<br><br>// [[Rcpp::depends(RcppArmadillo)]]<br>#include <Rcpp.h><br>#include <RcppArmadillo.h><br><br>using namespace Rcpp;<br><br>// [[Rcpp::depends(RcppArmadillo)]]<br>
#include <RcppArmadillo.h><br>// [[Rcpp::export]]<br>List test(NumericVector yr, NumericMatrix Xr) {<br> int n = Xr.nrow(), k = Xr.ncol();<br> arma::mat X(Xr.begin(), n, k, false);<br> NumericMatrix Y = arma::randu<mat>(3,3);<br>
arma::colvec y(yr.begin(), yr.size(), false);<br> X.each_col()+= y;<br> Y.each_col()%= y;<br> NumericMatrix Z = arma::repmat(X,4,5);<br> return List::create(Named("Addition") = X,Named("Multiplication") = Y, Named("Rep") =Z);<br>
}<br><br><br>Thanks.<br><br clear="all"><div>Best wishes!</div><div> </div><div>Honglang Wang</div><div> </div><div>Office C402 Wells Hall</div><div>Department of Statistics and Probability</div><div>Michigan State University</div>
<div>1579 I Spartan Village, East Lansing, MI 48823</div><div><a href="mailto:wangho16@msu.edu" target="_blank">wangho16@msu.edu</a></div><br>