On Fri, Nov 4, 2011 at 8:03 PM, Nathaniel Smith <n...@pobox.com> wrote:
> On Fri, Nov 4, 2011 at 7:43 PM, T J <tjhn...@gmail.com> wrote: > > On Fri, Nov 4, 2011 at 6:31 PM, Pauli Virtanen <p...@iki.fi> wrote: > >> An acid test for proposed rules: given two arrays `a` and `b`, > >> > >> a = [1, 2, IGNORED(3), IGNORED(4)] > >> b = [10, IGNORED(20), 30, IGNORED(40)] > [...] > > (A1) Does unmask(a+b) == unmask(b + a) ? > > > > Yes. They both equal: > > > > unmask([11, IGNORED(22), IGNORED(33), IGNORED(44)]) > > = > > [11, 22, 33, 44] > > Again, I really don't think you're going to be able to sell an API where > [2] + [IGNORED(20)] == [IGNORED(22)] > I mean, it's not me you have to convince, it's Gary, Pierre, maybe > Benjamin, LluĂs, etc. So I could be wrong. But you might want to > figure that out first before making plans based on this... > But this is how np.ma currently does it, except that it doesn't compute the payload---it just calls it IGNORED. And it seems that this generalizes the way people want it to: >>> z = [2, 4] + [IGNORED(20), 3] >>> z [IGNORED(24), 7] >>> z.sum(skip_ignored=True) # True could be the default 7 >>> z.sum(skip_ignored=False) IGNORED(31) I guess I am confused because it seems that you implicitly used this same rule here: Say we have >>> a = np.array([1, IGNORED(2), 3]) >>> b = np.array([10, 20, 30]) (Here's I'm using IGNORED(2) to mean a value that is currently ignored, but if you unmasked it it would have the value 2.) Then we have: # non-propagating **or** propagating, doesn't matter: >>> a + 2 [3, IGNORED(2), 5] That is, element-wise, you had to have done: IGNORED(2) + 2 --> IGNORED(2). I said it should be equal to IGNORED(4), but the result is still some form of ignore. Sorry if I am missing the bigger picture at this point....its late and a Fri.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion