def test_empty_matrix_set_to_unit_upper_tri_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.set_to_unit_upper_triangle_matrix([]))
Exemplo n.º 2
0
 def test_set_to_zero_function_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[0, 0, 0], [0, 0, 0]], practice.set_to_zero_unb(self.matrix_A))
Exemplo n.º 3
0
 def test_empty_matrix_A_scale_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.scale_marix([], self.alpha))
 def test_set_to_unit_upper_tri_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual([[1, 2, 3], [0, 1, -3], [0, 0, 1]],
                      practice.set_to_unit_upper_triangle_matrix(
                          self.matrix_A))
Exemplo n.º 5
0
 def test_empty_matrix_B_transpose_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.transpose(self.matrix_A, []))
Exemplo n.º 6
0
 def test_scale_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual([[4, -4, -2], [10, 2, -6], [-20, -40, 0]],
                      practice.scale_marix(self.matrix_A, self.alpha))
 def test_zero_matrix_set_to_strictly_upper_tri_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
         practice.set_to_strictly_lower_triangle_matrix(self.zero_matrix))
Exemplo n.º 8
0
 def test_zero_matrix_A_transpose_unb(self):
     practice = Week3Functions()
     self.assertEqual([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
                      practice.transpose(self.zero_matrix_A, self.matrix_B))
Exemplo n.º 9
0
 def test_set_to_zero_function(self):
     practice = Week3Functions()
     self.assertEqual([0, 0, 0], practice.setToZero(self.vector_x))
 def test_set_to_strictly_upper_tri_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[0, 0, 0], [-1, 0, 0], [3, 2, 0]],
         practice.set_to_strictly_lower_triangle_matrix(self.matrix_A))
Exemplo n.º 11
0
 def test_illegal_vector_set_to_zero_function_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED', practice.set_to_zero_unb(None))
Exemplo n.º 12
0
 def test_empty_vector_set_to_zero_function_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.set_to_zero_unb([]))
Exemplo n.º 13
0
 def test_already_zero_vector_set_to_zero_function_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[0, 0], [0, 0]], practice.set_to_zero_unb(self.zero_matrix))
Exemplo n.º 14
0
 def test_empty_matrix_set_to_diagonal_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.set_to_diagonal_unb([], self.vector_x))
 def test_lower_tri_symmetric_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[2, 1, -1], [1, 1, -3], [-1, -3, -1]],
         practice.set_symmetric_matrix(self.matrix_B))
Exemplo n.º 16
0
 def test_illegal_matrix_set_to_diagonal_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED',
                      practice.set_to_diagonal_unb(None, self.vector_x))
 def test_diagonal_symmetric_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
         practice.set_symmetric_matrix(self.diagonal_matric))
Exemplo n.º 18
0
 def test_zero_matrix_B_transpose_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[1, -1, 100], [2, -5, 90], [3, -10, 80], [4, -20, 3]],
         practice.transpose(self.matrix_A, self.zero_matrix_B))
 def test_zero_matrix_symmetric_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual(
         [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
         practice.set_symmetric_matrix(self.zero_matrix))
Exemplo n.º 20
0
 def test_illegal_matrix_B_transpose_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED', practice.transpose(self.matrix_A, None))
 def test_empty_matrix_symmetric_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual([], practice.set_symmetric_matrix([]))
Exemplo n.º 22
0
 def test_zero_alpha_scale_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual([[0, 0, 0], [0, 0, 0], [0, 0, 0]],
                      practice.scale_marix(self.matrix_A, 0))
 def test_illegal_matrix_symmetric_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED', practice.set_symmetric_matrix(None))
Exemplo n.º 24
0
 def test_illegal_matrix_B_scale_matrix_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED', practice.scale_marix(self.matrix_A, None))
Exemplo n.º 25
0
 def test_zero_vector_x_set_to_diagonal_unb(self):
     practice = Week3Functions()
     self.assertEqual([[0, 0, 0], [0, 0, 0], [0, 0, 0]],
                      practice.set_to_diagonal_unb(self.matrix_A,
                                                   [0, 0, 0]))
 def test_zero_matrix_set_to_unit_upper_tri_unb(self):
     practice = Week3Functions()
     self.assertEqual([[1, 0, 0], [0, 1, 0], [0, 0, 1]],
                      practice.set_to_unit_upper_triangle_matrix(
                          self.zero_matrix))
Exemplo n.º 27
0
 def test_zero_matrix_set_to_diagonal_unb(self):
     practice = Week3Functions()
     self.assertEqual([[1, 0, 0], [0, -2, 0], [0, 0, 10]],
                      practice.set_to_diagonal_unb(self.zero_matrix,
                                                   self.vector_x))
 def test_illegal_matrix_set_to_unit_upper_tri_unb(self):
     practice = Week3Functions()
     self.assertEqual('FAILED',
                      practice.set_to_unit_upper_triangle_matrix(None))
Exemplo n.º 29
0
 def test_string_vector_set_to_zero_function(self):
     practice = Week3Functions()
     self.assertEqual('FAILED', practice.setToZero(['a', 'b', 'c']))