Last active
December 26, 2015 06:08
-
-
Save wrhall/7105158 to your computer and use it in GitHub Desktop.
Fast, low-dependency dot product in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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