<P>sorry for my stupid questions but the question is one : im ignorant but i know some one could help me.<BR>Why This  appen?   pay attention  please for the following code. In this there is  a  loop  for (int k=0; k<n; k++) {<BR>th1[k]=th0[k];<BR>    }    tha have the meaning of th0=th1  (like assigmant meaning)      if i put in the code th0=th1  instead of the loop  <BR>this dont work....(the "=" work in "mathematical" mode Also the code that prof Douglas suggets   in the post  "call  R function" in rcccp  (that Prof Douglas attach  file labelled " foo") me  have the same problem   so maby could be a bug of rccp??  or is my ignorance  ?? ( i suspect the second option)<BR>i think my code  could  be wrong but.....the prof  Douglas's code is corrrect .....(" Douglas"  is the "gold standard"  for me)<BR><BR>require(inline)<BR>code <- '<BR>RNGScope scope;<BR>NumericVector start_= as<NumericVector>(start);</P>
<P>int n=Rf_length(start_);<BR>int N = as<int>(nsim);<BR>NumericVector tune = as<NumericVector>(scale);</P>
<P>NumericVector init (n);<BR>NumericVector th0 (n);<BR>NumericVector th1 (n);<BR>NumericMatrix store(N,n);<BR>NumericVector acount (n);<BR>NumericVector f0;<BR>NumericVector f1;<BR>Function ltd(fun);<BR>int i,j;<BR>init = start_;<BR>bool u;<BR>for( i=0; i<n; i++ ){<BR>th0[i]   = init[i];<BR>                    }<BR>f0=ltd(th0);  </P>
<P>for (i=0; i<N; i++) {<BR>  for (j=0; j<n; j++) {</P>
<P>  for (int k=0; k<n; k++) {<BR>th1[k]=th0[k];<BR>     }</P>
<P>     th1[j] = Rf_rnorm(th0[j],tune[j]);<BR>     f1=ltd(th1); <BR>      u= Rf_runif(0.0,1.0) <= exp(f1[0] - f0[0]);<BR>         if(u) {th0[j] = th1[j];<BR>                   f0=ltd(th0); <BR>                   f0=f1;<BR>                   acount[j]++;<BR>                   }<BR>       store(i,j)=th0[j];<BR>                   }<BR>}<BR>return  List::create (Named("sim") = store, Named("acount") = acount);<BR>'</P>
<P>AM<- cxxfunction(signature(fun="function",start="numeric",nsim="numeric",scale="numeric"),<BR>code,  plugin="Rcpp")</P>