2008/4/5, Rory Winston <[EMAIL PROTECTED]>:
<snip>
>
>  /* Convenience function */
>  static void copyMatrixData(SEXP a, SEXP b, int nrows, int ncols, int mode) {
>     for (int i=0; i < ncols; ++i)
>     for (int j=0; j < nrows; ++j)
>         REAL(b)[i * nrows + j] = REAL(a)[i * nrows + j];
>  }

I would use 'memcpy' here instead of the double for loop, i.e.:
memcpy(REAL(b), REAL(a), length(b) * sizeof(double))



-- 
Antonio, Fabio Di Narzo
Ph.D. student at
Department of Statistical Sciences
University of Bologna, Italy

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to