Re: is there a better way to iterate this?

*To*: mathgroup at smc.vnet.net*Subject*: [mg77906] Re: is there a better way to iterate this?*From*: Ray Koopman <koopman at sfu.ca>*Date*: Tue, 19 Jun 2007 06:45:21 -0400 (EDT)*References*: <f532ln$3ab$1@smc.vnet.net>

On Jun 18, 4:19 am, dan siegal-gaskins <dantimat... at gmail.com> wrote: > ... all that's really important is that listA and listB > are lists of 21 sublists, and each sublist has 18 elements. I should have wrapped N around the right hand sides of a & b, and you should have said sooner that all the sublists have the same length. This will be faster: c = Outer[Dot, N[#/Norm@Flatten@#]&[listA - Mean@Flatten@listA], N[#/Norm@Flatten@#]&[listB - Mean@Flatten@listB], 1]; bar = Table[ Total@Extract[ c, Transpose@{Range@21, Ordering@Table[Random[],{21}]} ], {1*^5}] Here's one way to look at the distribution: With[{n = Length@bar, m = Mean@bar}, ListPlot[Transpose@{Sort@bar,Range[.5,n]/n}, PlotJoined->True, Frame->True, AxesOrigin->{m,.5}]; {m,StandardDeviation@bar}]