def dotmany(A, B, leftfunc=None, rightfunc=None, **kwargs):
 if leftfunc:
  A = map(leftfunc, A)
 if rightfunc:
  B = map(rightfunc, B)
 return sum(map(partial(np.dot, **kwargs), A, B))

def dotmany ( A , B , leftfunc = None , rightfunc = None , ** kwargs ) : if leftfunc : A = map ( leftfunc , A ) if rightfunc : B = map ( rightfunc , B ) return sum ( map ( partial ( np . dot , ** kwargs ) , A , B ) )
dot product of many aligned chunks .