Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3378 > unrolled thread

Re: C code generation

Started byPatrick Scheibe <pscheibe@trm.uni-leipzig.de>
First post2011-06-29 21:41 +0000
Last post2011-06-29 21:41 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: C code generation Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-06-29 21:41 +0000

#3378 — Re: C code generation

FromPatrick Scheibe <pscheibe@trm.uni-leipzig.de>
Date2011-06-29 21:41 +0000
SubjectRe: C code generation
Message-ID<iug676$9im$1@smc.vnet.net>
Hi,

I assume you hope for a pure C implementation of those functions. This won't work.
If you look on what Mathematica generates for you:

<< CCodeGenerator`
fc = Compile[{{p, _Integer}, {array, _Integer, 1}},
   Position[array, p]
   ];
CCodeStringGenerate[fc, "cPosition"]

you see, that there is some line

funStructCompile = libData->compileLibraryFunctions;
FP0 = funStructCompile->getFunctionCallPointer("Position");

and this function pointer is then called with your parameters.

Cheers
Patrick

On Jun 28, 2011, at 1:55 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.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web