Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manually nested Tables faster than builtin

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113462] Re: Manually nested Tables faster than builtin
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Fri, 29 Oct 2010 06:30:34 -0400 (EDT)

No, I don't have a clue. First of all, I'm surprised the my PC takes so much longer than yours. I have Windows Vista 64 bit, and Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz with 4.00 GB, which doesn't seem to differ all that much from yours.
And then, if you look at FullForm in both cases (for small values of imax and jmax) the results are identical (?)
-Tomas

> Date: Thu, 28 Oct 2010 04:28:18 -0400
> From: sschmitt at physi.uni-heidelberg.de
> Subject: [mg113434] Re: Manually nested Tables faster than builtin nesting?
> To: mathgroup at smc.vnet.net
>
> Hi Tomas!
>
> With "manually" I mean
>
> "Table[Table[..., {i, imax}], {j, jmax}]"
>
> (two Tables explicitly/manually)
>
> instead of
>
> "Table[..., {i, imax}, {j, jmax}]"
>
> (one Table but two iterators).
>
> Can you explain the difference in speed?
>
> Cheers,
>
> Sebastian
>
> PS:
>
> $Version
> "7.0 for Linux x86 (64-bit) (February 18, 2009)"
>
> $ grep "model name" /proc/cpuinfo
>
> model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
> model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
>
> Tomas Garza wrote:
> > You must have a very fast machine! Any way, I get 5.647 and 43.134, respectively. The factor in both machines is close to 8, not 2 (what do you mean manually?)
> >
> > -Tomas
> >
> >> Date: Wed, 27 Oct 2010 05:13:59 -0400
> >> From: sschmitt at physi.uni-heidelberg.de
> >> Subject: [mg113391] Manually nested Tables faster than builtin nesting?
> >> To: mathgroup at smc.vnet.net
> >>
> >> 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 // Fi=
rst
> >>
> >> Out[54]== 14.55
> >>
> >> In[55]:== tabletable ==== table
> >>
> >> Out[55]== True
> >>
> >> Thanks,
> >>
> >> Sebastian
> >>
> >  		 	   		 
>
>
 		 	   		 


  • Prev by Date: Re: Importing data
  • Next by Date: Re: Assertions in Mathematica?
  • Previous by thread: Re: How to make Mathematica automatically save a notebook to the
  • Next by thread: Re: Manually nested Tables faster than builtin