MathGroup Archive 2003

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

Search the Archive

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


  • Prev by Date: non linear least square minimization....
  • Next by Date: Integrate piecewise with Assumptions
  • Previous by thread: Re: Re: recode procedural algorithm to faster functional module
  • Next by thread: Re: Re: recode procedural algorithm to faster functional module