2008/5/25 Anne Archibald <[EMAIL PROTECTED]>:
> 2008/5/25 Charles R Harris <[EMAIL PROTECTED]>:
>
>> So, please tell me how numpy is supposed to work. Write as much as you
>> please. If you are so moved, why not write the tests for all 64 ufuncs for
>> all types and combinations and verify that the
On Sun, May 25, 2008 at 11:30 AM, Anne Archibald <[EMAIL PROTECTED]>
wrote:
> 2008/5/25 Charles R Harris <[EMAIL PROTECTED]>:
>
> > So, please tell me how numpy is supposed to work. Write as much as you
> > please. If you are so moved, why not write the tests for all 64 ufuncs
> for
> > all types
2008/5/25 Charles R Harris <[EMAIL PROTECTED]>:
> So, please tell me how numpy is supposed to work. Write as much as you
> please. If you are so moved, why not write the tests for all 64 ufuncs for
> all types and combinations and verify that they are all correct as specified
> and raise errors wh
On Sat, May 24, 2008 at 11:14 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
> It used to be stay in type and has been changed, and I don't disagree with
> that, it was discussed on the list. Nevertheless, booleans are different,
> both their own kind and integers. But my problem is not convenien
On Sat, May 24, 2008 at 10:08 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> > On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <[EMAIL PROTECTED]>
> wrote:
> >> If you want bools, change the accumulator dtype::
> >>>>> x.sum(dtype=bool)
>
>
> On Sat, 24 May 2008, Charles R Harris apparently wrote
On Sat, May 24, 2008 at 10:00 PM, Nathan Bell <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:48 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> > You can't overflow in modular arithmetic, which is how numpy is supposed
> to
> > work. Try
> >
> > In [51]: x
> > Out[51]: array([2147
> On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
>> If you want bools, change the accumulator dtype::
>>>>> x.sum(dtype=bool)
On Sat, 24 May 2008, Charles R Harris apparently wrote:
> Shouldn't that be the other way round? If you want integers, do
> x.sum(dtype=int
On Sat, May 24, 2008 at 9:50 PM, Nathan Bell <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:40 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> > The question is consistency. A programmer should just have to remember a
> few
> > simple rules, not a host of special cases. It makes t
On Sat, May 24, 2008 at 10:48 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> You can't overflow in modular arithmetic, which is how numpy is supposed to
> work. Try
>
> In [51]: x
> Out[51]: array([2147483647, 2147483647])
>
> In [52]: x.sum()
> Out[52]: -2
>
I would call that an overflow.
H
On Sat, May 24, 2008 at 10:40 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> The question is consistency. A programmer should just have to remember a few
> simple rules, not a host of special cases. It makes things easier to learn
> and the code easier to understand because the intent is alway
On Sat, May 24, 2008 at 9:40 PM, Nathan Bell <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:32 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> > But the accumalator is of the same kind unless the kind is boolean, in
> which
> > case it is integer. Clear as a bell.
> >
>
> I believ
On Sat, May 24, 2008 at 10:32 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> But the accumalator is of the same kind unless the kind is boolean, in which
> case it is integer. Clear as a bell.
>
I believe the rule is that any integer type smaller than the machine
word size is effectively upca
On Sat, May 24, 2008 at 9:35 PM, Nathan Bell <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:24 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > Shouldn't that be the other way round? If you want integers, do
> > x.sum(dtype=int). Ints don't sum in float64 by default.
> >
>
>
On Sat, May 24, 2008 at 10:24 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
>
> Shouldn't that be the other way round? If you want integers, do
> x.sum(dtype=int). Ints don't sum in float64 by default.
>
The default behavior (x.sum() -> int) is more useful than (x.sum() ->
bool) since x.any()
On Sat, May 24, 2008 at 9:18 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:12 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> > On Sat, May 24, 2008 at 9:06 PM, Robert Kern <[EMAIL PROTECTED]>
> wrote:
> >>
> >> On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
>
On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> On Sat, 24 May 2008, Keith Goodman apparently wrote:
> >>> x = np.array([True, True], dtype=bool)
> >>> x.sum()
> >2
>
>
>
> If you want bools, change the accumulator dtype::
>
>>>> x.sum(dtype=bool)
Shouldn't tha
On Sat, May 24, 2008 at 10:12 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> On Sat, May 24, 2008 at 9:06 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
>> <[EMAIL PROTECTED]> wrote:
>> > So what about the rule that the array type takes prec
On Sat, 24 May 2008, Keith Goodman apparently wrote:
>>> x = np.array([True, True], dtype=bool)
>>> x.sum()
>2
If you want bools, change the accumulator dtype::
>>> x.sum(dtype=bool)
True
Cheers,
Alan Isaac
___
Numpy-discussion mailin
On Sat, May 24, 2008 at 10:15 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> On Sat, May 24, 2008 at 9:11 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, May 24, 2008 at 10:06 PM, Robert Kern <[EMAIL PROTECTED]>
>> wrote:
>> > On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
>> > <[
On Sat, May 24, 2008 at 9:11 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:06 PM, Robert Kern <[EMAIL PROTECTED]>
> wrote:
> > On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
> > <[EMAIL PROTECTED]> wrote:
> >> So what about the rule that the array type takes precedenc
On Sat, May 24, 2008 at 9:06 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> > So what about the rule that the array type takes precedence over the
> scalar
> > type? That is broken for booleans.
>
> Yes, and if it wasn
On Sat, May 24, 2008 at 10:06 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
>> So what about the rule that the array type takes precedence over the scalar
>> type? That is broken for booleans.
>
> Yes, and if it wasn't a
On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
> So what about the rule that the array type takes precedence over the scalar
> type? That is broken for booleans.
Yes, and if it wasn't an intentional special case (I don't recall
discussing it on the list, but it might
On Sat, May 24, 2008 at 8:59 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 9:45 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >> I'm not sure why you're showing me numpy C code. I am talking about
> >> the Python bools True and False.
> >
> > Because I'm talking about
On Sat, May 24, 2008 at 9:57 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
> How about
>
> In [14]: x += 5
>
> In [15]: x
> Out[15]: array([ True, True], dtype=bool)
Output = bool.
> In [16]: x.tostring()
> Out[16]: '\x01\x01'
>
>
> In [17]: x + 5
> Out[17]: array([6, 6])
Output != bool.
> I
On Sat, May 24, 2008 at 9:45 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>> I'm not sure why you're showing me numpy C code. I am talking about
>> the Python bools True and False.
>
> Because I'm talking about ufuncs. The original question was about ufuncs
> and, since array booleans are not tr
On Sat, May 24, 2008 at 8:48 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 9:46 PM, Keith Goodman <[EMAIL PROTECTED]>
> wrote:
> > On Sat, May 24, 2008 at 7:36 PM, Robert Kern <[EMAIL PROTECTED]>
> wrote:
> >> On Sat, May 24, 2008 at 9:28 PM, Keith Goodman <[EMAIL PROTECTED]
On Sat, May 24, 2008 at 9:46 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 7:36 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>> On Sat, May 24, 2008 at 9:28 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
>>> I think it's interesting how python and numpy bools behave differently
On Sat, May 24, 2008 at 7:36 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 9:28 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
>> I think it's interesting how python and numpy bools behave differently.
>>
x = np.array([True, True], dtype=bool)
x[0] + x[1]
>> True
>>
On Sat, May 24, 2008 at 8:40 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 9:37 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Sat, May 24, 2008 at 8:25 PM, Robert Kern <[EMAIL PROTECTED]>
> wrote:
> >>
> >> On Sat, May 24, 2008 at 9:09 PM, Charles R Harris
On Sat, May 24, 2008 at 9:37 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
>
> On Sat, May 24, 2008 at 8:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, May 24, 2008 at 9:09 PM, Charles R Harris
>> <[EMAIL PROTECTED]> wrote:
>> >
>> > On Sat, May 24, 2008 at 7:47 PM, Robert Kern <[E
On Sat, May 24, 2008 at 8:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 9:09 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> >
> > On Sat, May 24, 2008 at 7:47 PM, Robert Kern <[EMAIL PROTECTED]>
> wrote:
> >>
> >> On Sat, May 24, 2008 at 8:31 PM, Charles R Harris
> >
On Sat, May 24, 2008 at 9:28 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
> I think it's interesting how python and numpy bools behave differently.
>
>>> x = np.array([True, True], dtype=bool)
>>> x[0] + x[1]
> True
>>> x[0] & x[1]
> True
>>>
>>> x = [True, True]
>>> x[0] + x[1]
> 2
>>> x[0]
On Sat, May 24, 2008 at 7:09 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
>
> On Sat, May 24, 2008 at 7:47 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, May 24, 2008 at 8:31 PM, Charles R Harris
>> <[EMAIL PROTECTED]> wrote:
>> > Hi All,
>> >
>> > I'm writing tests for ufuncs and tu
On Sat, May 24, 2008 at 9:09 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
>
> On Sat, May 24, 2008 at 7:47 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, May 24, 2008 at 8:31 PM, Charles R Harris
>> <[EMAIL PROTECTED]> wrote:
>> > Hi All,
>> >
>> > I'm writing tests for ufuncs and turn
On Sat, May 24, 2008 at 7:47 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Sat, May 24, 2008 at 8:31 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> > I'm writing tests for ufuncs and turned up some oddities:
> >
> > In [4]: degrees(True)
> > Out[4]: 57.29578
> >
> > In [5]:
On Sat, May 24, 2008 at 8:31 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm writing tests for ufuncs and turned up some oddities:
>
> In [4]: degrees(True)
> Out[4]: 57.29578
>
> In [5]: radians(True)
> Out[5]: 0.017453292
>
> In [6]: sin(True)
> Out[6]: 0.84147096
>
> Do we want
On Sat, May 24, 2008 at 7:31 PM, Charles R Harris <[EMAIL PROTECTED]>
wrote:
> Hi All,
>
> I'm writing tests for ufuncs and turned up some oddities:
>
> In [4]: degrees(True)
> Out[4]: 57.29578
>
> In [5]: radians(True)
> Out[5]: 0.017453292
>
> In [6]: sin(True)
> Out[6]: 0.84147096
>
> Do we wan
Hi All,
I'm writing tests for ufuncs and turned up some oddities:
In [4]: degrees(True)
Out[4]: 57.29578
In [5]: radians(True)
Out[5]: 0.017453292
In [6]: sin(True)
Out[6]: 0.84147096
Do we want numeric functions to apply to booleans?
Chuck
___
Nump
39 matches
Mail list logo