Re: Manually nested Tables faster than builtin nesting?
- To: mathgroup at smc.vnet.net
- Subject: [mg113435] Re: Manually nested Tables faster than builtin nesting?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 28 Oct 2010 04:28:29 -0400 (EDT)
I get similar results and Outer falls between the others. imax = jmax = 5000; (tabletable = Table[Table[i*j, {i, imax}], {j, jmax}];) // Timing // First 1.96097 (table = Table[i*j, {i, imax}, {j, jmax}];) // Timing // First 24.0062 (outer = Outer[#1*#2 &, Range[imax], Range[jmax]];) // Timing // First 14.2569 tabletable == table == outer True Bob Hanlon ---- Sebastian Schmitt <sschmitt at physi.uni-heidelberg.de> wrote: ============= Dear all! I find that manually nested Tables are faster (factor 2 in my example) compared to the builtin nesting. I probably do a stupid thinko. Could you please have a look? In[52]:= imax = jmax = 5000; In[53]:= (tabletable = Table[Table[i*j, {i, imax}], {j, jmax}];) // Timing // First Out[53]= 1.84 In[54]:= (table = Table[i*j, {i, imax}, {j, jmax}];) // Timing // First Out[54]= 14.55 In[55]:= tabletable == table Out[55]= True Thanks, Sebastian