MathGroup Archive 2000

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

Search the Archive

Re: Mapping down two lists


dans l'article 8psfs6$a1t at smc.vnet.net, Matt.Johnson at autolivasp.com 
Matt.Johnson at autolivasp.com a ecrit le 15/09/2000 8:33:

> In[21]:=
> lst1 = Table[Random[], {500000}];
> lst2 = Table[{Random[], Random[]}, {500000}];
> In[23]:=
> Plus @@ (Transpose[lst2][[1]] - lst1)^2) // Timing
> Out[23]=
> {1.87 Second, 83259.7}
> In[24]:=
> Apply[Plus, (#[[1]] & /@ lst2 - lst1)^2] // Timing
> Out[24]=
> {2.91 Second, 83259.7}

> matt

This is interesting to note that the package Statistics`DataManipulation` is
still worse (a little bit) as compared to last previous example (about 3%
more time)

<<Statistics`DataManipulation`
Timing[Plus@@(Column[lst2,1]-lst1)^2]

I often used it before ... and will not continue !

-- 
Laurent CHUSSEAU, CR CNRS, CEM2 UMR5507, Universite de Montpellier II




  • Prev by Date: Re: Testing the Head of List Elements
  • Next by Date: Fixing options to Cell expressions
  • Previous by thread: Re: Mapping down two lists
  • Next by thread: how to compile in Mathematica?