Re: recode procedural algorithm to faster functional module
- To: mathgroup at smc.vnet.net
- Subject: [mg44078] Re: recode procedural algorithm to faster functional module
- From: Tom Burton <tburton at brahea.com>
- Date: Tue, 21 Oct 2003 02:07:53 -0400 (EDT)
- References: <bmqqcl$rjv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 10/17/03 9:33 PM, in article bmqqcl$rjv$1 at smc.vnet.net, "Prince-Wright, Robert G SEPCO" <robert.prince-wright at shell.com> wrote: > Can someone please help me recode this Module so it is less procedural > and hopefully runs a lot faster... I find that Peter Pein's solution is both faster than the Compiled original but also easier to look at. I would only suggest the following alternative when the number of sets becomes large: Concurrence6[v1_List, v2_List,nsim_] := Total[ Take[v1,nsim] /. {a_?AtomQ, b_} :> Count[Take[v2,nsim] /. {c_?AtomQ, d_} -> (a <= c < b || c < a < d), True] ] It is slightly slower, but creates much less temporary storage. Tom Burton