MathGroup Archive 2003

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

Search the Archive

Re: Re: Need a nice way to do this

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40496] Re: [mg40470] Re: Need a nice way to do this
  • From: Dr Bob <majort at cox-internet.com>
  • Date: Tue, 8 Apr 2003 03:03:16 -0400 (EDT)
  • References: <200304070853.EAA07971@smc.vnet.net>
  • Reply-to: majort at cox-internet.com
  • Sender: owner-wri-mathgroup at wolfram.com

We have a new winner! (For two-value lists.)

n = 100000;
test = Array[Random[Integer] &, n];
Timing[drbob[test];]
Timing[drbob2[test];]
Timing[drbob3[test];]
Timing[drbob4[test];]
Timing[andrzej2[test];]
Timing[kuska2[test];]
Timing[deLouis2[test];]

{0.781 Second,Null}
{1.328 Second,Null}
{1.328 Second,Null}
{0.735 Second,Null}
{0.5 Second,Null}
{1.344 Second,Null}
{0.328 Second,Null}

Bobby

On Mon, 7 Apr 2003 04:53:53 -0400 (EDT), Dana DeLouis 
<delouis at bellsouth.net> wrote:

> Hello.  I'm too new at this to contribute much.
> I modified Andrzej's second code slightly for two variables.  I seem to 
> get
> a 30% speed increase with the following idea.
> f3[s_List] := Module[
> {v, t}, v = Length /@ Split[s]; t = Transpose[Partition[v, 2, 2, {1, 1}, 
> 0]]; t = (FoldList[Plus, 0, #1] & ) /@ t; t = 
> Take[Rest[Flatten[Transpose[t]]], Length[v]]; Flatten[MapThread[Table[#1, 
> {#2}] & , {t, v}]]
> ]
>



-- 
majort at cox-internet.com
Bobby R. Treat



  • Prev by Date: Re: [Q] Imposing resrictions on the roots?
  • Next by Date: Re: ViewPoint -> moving into scenes
  • Previous by thread: Re: Need a nice way to do this
  • Next by thread: Re: Re: Need a nice way to do this