MathGroup Archive 2008

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

Search the Archive

Re: debugging code that contains compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91367] Re: debugging code that contains compile
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Mon, 18 Aug 2008 03:37:58 -0400 (EDT)
  • References: <g88v1j$gr1$1@smc.vnet.net>

Hi,

> The errors I get are Compile::cif errors. 

I don't know of a way to directly get information during runtime from
within a CompiledFunction (except using Print of course...), but for the
case of Compile::cif it should be relativley easy to extract the parts
that cause problems when beeing compiled by looking at the Inputform of
the resulting CompiledFunction:

Compile[{{x, _Real, 1}, {y, _Real, 2}, {t, True | False}},
  If[t, x, y]] // InputForm

If something could not be compiled that part of the code is contained
within the compiled code like here:

CompiledFunction[{{_Real, 1}, {_Real, 2},
  True | False}, {{3, 1, 0}, {3, 2, 1}, {1, 0, 0}, {3, 0, 0}}, {1, 0,
  1, 0, 2}, {{1, 5}, {54, Function[{x, y, t}, If[t, x, y]], 3, 1, 0,
   3, 2, 1, 1, 0, 0, 3, 0, 0}, {2}},
 Function[{x, y, t}, If[t, x, y]], Evaluate]

so in this case you can see that it is the If that causes the error. Of
course this approach might be uncomfortable if your compiled function is
huge, but you can then use Mathematica's pattern matching to extract
those parts within the compiled function that have not been compiled...

hth,

albert


  • Prev by Date: Re: troubling simple integral
  • Next by Date: Re: Re: Solving nonlinear inequality
  • Previous by thread: Re: debugging code that contains compile
  • Next by thread: Re: fractional derivative (order t) of (Log[x])^n and Log[Log[x]]