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


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

Re: Strange Compile runtime error

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-08-03 08:16 +0000
Last post2012-08-03 08:16 +0000
Articles 1 — 1 participant

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


Contents

  Re: Strange Compile runtime error Bill Rowe <readnews@sbcglobal.net> - 2012-08-03 08:16 +0000

#11182 — Re: Strange Compile runtime error

FromBill Rowe <readnews@sbcglobal.net>
Date2012-08-03 08:16 +0000
SubjectRe: Strange Compile runtime error
Message-ID<jvg1c1$ril$1@smc.vnet.net>
On 8/2/12 at 4:50 AM, axel.kowald@gmail.com (Axel) wrote:

>I'm using Mathematica 8.0.1 on 32bit Win7 and I have a strange
>problem with Compile. Here my example that demonstrates the problem.

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

>The first call to the compiled function works as expected and gives:
>compileTestC[{100}] 100 5

>However, all following calls to the function give this error
>message: compileTestC[{100}] 100 CompiledFunction::cflist: Nontensor
>object generated; proceeding with uncompiled evaluation. >> 100 5

I cannot reproduce the error you indicate. If I paste your
function into a fresh kernel every execution produces the
expected result with no error message.

But what are you expecting to achieve with this code?

The If will always test False and consequently always does b = 0.

So, your code is will do exactly the same as

f[x_List]:= (Print[a=x[[1]];b=0;5)

and Compile cannot speed this up.

[toc] | [standalone]


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


csiph-web