changeset 7:bb8b6b06ca83

dot product
author Jeff Hammel <k0scist@gmail.com>
date Thu, 31 Aug 2017 08:50:36 -0700
parents be09c8fc58b8
children c907c8a103b4
files setup.py tests/test_dot.py tvii/dot.py
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 = {}
--- 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()
--- 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)])