Re: Can I do this faster?
- To: mathgroup at smc.vnet.net
- Subject: [mg103010] Re: Can I do this faster?
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 3 Sep 2009 19:56:27 -0400 (EDT)
- References: <h7o2cd$jtk$1@smc.vnet.net>
Rest@FoldList[Times,1,1+(list1-1).Transpose@list2]
On Sep 3, 2:30 am, Andreas <aa... at ix.netcom.com> wrote:
> I start with two 2 dimensional lists. The have equal depths, but may
> or may not have equal lengths. Possible data looks like this:
>
> list1 = RandomReal[{0, 1}, {1500, 3}];
> list2 = RandomReal[ExponentialDistribution[2], {1000, 3}];
>
> The following produces the results I need, but takes longer to run
> than I'd like:
>
> Rest[FoldList[Times, 1, Transpose[(t = #; 1 + Inner[Times, t, # - 1,
> Plus] & /@ list1) & /@ list2]]]
>
> Any suggestions rewriting this so I can make it run faster?
>
> Thanks.