From: Charles R H. <cha...@gm...> - 2006-11-02 03:19:46
|
On 11/1/06, Keith Goodman <kwg...@gm...> wrote: > > On 11/1/06, Travis Oliphant <oli...@ee...> 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 producing float64, however. I'm still not > > sure what's causing it, though. > > I think it would be great if float64 was the default in numpy. That > way most people wouldn't have to worry about dtypes when crunching > numbers. And then numpy could apply for a trademark on 'it just > works'. > > Having to worry about dtypes makes users (me) nervous. > > I imagine a change like this would not be an overnight change, more of > a long-term goal. > > This one, from a previous thread, also makes me nervous: > > >> sum(M.ones((300,1)) == 1) > matrix([[44]], dtype=int8) That one seems to be fixed: In [1]: sum(ones((300,1)) == 1) Out[1]: 300 In [2]: (ones((300,1)) == 1).sum() Out[2]: 300 The matrix version also returns a numpy scalar, however. In [20]: sum(matrix(ones((300,1)) == 1)) Out[20]: 300 I wonder if that is expected? Chuck |