def unify_test(self): """Test if the matrix is unified correctly.""" rows = 3 data = [[0], [4], [3]] vector = Vector(rows) vector.initialize(data, rowBased=True) exRes = [[0, 4 / 5.0, 3 / 5.0]] res = vector.unify() self.assertEqual(res.matrix, exRes)
def unify_test(self): """Test if the matrix is unified correctly.""" rows = 3 data = [[0], [4], [3]] vector = Vector(rows) vector.initialize(data, rowBased=True) exRes = [[0, 4 / 5.0, 3 / 5.0]] res = vector.unify() self.assertEqual(res.matrix, exRes)
def norm_test(self): """Test the length calculation of a Vector.""" rows = 3 data = [[6], [4], [5]] vector = Vector(rows) vector.initialize(data, rowBased=True) exRes = 8.774964387392123 res = vector.norm() self.assertEqual(res, exRes)
def norm_test(self): """Test the length calculation of a Vector.""" rows = 3 data = [[6], [4], [5]] vector = Vector(rows) vector.initialize(data, rowBased=True) exRes = 8.774964387392123 res = vector.norm() self.assertEqual(res, exRes)