[Numpy-discussion] Upgrading from numpy 0.9.7.2416 to 0.9.9.2683
Keith Goodman
kwgoodman at gmail.com
Tue Jun 27 13:44:06 CDT 2006
On 6/27/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> Keith Goodman wrote:
> > This works in numpy 0.9.7.2416 but doesn't work in numpy 0.9.9.2683:
> >
> > Numpy 0.9.9.2683
> >
> > x = asmatrix(zeros((3,2), float))
> > y = asmatrix(rand(3,1))
> > y
> >
> > matrix([[ 0.49865026],
> > [ 0.82675808],
> > [ 0.30285247]])
> >
> > x[:,1] = y > 0.5
> > x
> >
> > matrix([[ 0., 0.],
> > [ 0., 0.], <--- this should be one (?)
> > [ 0., 0.]])
> >
> >
>
> This looks like a bug, probably introduced recently during the re-write
> of the copying and casting code. Try checking out the revisions r2662
> and r2660 to see which one works for you. I'll look into this problem.
Thanks for the tip. I get some extra output with r2660. It prints out
"Source array" and "Dest. array" like this:
>> x = asmatrix(zeros((3,2), float))
>> x
matrix([[ 0., 0.],
[ 0., 0.],
[ 0., 0.]])
>> y = asmatrix(rand(3,1))
>> y
matrix([[ 0.60117193],
[ 0.43883293],
[ 0.01633154]])
>> x[:,1] = y > 0.5
Source array = (3 1)
Dest. array = (1 3)
>> x
matrix([[ 0., 1.],
[ 0., 0.],
[ 0., 0.]])
More information about the Numpy-discussion
mailing list