scalar object bug or feature?

Alan G Isaac aisaac at american.edu
Wed Oct 18 15:25:30 CDT 2006


On Wed, 18 Oct 2006, Keith Goodman apparently wrote: 
> Here's an example: 
>>> x = zeros((300, 300)) 
>>> x = x > 1   # False 
>>> x = 1 - x    # ones 
>>> y = x.T * x 
>>> y[0,0] 
> 44 


Here's a simpler (?) example:
>>> x=numpy.random.rand(300,1)>0
>>> x.sum()
300
>>> sum(x)
array([44], dtype=int8)
>>> x=numpy.random.rand(300)>0
>>> sum(x)
300

Alan Isaac



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list