Re: list equation
- To: mathgroup at smc.vnet.net
- Subject: [mg121973] Re: list equation
- From: Simon <simonjtyler at gmail.com>
- Date: Fri, 7 Oct 2011 04:50:51 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j6jpek$me8$1@smc.vnet.net>
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
Using SameTest is a lot slower than sticking to the default, so you could try
lst = Tuples[Range[50], 2];
lstnew = Union[Sort /@ lst]
which is about 6000 times faster than your
Union[lst, SameTest -> (#1 == Reverse[#2] &)]
Easier still would just be to construct
Flatten[Table[{i, j}, {i, 1, 100}, {j, i, 100}], 1]
which is about twice as fast again.