Thanks Antonio, thats a good suggestion.

On Sat, Apr 5, 2008 at 5:51 PM, Antonio, Fabio Di Narzo <
antonio.fabio@gmail.com> wrote:

> 2008/4/5, Rory Winston <rory.winston@gmail.com>:
> <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
>

	[[alternative HTML version deleted]]

