Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RcppArmadillo.h>
- // [[Rcpp::depends(RcppArmadillo)]]
- // [[Rcpp::export]]
- arma::vec liml_omg_vapply(arma::mat& v1, arma::mat& omgi, arma::mat& v2) {
- arma::vec out(v1.n_rows);
- arma::mat res(1, 1);
- for (long i = 0; i < v1.n_rows; i++) {
- // works fine
- res = v1.row(i) * omgi * v2.row(i).t();
- out(i) = res(0, 0);
- // compile complains about it not being a function call
- out(i) = (v1.row(i) * omgi * v2.row(i).t())(0, 0);
- }
- return out;
- }
- // compiled in R returns:
- file4d1578fe0fe7.cpp: In function βarma::vec liml_omg_vapply(arma::mat&, arma::mat&, arma::mat&)β:
- file4d1578fe0fe7.cpp:16:61: error: no match for call to β(arma::enable_if2<true, const arma::Glue<arma::Glue<arma::subview_row<double>, arma::Mat<double>, arma::glue_times>, arma::Op<arma::subview_row<double>, arma::op_htrans>, arma::glue_times> >::result {aka const arma::Glue<arma::Glue<arma::subview_row<double>, arma::Mat<double>, arma::glue_times>, arma::Op<arma::subview_row<double>, arma::op_htrans>, arma::glue_times>}) (int, int)β
- out(i) = (v1.row(i) * omgi * v2.row(i).t())(0, 0);
- ^
- make: *** [file4d1578fe0fe7.o] Error 1
- g++ -I/usr/share/R/include -DNDEBUG -I"/home/james/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -I"/home/james/R/x86_64-pc-linux-gnu-library/3.2/RcppArmadillo/include" -I"/tmp/Rtmpsrp0A7" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c file4d1578fe0fe7.cpp -o file4d1578fe0fe7.o
- /usr/lib/R/etc/Makeconf:143: recipe for target 'file4d1578fe0fe7.o' failed
- Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
- Error 1 occurred building shared library.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement