[Rd] Manipulating single-precision (float) arrays in .Call functions

From: Alireza Mahani <alireza.s.mahani_at_gmail.com>
Date: Mon, 18 Jul 2011 08:52:10 -0700 (PDT)

I am writing a wrapper function in C++ that calls a GPU kernel. My array type for the GPU kernel is float, so I would like my wrapper function to receive float arrays from R. I understand that I can use 'as.single' in R to copy a double-precision vector from R in single-precision format while using the '.C' interface, but is there any way to do something similar for '.Call'? Given that the latter passes pointers from R to C/C++, I'm guessing this may be impossible, but I wanted to double-check. If you can suggest a solution, a small code sample would be much appreciated.

The reason I prefer '.Call' to '.C' is because the former passes pointers and therefore creates less data transfer overhead as opposed to the latter which copies data. Is this argument controversial?



View this message in context: http://r.789695.n4.nabble.com/Manipulating-single-precision-float-arrays-in-Call-functions-tp3675684p3675684.html Sent from the R devel mailing list archive at Nabble.com.

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 18 Jul 2011 - 15:56:00 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jul 2011 - 19:00:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive