Re: [Numpy-discussion] Converting bool to float

2006-11-02 Thread Tim Hochberg
Travis Oliphant wrote: > Robert Kern wrote: > > >> Tim Hochberg wrote: >> >> >> >>> Travis Oliphant wrote: >>> >>> >>> Robert Kern wrote: > Travis Oliphant wrote: > > > >> It looks like 1.0-x is doing

Re: [Numpy-discussion] Converting bool to float

2006-11-02 Thread Travis Oliphant
Robert Kern wrote: >Tim Hochberg wrote: > > >>Travis Oliphant wrote: >> >> >>>Robert Kern wrote: >>> >>> Travis Oliphant wrote: >It looks like 1.0-x is doing the right thing. > >The problem is 1.0*x for matrices is going to float64. For arrays it

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Charles R Harris
On 11/1/06, Robert Kern <[EMAIL PROTECTED]> wrote: Tim Hochberg wrote:> Travis Oliphant wrote: However, whether or not float32 arrays operated with Python float scalars givefloat32 or float64 arrays is tangential to my question. Does anyone actuallythink that a Python float operated with a boolean

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Robert Kern
Tim Hochberg wrote: > Travis Oliphant wrote: >> Robert Kern wrote: >>> Travis Oliphant wrote: It looks like 1.0-x is doing the right thing. The problem is 1.0*x for matrices is going to float64. For arrays it returns float32 just like the 1.0-x >>> Why is this t

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Scott Ransom
On Wed, Nov 01, 2006 at 08:16:59PM -0700, Tim Hochberg wrote: > Travis Oliphant wrote: > > Robert Kern wrote: > >> Travis Oliphant wrote: > >> > >>> It looks like 1.0-x is doing the right thing. > >>> > >>> The problem is 1.0*x for matrices is going to float64. For arrays it > >>> returns float32

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Charles R Harris
On 11/1/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: Travis Oliphant wrote:> Robert Kern wrote: Travis Oliphant wrote:>>> It looks like 1.0-x is doing the right thing.>>> >>> The problem is 1.0*x for matrices is going to float64.  For arrays it>>> returns float32 just like the 1.0-x>

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Charles R Harris
On 11/1/06, Keith Goodman <[EMAIL PROTECTED]> wrote: On 11/1/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:> It looks like 1.0-x is doing the right thing.>> The problem is 1.0*x for matrices is going to float64.  For arrays it > returns float32 just like the 1.0-x>> This can't be changed at this po

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Tim Hochberg
Travis Oliphant wrote: > Robert Kern wrote: > > >> Travis Oliphant wrote: >> >> >> >> >>> It looks like 1.0-x is doing the right thing. >>> >>> The problem is 1.0*x for matrices is going to float64. For arrays it >>> returns float32 just like the 1.0-x >>> >>> >>> >> Why is t

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Charles R Harris
On 11/1/06, Robert Kern <[EMAIL PROTECTED]> wrote: Travis Oliphant wrote:> It looks like 1.0-x is doing the right thing.>> The problem is 1.0*x for matrices is going to float64.  For arrays it> returns float32 just like the 1.0-xWhy is this the right thing? Python floats are float64. Same question

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Keith Goodman
On 11/1/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > It looks like 1.0-x is doing the right thing. > > The problem is 1.0*x for matrices is going to float64. For arrays it > returns float32 just like the 1.0-x > > This can't be changed at this point until 1.1 > > We will fix the bug in 1.0*x p

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Robert Kern wrote: >Travis Oliphant wrote: > > > >>It looks like 1.0-x is doing the right thing. >> >>The problem is 1.0*x for matrices is going to float64. For arrays it >>returns float32 just like the 1.0-x >> >> > >Why is this the right thing? Python floats are float64. > > Yeah, why

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Robert Kern
Travis Oliphant wrote: > It looks like 1.0-x is doing the right thing. > > The problem is 1.0*x for matrices is going to float64. For arrays it > returns float32 just like the 1.0-x Why is this the right thing? Python floats are float64. -- Robert Kern "I have come to believe that the whole

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Keith Goodman wrote: >I had a hard time tracing a bug in my code. The culprit was this difference: > > > >>>x >>> >>> > >matrix([[True], >[True], >[True]], dtype=bool) > > >>>1.0 - x >>> >>> > >matrix([[ 0.], >[ 0.], >[ 0.]], dtype=float32) <

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Keith Goodman wrote: >I had a hard time tracing a bug in my code. The culprit was this difference: > > > >>>x >>> >>> > >matrix([[True], >[True], >[True]], dtype=bool) > > >>>1.0 - x >>> >>> > >matrix([[ 0.], >[ 0.], >[ 0.]], dtype=float32) <

[Numpy-discussion] Converting bool to float

2006-11-01 Thread Keith Goodman
I had a hard time tracing a bug in my code. The culprit was this difference: >> x matrix([[True], [True], [True]], dtype=bool) >> 1.0 - x matrix([[ 0.], [ 0.], [ 0.]], dtype=float32) <--- float32 >> 1.0*x matrix([[ 1.], [ 1.], [ 1.]])