import operator
import itertools
def dot(x, y):
assert len(x) == len(y)
return sum(itertools.starmap(operator.mul, itertools.izip(x, y)))
def matmult(m, v):
return [dot(row, v) for row in m]
訂閱:
張貼留言
(
Atom
)
沒有留言 :
張貼留言