Re: element selection
- To: mathgroup at smc.vnet.net
- Subject: [mg53648] Re: element selection
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Fri, 21 Jan 2005 06:36:20 -0500 (EST)
- References: <csnt7e$4ec$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bruyndonckx P. wrote: > I have two long sorted lists of Integers. If the difference between a number in list 1 and a > number in list 2 is less than a certain value, both are selected to create a couple. I am > looking for a fast way to go through both lists and extract these elements to create a new list > of couples. I tried a number of things, but all of them were rather slow so I need some expert > advice here. > > Thx, > > Peter Select[ Transpose@{list1,list2}, Abs[Subtract@@#] < cutoff & ]