Map ordering in `ufunc_intersection`
Closed this issue · 3 comments
damonge commented
I find that the two maps m_a
and m_b
below are the same:
m_a = hsp.ufunc_intersection([m2, m1], np.divide, filler_value=1.)
m_b = hsp.ufunc_intersection([m1, m2], np.divide, filler_value=1.)
which shouldn't be the case because a/b != b/a
.
erykoff commented
This is an interesting case. The problem appears to be because the concept of a "filler value" doesn't really make sense with division; what both are doing in this case is computing 1 / m1 / m2
which is indeed equal to 1 / m2 / m1
(and neither of these is the desired result!).
A way around this is to use multiplication instead of division. In a quick test, this works:
m_a = hsp.product_intersection([m2, m1**-1])
m_b = hsp.product_intersection([m1, m2**-1])
fjaviersanchez commented
erykoff commented
I think this could be closed.