Re: Identical elements
- To: mathgroup at smc.vnet.net
- Subject: [mg88564] Re: Identical elements
- From: "Dana DeLouis" <dana.del at gmail.com>
- Date: Thu, 8 May 2008 04:16:04 -0400 (EDT)
Please disregard my suggestion of KroneckerDelta. I didn't realize it is not efficient for large data. (By a large factor) d = Table[5, {100000}]; Timing[KroneckerDelta @@ d] {93.32, 1} Timing[Boole[SameQ @@ d]] {0., 1} -- Dana DeLouis Mathematica 6.01 (Windows Vista) "KFUPM" <hussain.alqahtani at gmail.com> wrote in message news:fvhe2h$3th$1 at smc.vnet.net... > Dear All > > I have a list and i need to test whether all the elements in the list > are identical or no. What is the efficient way to do that? The output > should be true if all elements are the same and False otherwise. One > line command is preferred if possible. > > Your help is highly appreciated. > > Regards, > > HMQ >