Re: compile fct. using Goto and If (vrs. 8)
- To: mathgroup at smc.vnet.net
- Subject: [mg128062] Re: compile fct. using Goto and If (vrs. 8)
- From: Frank K <fkampas at gmail.com>
- Date: Wed, 12 Sep 2012 03:01:04 -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: <k2mnqc$54f$1@smc.vnet.net>
On Tuesday, September 11, 2012 3:05:56 AM UTC-4, Chris wrote:
> Hi
>
>
>
> Below I post some rudimentary and insubstantial code. My basic question is why the command Goto does not work properly when used in an if statement in a compile function. Does anybody know a way around this problem?
>
>
>
> Thanks in advance.
>
> Chris
>
>
>
>
>
> toy=Compile[{{x,_Real}},
>
> Label[t];
>
> y=RandomReal[{-1.,1.}];
>
> If[x*y<-0.,Print[y*x];Goto[t],Print[y*x," ","done"]]
>
> ];
You can use CompilePrint to diagnose problems with compiled functions