MathGroup Archive 1997

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

Search the Archive

Re: Re: How to select unique elements in a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8058] Re: [mg8041] Re: [mg7953] How to select unique elements in a list?
  • From: "w.meeussen" <meeussen.vdmcc at vandemoortele.be>
  • Date: Mon, 4 Aug 1997 01:47:41 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

at this point it starts to get generally interesting beyond the original scope:

how are we (users) to get a feeling for efficiency of operations, given that
a Times[sequence_of_args] evaluates sooo much faster than a
List[sequence_of_args]?
By any measure, List feels more 'basic' than Times, not being commutative
and all.

Can we ever be shure that noone will come up with a gimmick that increases
the speed even further?

Amazed, 
as always,

wouter.


At 22:32 2-08-97 -0400, Fred Simons wrote:
>Carl Woll came with the following solution of his problem:
>
>Distinct[a_]	:= Select[Union[a],Count[a,#]===1&]
>
>Here is another solution, a short and (for me) amusing oneliner:
>
>Distinct2 = List @@ DeleteCases[ Times @@ #, _Power ]&
>
>It is also faster:
>
>test	= Table[i[Random[Integer,1000]],{1000}];
>
>In[9] := Distinct[test]; // Timing
>
>Out[10] = {12.5586 Second,Null}
>
>In[11] := Distinct2[test]; // Timing
>
>Out[11] = {1.43735 Second, Null}
>
>Fred Simons
>Eindhoven University of Technology
>
>
>
>

Dr. Wouter L. J. MEEUSSEN
eu000949 at pophost.eunet.be
w.meeussen.vdmcc at vandemoortele.be



  • Prev by Date: Book Announcement
  • Next by Date: Re: inverse command of Series[]
  • Previous by thread: Book Announcement
  • Next by thread: How to solve for Gradient and Hessian of matrix expressions