You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like #78, it is sufficient to define only argchoose in C++; we can add chose in Python.
This takes only one array and computes the per-element upper triangle of combinations of that array with itself. It is "choosing without replacement." For example,
The parameter, n >= 2, is the number of fields the output tuples should have. Choosing with n=3 is different from choosing with n=2 and then cross on the output: choose selects the upper diagonal in an n-dimensional matrix of possibilities. For example,
>>>second.choose(3)
<JaggedArray [[] [] [(d, e, f)]] at0x7fc91ccce590>
is not the same as
>>>second.choose(2).cross(second)
<JaggedArray [[(a, b, a) (a, b, b)] [] [(d, e, d) (d, e, e) (d, e, f) ... (e, f, d) (e, f, e) (e, f, f)]] at0x7fc91cc6add0>
because the latter doesn't eliminate duplicates like (a, b, a). The only way to pick three letters without duplicates is if the original array had three elements, like ["d", "e", "f"] in second[2] (which is why it's the only non-empty result of second.choose(3).
This and cross (issue #78) are the two basic generators of particle combinatorics in HEP analyses.
The text was updated successfully, but these errors were encountered:
I don't know whether we need/want the same axis default for all functions. For something like flatten, the usual case is axis=0, but for a reducer, the usual case is axis=-1. The first most important thing is that axis works the same way/means the same thing for all functions. Maybe they should also have the same default. Maybe not. I don't know how confusing it would be to users if they have different defaults. (Or no defaults? No, that's too extreme.)
Like #78, it is sufficient to define only
argchoose
in C++; we can addchose
in Python.This takes only one array and computes the per-element upper triangle of combinations of that array with itself. It is "choosing without replacement." For example,
The parameter,
n >= 2
, is the number of fields the output tuples should have. Choosing withn=3
is different from choosing withn=2
and thencross
on the output:choose
selects the upper diagonal in ann
-dimensional matrix of possibilities. For example,is not the same as
because the latter doesn't eliminate duplicates like
(a, b, a)
. The only way to pick three letters without duplicates is if the original array had three elements, like["d", "e", "f"]
insecond[2]
(which is why it's the only non-empty result ofsecond.choose(3)
.This and
cross
(issue #78) are the two basic generators of particle combinatorics in HEP analyses.The text was updated successfully, but these errors were encountered: