[Numpy-discussion] Bug? numpy.matrix.sum()
Norbert Nemec
Norbert.Nemec.list at gmx.de
Fri Jan 20 00:22:02 CST 2006
Is it just me who finds this confusing? There is some bug there, but I
cannot even say what it is supposed to behave like...
---------------------------------
In [1]: import numpy
In [2]: numpy.__version__
Out[2]: '0.9.2'
In [3]: a = numpy.matrix(numpy.eye(2))
In [4]: a.sum()
Out[4]: matrix([[1, 0, 0, 1]])
In [5]: a.A.sum()
Out[5]: 2
In [6]: sum(a)
Out[6]: matrix([[1, 1]])
In [7]: sum(a.A)
Out[7]: array([1, 1])
---------------------------------
More information about the Numpy-discussion
mailing list