From: Travis O. <oli...@ee...> - 2006-11-01 21:51:44
|
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) <------- float32 > > >>>1.0*x >>> >>> > >matrix([[ 1.], > [ 1.], > [ 1.]]) <-------- float64 > > > >>>numpy.__version__ >>> >>> >'1.0rc1' > >Any chance that 1.0 - x could return dtype = float64? > > 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 producing float64, however. I'm still not sure what's causing it, though. -Travis |