[Rcpp-devel] R.e. element wise multiplication of a subcube and a row of a matrix

Dirk Eddelbuettel edd at debian.org
Mon Jan 9 13:47:21 CET 2017


On 9 January 2017 at 04:56, Christian Gunning wrote:
| > I am posting again a question about the subject cited. I tried to search
| > this problem but did not find. My question is why we cannot multiply
| > element wise a subcube and a row of a matrix.
| >
| > Any help would be appriciated. The following is sample code which is giving
| > erros about the operand %.
| >
| >
| > #include <RcppArmadillo.h>
| > using namespace Rcpp;
| > using namespace RcppArmadillo;
| > using namespace arma;
| > //[[Rcpp::depends(RcppArmadillo)]]
| > //[[Rcpp::export]]
| >
| > arma::rowvec sub(arma::cube a, arma::mat b)
| > {
| >         rowvec x  =  a.subcube(0, 0, 0, 0, 2, 0)% b.row(0);
| >         return x;
| > }
| 
| Shaami,
| 
| When posting questions to the list, please include a complete working example.
| Hint - how would I paste your example into R and get a result?
| What do you expect the result to be?
| How does the result differ from your expectations?

And ... seeing that your example doesn't even build / do anything is a good
lead to make more progress on your end before relying on us.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list