Re: [Rd] Speeding up transpose

2010-08-27 Thread Hervé Pagès
Hi Radford, On 08/25/2010 07:50 PM, Radford Neal wrote: I've looked at how to speed up the transpose function in R (ie, t(X)). The existing code does the work with loops like the following: for (i = 0; i< len; i++) REAL(r)[i] = REAL(a)[(i / ncol) + (i % ncol) * nrow]; It

Re: [Rd] Speeding up transpose

2010-08-26 Thread Radford Neal
> I've appended below the new version of the modified part of the > do_transpose function in src/main/array.c. A quick correction... A "break" went missing from the case INTSXP: section of the code I posted. Corrected version below. Radford Neal --

[Rd] Speeding up transpose

2010-08-25 Thread Radford Neal
I've looked at how to speed up the transpose function in R (ie, t(X)). The existing code does the work with loops like the following: for (i = 0; i < len; i++) REAL(r)[i] = REAL(a)[(i / ncol) + (i % ncol) * nrow]; It seems a bit optimistic to expect a compiler to produce goo