[SciPy-user] matrix mult operator
Mon Jun 25 10:47:28 CDT 2007
don't you think that numpy way of handling matrix multiplication is too
suppose I have
F = A . (B . C)^T . D + C . ((D . B)^T * A) (last is elementwise
multiplication, '.' are matrix mult)
then I must do
from numpy import mdot, dot # Also, I'm not fond of writing such
lines each time
return mdot(A, dot(B, C).T, D) + dot(C, dot(D, B).T * A)
it's very long to read, especially if I have much longer lines
what about an operator, something like !* or *!
def evalF(A,B,C, D):
return A !* (B !* C).T !* D + C !* (D !* B).T * A
it's much more readable.
Of course, you can wait till Python will support unicode, but as for me
I would prefere not to wait so long.
I know that there had been already some discussions about the matrix
multiplication, but I decided to rise the question once again, because
mdot() turned out to not solve all problems. Also, I think the names
'dot'/ 'mdot' are inappropriate ones, because it is sound like 'dotwise'
More information about the SciPy-user