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


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

compile fct. using Goto and If (vrs. 8)

Started byChris <kristoph.steikert@gmail.com>
First post2012-09-11 07:04 +0000
Last post2012-09-13 07:41 +0000
Articles 3 — 2 participants

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


Contents

  compile fct. using Goto and If (vrs. 8) Chris <kristoph.steikert@gmail.com> - 2012-09-11 07:04 +0000
    Re: compile fct. using Goto and If (vrs. 8) Frank K <fkampas@gmail.com> - 2012-09-12 07:04 +0000
    Re: compile fct. using Goto and If (vrs. 8) Chris <kristoph.steikert@gmail.com> - 2012-09-13 07:41 +0000

#11707 — compile fct. using Goto and If (vrs. 8)

FromChris <kristoph.steikert@gmail.com>
Date2012-09-11 07:04 +0000
Subjectcompile fct. using Goto and If (vrs. 8)
Message-ID<k2mnqc$54f$1@smc.vnet.net>
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"]]
];

[toc] | [next] | [standalone]


#11717

FromFrank K <fkampas@gmail.com>
Date2012-09-12 07:04 +0000
Message-ID<k2pc5e$99v$1@smc.vnet.net>
In reply to#11707
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

[toc] | [prev] | [next] | [standalone]


#11721

FromChris <kristoph.steikert@gmail.com>
Date2012-09-13 07:41 +0000
Message-ID<k2s2nf$dpf$1@smc.vnet.net>
In reply to#11707
Am Dienstag, 11. September 2012 09:05:56 UTC+2 schrieb Chris:
> 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"]]
> 
> ];

If just found out that it is print command. Sorry for bothering. 

[toc] | [prev] | [standalone]


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


csiph-web