MathGroup Archive 2004

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

Search the Archive

Re: Counting Runs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52180] Re: Counting Runs
  • From: "Carl K. Woll" <carl at woll2woll.com>
  • Date: Sun, 14 Nov 2004 04:30:17 -0500 (EST)
  • References: <001601c4c8d4$6aecc3e0$6400a8c0@Main> <opsheakrjtiz9bcq@monster.cox-internet.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Bob,

I think Abs, Tr, and BitXor are very fast because they are probably 
optimized for integer input and the use of packed arrays. On the other hand, 
I doubt that there are any such optimizations for integers or packed arrays 
for the functions Part, Split and Sort.

At any rate, Andrzej Kozlowsky has kindly provided an improvement, so that 
the following runs function is almost twice as fast as my previous one.

runs[int_,data_]:=Module[{modlist},
 modlist=Sign[Abs[data-int]];


  • Prev by Date: Plot and axes
  • Next by Date: Re: Challenge: Fastest method to convert positive integers to 1 in a long list
  • Previous by thread: Re: Re: Counting Runs
  • Next by thread: Re: Counting Runs