Re: [Rd] handling a matrix and .C

2008-12-01 Thread Sklyar, Oleg (London)
You should not have started with R/C API without reading this (first
link in google): Writing R Extensions. For your particular question
you want pages 72+ and sections 5.9.3 and 5.9.4, possibly further as
well

Dr Oleg Sklyar
Research Technologist
AHL / Man Investments Ltd
+44 (0)20 7144 3107
[EMAIL PROTECTED] 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilm Schumacher
 Sent: 24 November 2008 18:59
 To: r-devel@r-project.org
 Subject: [Rd] handling a matrix and .C
 
 Hello R-devel,
 
 I want to write extensions for R in C (maybe C++ and Fortran 
 later) and it works fine, but there is one problem, which I 
 cannot solve (in my view).
 
 I want to handle a matrix from R in C. For arrays there is 
 as.double(...), but nothing for a matrix.
 
 I searched a while, but didn't find something.
 
 Last I looked at the source code of e1071 and of the core 
 itself and recognized (I hope I understood this), that you 
 (and the e1071 people) use as.double() and give .C an 
 array and one have to parse the matrix again in the C function.
 
 This sounds a little complicate. Isn't there another way? A 
 more adapted way?
 
 Greetings
 
 Wilm
 
 ps: I joined the R-devel list, but didn't get an confirmation 
 mail. I hope this is normal
 --
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 

**
Please consider the environment before printing this email or its attachments.

The contents of this email are for the named addressees ...{{dropped:19}}

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


Re: [Rd] handling a matrix and .C

2008-11-25 Thread Rory.WINSTON
 Last I looked at the source code of e1071 and of the core itself and 
 recognized (I hope I understood this), that you (and the e1071 people) use 
 as.double() and give .C an array and one have to parse the matrix again 
 in the C function.

I think this is the simplest way to handle matrices at this level - after all a 
matrix is really an homogenous array of data with indexing information ?

I have an example of handling matrices (using .Call) in an old post:

http://www.theresearchkitchen.com/blog/archives/113

Cheesr
Rory


***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

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


[Rd] handling a matrix and .C

2008-11-25 Thread Wilm Schumacher
Hello R-devel,

I want to write extensions for R in C (maybe C++ and Fortran later) and it 
works fine, but there is one problem, which I cannot solve (in my view).

I want to handle a matrix from R in C. For arrays there is as.double(...), 
but nothing for a matrix.

I searched a while, but didn't find something.

Last I looked at the source code of e1071 and of the core itself and recognized 
(I hope I understood this), that you (and the e1071 people) use as.double() 
and give .C an array and one have to parse the matrix again in the C 
function.

This sounds a little complicate. Isn't there another way? A more adapted way?

Greetings

Wilm

ps: I joined the R-devel list, but didn't get an confirmation mail. I hope this 
is normal
--

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