Exemple #1
0
 def test_no_permutation_pattern(self):
     """Tests that an error is raised when when
     the linear function is not a permutation."""
     mat = [[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0]]
     linear_function = LinearFunction(mat)
     with self.assertRaises(CircuitError):
         linear_function.permutation_pattern()
Exemple #2
0
 def test_permutation_pattern(self):
     """Tests that a permutation pattern is returned correctly when
     the linear function is a permutation."""
     mat = [[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0]]
     linear_function = LinearFunction(mat)
     pattern = linear_function.permutation_pattern()
     self.assertIsInstance(pattern, np.ndarray)