Skip to content

Instantly share code, notes, and snippets.

@wrhall
Last active December 26, 2015 06:08
Show Gist options
  • Save wrhall/7105158 to your computer and use it in GitHub Desktop.
Save wrhall/7105158 to your computer and use it in GitHub Desktop.
Fast, low-dependency dot product in Python
from itertools import imap
import operator
def dot_prod(v1, v2):
return sum(imap(operator.mul, v1, v2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment