[Numpy-discussion] Matrix times scalar is wacky

Travis Oliphant oliphant.travis at ieee.org
Fri Feb 24 01:59:02 CST 2006


Bill Baxter wrote:

> Multiplying a matrix times a scalar seems to return junk for some reason:
>
> >>> A = numpy.asmatrix(numpy.rand(1,2))
> >>> A
> matrix([[ 0.30604211,  0.98475225]])
> >>> A * 0.2
> matrix([[  6.12084210e-002,   7.18482614e-290]])
> >>> 0.2 * A
> matrix([[  6.12084210e-002,   7.18482614e-290]])
> >>> numpy.__version__

Unfortunately, there are still some bugs in the scalar multiplication 
section of _dotblas.c  stemming from a re-write that allows 
discontiguous matrices.  We are still tracking down the problems.   
Hopefully this should be fixed soon.

-Travis





More information about the Numpy-discussion mailing list