MathGroup Archive 2012

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

Search the Archive

Re: Strange runtime error in Compiled function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127574] Re: Strange runtime error in Compiled function
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sat, 4 Aug 2012 21:47:55 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <jvg1i7$rkd$1@smc.vnet.net>

On 03/08/2012 09:19, Axel wrote:
> Hi everybody,
> I'm using Mathematica 8.0.1 on a 32bit Win7 system and I have strange problems with the Compile function.
> I have this simple function:
>
> compileTestC = Compile[{{paramList, _Integer, 1}},
>     Module[{a, b},
>      Print[paramList[[1]]];
>      a = paramList[[1]];
>
>      If[False,
>       b = 1,
>       b = 0
>       ] ;
>      Return[5]
>      ]
>     ] ;
>
> When I compile and run it the first time, it produces the expected results:
> compileTestC[{100}]
> 100
> 5
>
> But for all subsequent calls I get this strange error message:
> compileTestC[{100}]
> 100
> CompiledFunction::cflist: Nontensor object generated; proceeding with uncompiled evaluation.>>
> 100
> 5
>

Admitedly I am using the 64-bit version of 8.0.4, but I don't think that 
is relevant. For me your code runs in the same way however many times I 
run it:

In[791]:=
compileTestC =
   Compile[{{paramList, _Integer, 1}},
    Module[{a, b}, Print[paramList[[1]]];
     a = paramList[[1]];
     If[False, b = 1, b = 0];
     Return[5]]];

In[792]:= compileTestC[{100}]

  100

Out[792]= 5

In[797]:= compileTestC[{100}]

  100

Out[797]= 5

I am guessing that you actually do something else between the first and 
second calls!

Post some code that actually fails, and someone will tell you what is 
wrong! Preferably start from a clean kernel, so that whatever code you 
post, is not affected by something we cannot see.

David Bailey
http://www.dbaileyconsultancy.co.uk




  • Prev by Date: PDF.exe inside Mathematica.app on OS X
  • Next by Date: Re: Evaluation of a whole notebook from another one
  • Previous by thread: Re: Strange runtime error in Compiled function
  • Next by thread: Re: Strange runtime error in Compiled function