My main objective is to index some elements of a given vector and then taking exponent.
Great Prof. Dirk. I have just minimized example and got the solution. I would like to share my minimized code. Thank You all. #include <RcppArmadillo.h> using namespace Rcpp; using namespace RcppArmadillo; //[[Rcpp::depends(RcppArmadillo)]] //[[Rcpp::export]] arma::vec sample(arma::vec alpha) { int m = alpha.size(); arma::uvec index(m); arma::vec a(m); for(int i=0; i<m; i++) { index(i) = i; } for(int i=0; i<m; i++) { arma::vec alpha1 = alpha.elem(find(index !=i)); a(i) = exp(alpha1(0)); } return a; } On Tue, Sep 13, 2016 at 12:21 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 12 September 2016 at 19:05, Avraham Adler wrote: > | What exactly is it that you are trying to do? > > Also review some resources on 'minimally reproducible example' as eg > > http://stackoverflow.com/questions/5963269/how-to-make- > a-great-r-reproducible-example > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > -- *Amina Shahzadi*
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel