Timeline for How do I obtain an intersection of two or more list of lists conditioned on the first element of each sub-list?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Aug 25, 2013 at 8:43 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 444 characters in body
|
Aug 25, 2013 at 8:15 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 1006 characters in body
|
Jul 31, 2013 at 14:42 | vote | accept | Phillip Dukes | ||
Jul 31, 2013 at 14:41 | vote | accept | Phillip Dukes | ||
Jul 31, 2013 at 14:42 | |||||
Dec 17, 2012 at 7:35 | comment | added | Mike Honeychurch |
Yes Pick will generally provide a much faster solution than e.g. Cases /Select if you can develop a Pick method.
|
|
Dec 17, 2012 at 7:24 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 75 characters in body
|
Dec 17, 2012 at 7:10 | comment | added | Mr.Wizard |
@Mike Alternatives test quite a bit faster than MemberQ for me. For pure speed this seems best of what I've tried: Pick[#, First /@ #, Alternatives @@ inter] & @ Join[a, b] where inter is the first elements intersection.
|
|
Dec 17, 2012 at 6:57 | comment | added | Mike Honeychurch |
Looks fine to me. Would be interested to know how Apply Alternative compares with the MemberQ test for larger lists. I normally use Alternative but forgot all about it when I wrote my answer
|
|
Dec 17, 2012 at 6:56 | comment | added | Mike Honeychurch |
For those of us who cannot read infix: f2[a_, b_] := ({#1[[1, 1]], #1[[All, 2]]} & ) /@ GatherBy[ Cases[Join[a, b], {Alternatives @@ Intersection[a[[All, 1]], b[[All, 1]]], _}], First]
|
|
Dec 17, 2012 at 6:40 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 160 characters in body
|
Dec 17, 2012 at 6:19 | history | answered | Mr.Wizard | CC BY-SA 3.0 |