Re: Re: Nested iterators in Compile
- To: mathgroup at smc.vnet.net
- Subject: [mg55091] Re: [mg55072] Re: Nested iterators in Compile
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Sat, 12 Mar 2005 02:36:38 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: Ray Koopman [mailto:koopman at sfu.ca] To: mathgroup at smc.vnet.net >Sent: Friday, March 11, 2005 10:21 AM >Subject: [mg55091] [mg55072] Re: Nested iterators in Compile > >Wolf, Hartmut wrote: >> [...] >> Also mistrust any compiled function f with >> >> In[3]:= FreeQ[f[[-2]], Function] >> Out[3]= False >> >> >> This case can be solved easily: >> >> In[4]:= f2 = Compile[{{n, _Integer}}, >> Module[{s = 0}, Do[Do[s += j, {j, i}], {i, n}]; >> s]]; >> >> In[5]:= f2[10] >> Out[5]= 220 >> >> In[6]:= FreeQ[f2[[-2]], Function] >> Out[6]= True >> > >In[1]:= f1 = Compile[{n}, Module[{s = 0}, > Do[s += j, {i, n}, {j, i}]; s]]; > >In[2]:= f2 = Compile[{{n, _Integer}},Module[{s = 0}, > Do[Do[s += j, {j, i}], {i, n}]; s]]; > >In[3]:= FreeQ[f1[[#]],Function]& /@ Range@Length@f1 > FreeQ[f2[[#]],Function]& /@ Range@Length@f2 > >Out[3]= {True,True,True,False,False,True} >Out[4]= {True,True,True,True,False,True} > >Do you mean f[[-3]] ? > > In fact, I mean f[[4]] which, with my version is f[[-2]], with your's obviously not. I'm sorry about that, but would like to know what you see at f2//InputForm. -- Hartmut Wolf