Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Challenge! ....RESULTS...

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1053] Re: Challenge! ....RESULTS...
  • From: jorma.virtamo at vtt.fi (Jorma Virtamo)
  • Date: Fri, 12 May 1995 14:10:43 -0400

roth at sunny.mpimf-heidelberg.mpg.de. (Arnd Roth) wrote:

>...

>Villegas' function 3    villegas at wri.com
>In[17]:=
>swap[list1_List, list2_List] := Thread @
>Unevaluated[If[Random[Integer] == 0, #1, #2]& [list1, list2]]
>In[18]:= Timing[Do[swap[l1,l2],{1000}]]
>Out[18]= {1.44 Second, Null}
>
>So Robby Villegas' function 3 is fastest among the solutions I
>tested. But of course there may still be room for further
>speedup.

Indeed, by writing the argument lists directly into the If function,

   swap[list1_List, list2_List] := Thread @
   Unevaluated[If[Random[Integer] == 0, list1, list2]]

the execution speeds up in my Pentium to 1.483 Second 
in contrast to 2.471 Second with the original form.

-- Jorma Virtamo


=======================================================     
Jorma Virtamo
VTT Information Technology / Telecommunications
P.O. Box 1202,  FIN-02044 VTT,  Finland
phone:  +358 0 456 5612           
fax:    +358 0 455 0115
email:  jorma.virtamo at vtt.fi
web:    http://www.vtt.fi/tte/
=======================================================



  • Prev by Date: Ouestion about Ploting?
  • Next by Date: Re: copy-paste bitmaps?
  • Previous by thread: Re: Challenge! ....RESULTS...
  • Next by thread: Re: Challenge! ....RESULTS...