[Rcpp-devel] Error still there

Amina Shahzadi aminashahzadi at gmail.com
Tue Sep 13 00:45:01 CEST 2016

Thank you for welcoming me.
Your help will be appreciatable.

My problem is still there and getting the following error.
sample.cpp: In function ‘double sample(arma::vec, arma::vec)’:
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::Col<doub                             le>, arma::eglue_plus>,
arma::eop_exp>}’ to ‘double’ in return
      return exp(alpha2+beta2);
sample.cpp:34:1: warning: control reaches end of non-void function
[-Wreturn-typ                             e]

My sample code is

#include <RcppArmadillo.h>
using namespace Rcpp;
using namespace RcppArmadillo;

double sample(arma::vec alpha, arma::vec beta)
        int m = alpha.size();
        arma::uvec index(m);
        for(int i=0; i<m; i++)
                index(i) = i;
        for(int i=0; i<m; i++)
                for(int j=0; j<m; j++)
                                        arma::vec alpha1 =
alpha.elem(find(index !=j));
                                        arma::vec beta1 =
                                        return exp(alpha1(0)+beta1(1));
                                        arma::vec  alpha2 =
alpha.elem(find(index !=i && index !=j));
                                        arma::vec beta2 =
beta.elem(find(index !=i && index !=j));
                                        return exp(alpha2+beta2);


Thank you

*Amina Shahzadi*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160913/39853533/attachment.html>

More information about the Rcpp-devel mailing list