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


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

Re: C code generation

From Patrick Scheibe <pscheibe@trm.uni-leipzig.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: C code generation
Date 2011-06-29 21:41 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iug676$9im$1@smc.vnet.net> (permalink)
References <201106281155.HAA21467@smc.vnet.net>

Show all headers | View raw


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.
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web