[Numpy-discussion] in the NA discussion, what can we agree on?

Benjamin Root ben.root@ou....
Fri Nov 4 22:45:00 CDT 2011


On Fri, Nov 4, 2011 at 10:33 PM, T J <tjhnson@gmail.com> wrote:

> On Fri, Nov 4, 2011 at 8:03 PM, Nathaniel Smith <njs@pobox.com> wrote:
>
>> On Fri, Nov 4, 2011 at 7:43 PM, T J <tjhnson@gmail.com> wrote:
>> > On Fri, Nov 4, 2011 at 6:31 PM, Pauli Virtanen <pav@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.
>
>
>
This scheme is actually somewhat intriguing.  Not totally convinced, by
intrigued.  Unfortunately, I fell behind in the postings by having
dinner... We probably should start a new thread soon with a bunch of this
stuff solidified and stated to give others a chance to hop back into the
game. Maybe a table of some sort with pros/cons (mathematically speaking,
deferring implementation details for later).

I swear, if we can get this to make sense... we should have a Nobel prize
or something.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20111104/0d263a9c/attachment-0001.html 


More information about the NumPy-Discussion mailing list