[Matrix-SIG] Bug in matrixmultiply

Paul F. Dubois dubois1@llnl.gov
Fri, 15 Oct 1999 11:02:21 -0700


My opinion is that the behavior of matrixmultiply is a bug; it should raise
an exception.
The behavior Robin notes for plain * is correct and intentional.

----- Original Message -----
From: Robin Becker <robin@jessikat.demon.co.uk>
To: <matrix-sig@python.org>
Sent: Friday, October 15, 1999 3:27 AM
Subject: Re: [Matrix-SIG] Bug in matrixmultiply


> In article <Pine.LNX.4.10.9910151038320.4104-100000@laplace>, Mikkel
> Bollinger <mbolling@fysik.dtu.dk> writes
> >I have been using the NumPy-package and I believe I found a bug using
> >the function "matrixmultiply":
> >
> >>>> c=asarray([[0,1,0],[0,0,0],[0,0,0]])
> >>>> matrixmultiply(5,c)
> >array([[0, 0, 0],
> >       [5, 0, 0],
> >       [0, 0, 0]])
> >
> >and
> >
> >>>> matrixmultiply(c,5)
> >array([[0, 5, 0],
> >       [0, 0, 0],
> >       [0, 0, 0]])
> >
> >When multiplying with a constant, matrixmultiply should either raise an
> >error message or interpret "5" as 5*unitmatrix. However it should not
> >transpose the output matrix as is the case for matrixmultiply(5,c).
> >Regards,
> >Mikkel Bollinger
> >
> yes I agree. Interestingly
> >>> c*5
> array([[0, 5, 0],
>        [0, 0, 0],
>        [0, 0, 0]])
> >>> 5*c
> array([[0, 5, 0],
>        [0, 0, 0],
>        [0, 0, 0]])
> >>>
> --
> Robin Becker
>
> _______________________________________________
> Matrix-SIG maillist  -  Matrix-SIG@python.org
> http://www.python.org/mailman/listinfo/matrix-sig
>