# HG changeset patch # User Jeff Hammel # Date 1504194636 25200 # Node ID bb8b6b06ca83e3781564610a4fd24899f85b1f0c # Parent be09c8fc58b8334b9b868c1349584b6e309a8766 dot product diff -r be09c8fc58b8 -r bb8b6b06ca83 setup.py --- a/setup.py Wed Aug 30 20:44:48 2017 -0700 +++ b/setup.py Thu Aug 31 08:50:36 2017 -0700 @@ -5,7 +5,7 @@ import os version = "0.0" -dependencies = ['MakeItSo', 'webob'] +dependencies = ['numpy'] # allow use of setuptools/distribute or distutils kw = {} diff -r be09c8fc58b8 -r bb8b6b06ca83 tests/test_dot.py --- a/tests/test_dot.py Wed Aug 30 20:44:48 2017 -0700 +++ b/tests/test_dot.py Thu Aug 31 08:50:36 2017 -0700 @@ -5,13 +5,16 @@ """ import unittest - +from tvii.dot import dot class TestDot(unittest.TestCase): def test_simple(self): """simple dot product test""" - # TODO + + a = [1, 2, 3] + b = [4, 5, 6] + expected = 32 if __name__ == '__main__': unittest.main() diff -r be09c8fc58b8 -r bb8b6b06ca83 tvii/dot.py --- a/tvii/dot.py Wed Aug 30 20:44:48 2017 -0700 +++ b/tvii/dot.py Thu Aug 31 08:50:36 2017 -0700 @@ -5,4 +5,4 @@ def dot(w, x): """inner dot product""" assert len(w) == len(x) - raise NotImplementedError('TODO') + return sum([a*b for a, b in zip(w,x)])