Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-20 Thread Laurent Gautier
Peter wrote: > On Thu, Nov 20, 2008 at 12:02 AM, Nathaniel Smith <[EMAIL PROTECTED]> wrote: > >> In particular, looking at Rinternals.h, VECTOR_ELT etc. are defined in >> terms of calculating direct memory offsets from an SEXPREC. Not only >> are there no strides (necessary for column-major R t

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-20 Thread Peter
On Thu, Nov 20, 2008 at 12:02 AM, Nathaniel Smith <[EMAIL PROTECTED]> wrote: > > In particular, looking at Rinternals.h, VECTOR_ELT etc. are defined in > terms of calculating direct memory offsets from an SEXPREC. Not only > are there no strides (necessary for column-major R to grok row-major > Nu

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-19 Thread Nathaniel Smith
On Mon, Nov 17, 2008 at 1:11 PM, laurent <[EMAIL PROTECTED]> wrote: > Yes, I have briefly seen that you are doing it at the rpy2.robjects > level. That's certainly a good way to go when wanting to offer such > capability. > > Regarding SexpVector accepting numpy's one-dimensional arrays, that's > b

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-19 Thread laurent
I took the time to do that a little earlier. There are adaptations to the patch, and the numpy-capabilities are confined to a module (this way, no conditional import - and you can have more freedom to modify further your code). It also made me realize shortcomings in the design of rpy2.robjects-

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-17 Thread laurent
On Mon, 2008-11-17 at 10:33 -0800, Nathaniel Smith wrote: > On Mon, Nov 17, 2008 at 8:01 AM, laurent <[EMAIL PROTECTED]> wrote: > > On Sun, 2008-11-16 at 22:25 -0800, Nathaniel Smith wrote: [...] > > >> who uses rpy without numpy? > > > > The R-to-numpy bridge is (officially) working. > > (The o

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-17 Thread Nathaniel Smith
On Mon, Nov 17, 2008 at 8:01 AM, laurent <[EMAIL PROTECTED]> wrote: > On Sun, 2008-11-16 at 22:25 -0800, Nathaniel Smith wrote: >> rpy2 is awesome. >> >> But I was disconcerted to discover passing a numpy array to an R >> function just makes things blow up ("Nothing can be done for that >> type..."

Re: [Rpy] [PATCH] passing numpy arrays to rpy2 functions

2008-11-17 Thread laurent
On Sun, 2008-11-16 at 22:25 -0800, Nathaniel Smith wrote: > rpy2 is awesome. > > But I was disconcerted to discover passing a numpy array to an R > function just makes things blow up ("Nothing can be done for that > type...") -- Complete error messages are: "Nothing can be done for this array