On Mon, Mar 30, 2015 at 6:00 AM,
rcpp-devel-requ...@lists.r-forge.r-project.org <
rcpp-devel-requ...@lists.r-forge.r-project.org> wrote:
>
>
> // [[Rcpp::export]]
>
> List rearrangelist(List x){
>      int ni=15;
>      int nj=49999;
>      int nk=999;
>      List output;
>
> for (int i= 0 ; i<ni ; i++){
>      for (int j=0 ; j<nj ; j++) {
>          for (int k=0 ; j<nk ; k++){
>              output[i](j,k)=x[k][0](j,i);
>          }
>      }
> }
> return output;
> }

First thing, you probably want to walk before you run.  Get comfortable
returning a list of vectors before you start chaining a large number of
indexes together.

Second, practice getting your indexes from the objects that you're
operating on:
size_t ni = x.size();

And you probably want to fill your return list like this.

List foo;
// do stuff
foo.push_back(result);

-xian
>

--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
_______________________________________________
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

Reply via email to