예제 #1
0
파일: matrixtest.py 프로젝트: T-002/pycast
 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)
예제 #2
0
파일: matrixtest.py 프로젝트: T-002/pycast
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 def initialize_from_matrix_test(self):
     """Test to create a Vector from a specified column of a Matrix."""
     rows = 3
     cols = 2
     data = [[1, -4], [-2, 5], [3, 6]]
     # build Matrix
     matrix = Matrix(cols, rows)
     matrix.initialize(data, rowBased=True)
     # Create Vektor with the 2nd column of the matrix
     vector = Vector.initialize_from_matrix(matrix, 1)
     exRes = [[-4, 5, 6]]
     self.assertEqual(vector.matrix, exRes)
예제 #6
0
파일: matrixtest.py 프로젝트: T-002/pycast
 def initialize_from_matrix_test(self):
     """Test to create a Vector from a specified column of a Matrix."""
     rows = 3
     cols = 2
     data = [
                 [1, -4],
                 [-2, 5],
                 [3, 6]
             ]
     # build Matrix
     matrix = Matrix(cols, rows)
     matrix.initialize(data, rowBased=True)
     # Create Vektor with the 2nd column of the matrix
     vector = Vector.initialize_from_matrix(matrix, 1)
     exRes = [[-4, 5, 6]]
     self.assertEqual(vector.matrix, exRes)
예제 #7
0
파일: matrixtest.py 프로젝트: T-002/pycast
 def init_test(self):
     """Test the initialization of a Vector."""
     rows = random.randint(1, 1000)
     vector = Vector(rows)
     self.assertEqual(vector.get_height(), rows)
예제 #8
0
 def init_test(self):
     """Test the initialization of a Vector."""
     rows = random.randint(1, 1000)
     vector = Vector(rows)
     self.assertEqual(vector.get_height(), rows)