MathGroup Archive 2005

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

Search the Archive

Re: Tilting at Windmills?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62172] Re: Tilting at Windmills?
  • From: "Matt" <anonmous69 at netscape.net>
  • Date: Sun, 13 Nov 2005 02:08:52 -0500 (EST)
  • References: <dl4a92$j1q$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Phil,
  I tried both your solution and Luc's.  They were both blindingly
fast.  On my computer I ran the tests 4 times each with a list size of
200000 integers, and got the following timing results for both yours
and Luc's respectively:

0.125 Second
0.047 Second

I did modify your solution slightly, because in its original form, it
didn't produce output exactly as I wanted (there was an additional
element at the start and end of the resultant list), so this what the
modified form became:

duplicatedData= Flatten[Transpose[{x,x}]]
ret = Delete[Transpose[{Drop[duplicatedData, -1], Drop[duplicatedData,
1]}], {{1}, {-1}}];

My original solution came in at 3.688 seconds in the same run.  My
solution has the added drawback, that once you go much beyond a list
size of 200000, the kernel would simply vanish with no error reported
back to the front-end.  I have a feeling that I exceeded some internal
limit on the number of allowable nestings for lists, which in turn, led
to some sort of stack overflow.  In Windows-based systems, a process
disappearing without a trace (no error msg, no error logs, etc.) is a
strong sign of stack overflow.  In the other solutions presented
(including yours), if I took the list size too high, I'd simply get an
error about memory being exhausted, which is what one would expect.
Anyway, thank you for taking the liberty, it's much appreciated!

Matt


  • Prev by Date: Re: extract from list and keep track
  • Next by Date: Re: extract from list and keep track
  • Previous by thread: Re: Tilting at Windmills?
  • Next by thread: Defining variables in $UserBaseDirectory/init.m