Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: C code generation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119901] Re: C code generation
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Wed, 29 Jun 2011 05:27:05 -0400 (EDT)
  • References: <201106281155.HAA21467@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.
>



  • Prev by Date: Re: Stylesheet questions
  • Next by Date: Re: How to find the difference between two lists (opposite of union[]?)
  • Previous by thread: C code generation
  • Next by thread: Re: C code generation