Re: Using Select
- To: mathgroup at smc.vnet.net
- Subject: [mg97408] Re: Using Select
- From: Raffy <raffy at mac.com>
- Date: Thu, 12 Mar 2009 05:43:12 -0500 (EST)
- References: <gpacsh$ms3$1@smc.vnet.net>
Do[r1 = Pick[data, Unitize[Clip[dataEval[[All, 1]], {0, 0}, {0, 1}]], 1], {1000}] // Timing Do[r2 = data[[Pick[Range[Length[data]], dataEval[[All, 1]], x_ /; x > 0]]], {1000}] // Timing Do[r3 = Pick[data, dataEval[[All, 1]], Except[0, _Integer]], {1000}] // Timing Do[r4 = Pick[data, dataEval[[All, 1]], x_ /; x > 0], {1000}] // Timing Do[r5 = Extract[data,Position[dataEval[[All, 1]], x_ /; x > 0]], {1000}] // Timing r1 == r2 == r3 == r4 == r5 The winner fluctuates based on the size of data.