numpy array, strangeness

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Feb 28 15:30:35 CET 2003


>>>>> "Alex" == Alex Martelli <aleax at aleax.it> writes:

    Alex> What you need is MATRIX multiplication, which in Numeric is
    Alex> performed by function Numeric.matrixmultiply, also known as
    Alex> Numeric.dot.

or use the numeric Matrix class which overrides the multiplication
operator to do matrix/vector multiplication

>>> from Matrix import Matrix
>>> A = Matrix([ [1,2,3,4], [5,6,7,8]])
>>> B = Matrix([ [1,2,1], [3,4,1], [5,6,1], [7,8,1]])
>>>
>>> A*B
Matrix([[ 50,  60,  10],
       [114, 140,  26]])

John






More information about the Python-list mailing list