<div dir="ltr"><div><div><div>Thank you for welcoming me.<br></div><div>Your help will be appreciatable.<br></div><div><br></div>My problem is still there and getting the following error.<br>sample.cpp: In function ‘double sample(arma::vec, arma::vec)’:<br>sample.cpp:29:29: error: cannot convert ‘arma::enable_if2<true, const arma::eOp< arma::eGlue<arma::Col<double>, arma::Col<double>, arma::eglue_plus>, arma::eop_e xp> >::result {aka const arma::eOp<arma::eGlue<arma::Col<double>, arma::Col<doub le>, arma::eglue_plus>, arma::eop_exp>}’ to ‘double’ in return<br> return exp(alpha2+beta2);<br> ^<br>sample.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-typ e]<br> }<br><br><br></div>My sample code is <br><br>#include <RcppArmadillo.h><br>using namespace Rcpp;<br>using namespace RcppArmadillo;<br>//[[Rcpp::depends(RcppArmadillo)]]<br>//[[Rcpp::export]]<br><br>double sample(arma::vec alpha, arma::vec beta)<br>{<br> int m = alpha.size();<br> arma::uvec index(m);<br> for(int i=0; i<m; i++)<br> {<br> index(i) = i;<br> }<br> for(int i=0; i<m; i++)<br> {<br> for(int j=0; j<m; j++)<br> {<br> if(i==j)<br> {<br> arma::vec alpha1 = alpha.elem(find(index !=j));<br> arma::vec beta1 = beta.elem(find(index!=j));<br> return exp(alpha1(0)+beta1(1));<br> }<br> else<br> {<br> arma::vec alpha2 = alpha.elem(find(index !=i && index !=j));<br> arma::vec beta2 = beta.elem(find(index !=i && index !=j));<br> return exp(alpha2+beta2);<br> }<br> }<br> }<br><br>}<br><br><br></div>Thank you<br><div><div><div><br clear="all"><div><div><div><br>-- <br><div class="gmail_signature"><i><font face="comic sans ms,sans-serif">Amina Shahzadi</font></i></div>
</div></div></div></div></div></div></div>