 
 
 
 
 
 
Re: Particular structure
- To: mathgroup at smc.vnet.net
- Subject: [mg33625] Re: [mg33545] Particular structure
- From: Yas <yast at optushome.com.au>
- Date: Wed, 3 Apr 2002 18:08:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Thanks to all the replies to the problem I posted earlier on achieving a 
particular structure. All the solutions provided deal with the problem 
adequately but because my lists are fairly large I find myself running 
out of memory. For example, using Outer on lists where x > 500 and y > 
100 gets me into trouble very quickly. The other draw back is that the 
time for calculation gets long.
In an effort to overcome these undesirable properties, Allan Hayes has 
suggested the following construct,
   x = y = Table[i + 1, {i, 1, 400}]; f = Plus; F = Times @@ # &;
    Table[Function[kk, ReleaseHold[#]][y[[i]]], {i, Length[y]}] &[
       Hold[F][f[#, kk, z] & /@ x]]; // Timing
{5.81667 Second, Null}
This construct is more efficient than the ones I've constructed 
previously in that the MaxMemoryUsed is reduced by a whopping 93% and 
the time for evaluation reduced by half compared to those using Outer 
and Map[Map...
I wonder if there are any other suggestions to speeding things up even 
more?
Cheers
Yas

