[Numpy-discussion] bug: matrix.std() and matrix.var()
Keith Goodman
kwgoodman at gmail.com
Tue May 2 11:47:05 EDT 2006
On 5/2/06, Vlad Popovici <dr.popovici at gmail.com> wrote:
> 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
That might have been fixed recently in SVN. Have a look at this thread:
http://sourceforge.net/mailarchive/forum.php?thread_id=10254986&forum_id=4890
>> m = matrix(arange(1,10)).reshape(3,3)
>> m.std()
matrix([[ 2.73861279]])
>> m.var()
matrix([[ 7.5]])
>> numpy.__version__
'0.9.7.2435'
More information about the NumPy-Discussion
mailing list