Exemple #1
0
 def test_vector(self):
     v1 = Vector(self.list1)
     v2 = Vector(2*x for x in self.list1)
     self.assertEqual(2*v1, v2)
     n1 = np.fromiter(v1, int)
     n2 = np.fromiter(v2, int)
     self.assertEqual(v1.dot(v2), np.dot(n1,n2))
Exemple #2
0
 def test_dot(self):
     v1 = Vector(self.list1)
     v2 = Vector(self.list2)
     n1 = np.fromiter(v1, int)
     n2 = np.fromiter(v2, int)
     self.assertEqual(v1.dot(v2), np.dot(n1,n2))
Exemple #3
0
 def test_norm(self):
     v1 = Vector(self.list1)
     n1 = np.fromiter(v1, int)
     p = random.choice([1,2,3]) 
     self.assertEqual(v1.norm(p), la.norm(n1,p))