Skip to main content
added 266 characters in body
Source Link
user1066
  • 22.7k
  • 3
  • 36
  • 59
With[{x = longList[[All, 3]]}, Pick[longList, x, Min[x]]]

(* {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 54},
    {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91,51}, 
    {76, 14, 0, 70, 84}} *)

Original Answer

 Pick[longList, longList[[All, 3]], 
  Min[longList[[All, 3]]]] // AbsoluteTiming


(* {0.000064, {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 
   54}, {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91, 
   51}, {76, 14, 0, 70, 84}}} *)

Using longlist as defined by @rhermans

longList = RandomInteger[100, {1000,5}];

and

Select[longList, #[[3]] == Min[longList[[All, 3]]] &] == 
  Pick[longList, longList[[All, 3]], Min[longList[[All, 3]]]]

(* True *) 
Pick[longList, longList[[All, 3]], 
  Min[longList[[All, 3]]]] // AbsoluteTiming


(* {0.000064, {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 
   54}, {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91, 
   51}, {76, 14, 0, 70, 84}}} *)

Using longlist as defined by @rhermans

longList = RandomInteger[100, {1000,5}];

and

Select[longList, #[[3]] == Min[longList[[All, 3]]] &] == 
  Pick[longList, longList[[All, 3]], Min[longList[[All, 3]]]]

(* True *) 
With[{x = longList[[All, 3]]}, Pick[longList, x, Min[x]]]

(* {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 54},
    {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91,51}, 
    {76, 14, 0, 70, 84}} *)

Original Answer

 Pick[longList, longList[[All, 3]], 
  Min[longList[[All, 3]]]] // AbsoluteTiming


(* {0.000064, {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 
   54}, {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91, 
   51}, {76, 14, 0, 70, 84}}} *)

Using longlist as defined by @rhermans

longList = RandomInteger[100, {1000,5}];

and

Select[longList, #[[3]] == Min[longList[[All, 3]]] &] == 
  Pick[longList, longList[[All, 3]], Min[longList[[All, 3]]]]

(* True *) 
Post Undeleted by user1066
Post Deleted by user1066
Source Link
user1066
  • 22.7k
  • 3
  • 36
  • 59

Pick[longList, longList[[All, 3]], 
  Min[longList[[All, 3]]]] // AbsoluteTiming


(* {0.000064, {{4, 29, 0, 15, 40}, {31, 3, 0, 3, 61}, {86, 12, 0, 13, 
   54}, {48, 56, 0, 4, 94}, {19, 94, 0, 56, 28}, {90, 57, 0, 91, 
   51}, {76, 14, 0, 70, 84}}} *)

Using longlist as defined by @rhermans

longList = RandomInteger[100, {1000,5}];

and

Select[longList, #[[3]] == Min[longList[[All, 3]]] &] == 
  Pick[longList, longList[[All, 3]], Min[longList[[All, 3]]]]

(* True *)