[Numpy-discussion] bug: matrix.std() and matrix.var()

Vlad Popovici dr.popovici at gmail.com
Tue May 2 07:27:04 EDT 2006


Hi,

It seems to me that there is a bug in the matrix code: both methods std()
and var() fail with
"ValueError: matrices are not aligned" exception. Note that the same methods
for array objects work correctly.
I am using NumPy version 0.9.7.

Example:
>>> m = matrix(arange(1,10)).reshape(3,3)
>>> m.std()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/numpy/core/defmatrix.py", line 149,
in __mul__
    return N.dot(self, other)
ValueError: matrices are not aligned
>>> asarray(m).std()
2.7386127875258306

Temporarily, I can use asarray() to get the right values, but this should be
corrected.

Best wishes,

Vlad

--
Vlad POPOVICI, PhD.
Swiss Institute for Bioinformatics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060502/960eb45b/attachment.html>


More information about the NumPy-Discussion mailing list