Matrix multiplication: Difference between revisions
Content added Content deleted
(Improve algorithm and add link to original source) |
|||
Line 806: | Line 806: | ||
def MatrixMul( mtx_a, mtx_b): |
def MatrixMul( mtx_a, mtx_b): |
||
tpos_b = zip( *mtx_b) |
tpos_b = zip( *mtx_b) |
||
rtn = [[ sum( |
rtn = [[ sum( ea*eb for ea,eb in zip(a,b)) for b in tpos_b] for a in mtx_a] |
||
return rtn |
return rtn |
||