Re: [Rd] passing matrix as argument to a C function

2006-12-03 Thread Christos Hatzis
Thank you, Dirk. I'll keep this in mind. -Christos -Original Message- From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED] Sent: Sunday, December 03, 2006 12:47 PM To: [EMAIL PROTECTED] Cc: 'Prof Brian Ripley'; r-devel@r-project.org Subject: Re: [Rd] passing matrix as

Re: [Rd] passing matrix as argument to a C function

2006-12-03 Thread Dirk Eddelbuettel
On 3 December 2006 at 11:47, Christos Hatzis wrote: | Thank you. The code in kmeans.c is indeed informative. One needs to | remember that an R matrix is a vector with attributes. In case there is any chance that you could turn your part of the source from C into C++, try RcppTemplate from CRAN

Re: [Rd] passing matrix as argument to a C function

2006-12-03 Thread Christos Hatzis
-project.org Subject: Re: [Rd] passing matrix as argument to a C function The data in an R matrix is not stored as double **A, but as double *A: it is just a vector in R, with attributes. There are lots of examples of manipulating R matrixes via .C: one is src/library/stats/src/kmeans.c. The code for

Re: [Rd] passing matrix as argument to a C function

2006-12-03 Thread Prof Brian Ripley
The data in an R matrix is not stored as double **A, but as double *A: it is just a vector in R, with attributes. There are lots of examples of manipulating R matrixes via .C: one is src/library/stats/src/kmeans.c. The code for crossprod is not at all hard to find: it is in src/main/array.c.

[Rd] passing matrix as argument to a C function

2006-12-02 Thread Christos Hatzis
Hi, Although this is not directly an R-related question, it is relevant as I am trying to port some R code to C to speed things up in a computation. I am working through my first attempts to generate and link compiled C code in R. I could make the 'convolve' function to work and similar functio