Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11182
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Strange Compile runtime error |
| Date | 2012-08-03 08:16 +0000 |
| Message-ID | <jvg1c1$ril$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
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.
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Strange Compile runtime error Bill Rowe <readnews@sbcglobal.net> - 2012-08-03 08:16 +0000
csiph-web