[Python-Dev] Matrix product

daniel.stutzbach at gmail.com daniel.stutzbach at gmail.com
Sat Jul 26 18:23:11 CEST 2008


The desire for a new operator for matrix mutltiplication is because
binary prefix operators are horrible for expressin this kind of thing,
right?

Stuff like this is hard to write, read, and debug (especially when
checking it against an infix formula):

mmul(mmul(mmul(a, b), c), d)

How about just making a matrix multiply function that can take many
arguments?  I think this is pretty readable:

mmul(a, b, c, d)

Additionally, mmul could then optimize the order of the
multiplications (e.g., depending the dimensions of the matrices, it
may be much more efficient to perform a*((b*c)*d) rather than
((a*b)*c)*d).

(please forgive typos--writing this on a smartphone)

--
Daniel Stutzbach


More information about the Python-Dev mailing list