Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3430
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: C code generation |
| Date | 2011-07-01 00:45 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iuj5bi$np3$1@smc.vnet.net> (permalink) |
| References | <iug5os$9g0$1@smc.vnet.net> |
On 6/29/2011 2:34 PM, Shane Di Dona wrote: > Is there a way to make Mathematica generate C code for functions such as Position[] and MemberQ[]? I am writing a program for CUDAlink and would like not to have to reinvent the wheel (in C) on these somewhat basic functions. > 1. Code for a similar program for position and member can be found in other languages, though really, it should be easy to write yourself. 2. A full implementation of Position and MemberQ requires that you allow for the possibility of searching for a pattern, and so you would have to (re) implement Mathematica's matching. I doubt you want to do that. 3. While I am not familiar with CUDAlink, it seems to me unlikely that copying a (long?) list into a graphics processor to test for membership is a really bad idea. A worse idea would be, I suppose, NOT copying the list into the graphics processor. My suggestion: Read up on hash tables. Suggestion 2: If you are in a hurry, don't use Mathematica. RJF
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
C code generation Shane Di Dona <stdidona@ncsu.edu> - 2011-06-29 21:34 +0000 Re: C code generation Richard Fateman <fateman@cs.berkeley.edu> - 2011-07-01 00:45 +0000
csiph-web