From 003a5b6e0990d8e38ed9690f7d80c3f5e127e746 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Wed, 22 Mar 2023 12:42:53 +0000 Subject: [PATCH] Revert "Fix non-complex dtypes in OneQubitEulerDecomposer methods (#9828)" This reverts commit 6cec9124955ec175512616f728d9d5eedab3b4c0. This is currently causing flaky CI, so it's being reverted while work is done to determine the cause and fix it. --- .../synthesis/one_qubit_decompose.py | 2 - ...gles-euler-decompose-233e5cee7205ed03.yaml | 10 ----- test/python/quantum_info/test_synthesis.py | 38 ------------------- 3 files changed, 50 deletions(-) delete mode 100644 releasenotes/notes/fix-type-angles-euler-decompose-233e5cee7205ed03.yaml diff --git a/qiskit/quantum_info/synthesis/one_qubit_decompose.py b/qiskit/quantum_info/synthesis/one_qubit_decompose.py index 4df6613f5484..cffa0b05682a 100644 --- a/qiskit/quantum_info/synthesis/one_qubit_decompose.py +++ b/qiskit/quantum_info/synthesis/one_qubit_decompose.py @@ -252,7 +252,6 @@ def angles(self, unitary): Returns: tuple: (theta, phi, lambda). """ - unitary = np.asarray(unitary, dtype=complex) theta, phi, lam, _ = self._params(unitary) return theta, phi, lam @@ -265,7 +264,6 @@ def angles_and_phase(self, unitary): Returns: tuple: (theta, phi, lambda, phase). """ - unitary = np.asarray(unitary, dtype=complex) return self._params(unitary) _params_zyz = staticmethod(euler_one_qubit_decomposer.params_zyz) diff --git a/releasenotes/notes/fix-type-angles-euler-decompose-233e5cee7205ed03.yaml b/releasenotes/notes/fix-type-angles-euler-decompose-233e5cee7205ed03.yaml deleted file mode 100644 index ce25e4697997..000000000000 --- a/releasenotes/notes/fix-type-angles-euler-decompose-233e5cee7205ed03.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -fixes: - - | - Fixed an issue with the :class:`~.OneQubitEulerDecomposer` class's methods - :meth:`~.OneQubitEulerDecomposer.angles` and :meth:`~.OneQubitEulerDecomposer.angles_and_phase` - would error if the input matrix was of a dtype other than ``complex``/``np.cdouble``. In earlier - releases this worked fine but this stopped working in Qiskit Terra 0.23.0 - when the internals of :class:`~.OneQubitEulerDecomposer` were re-written - in Rust. - Fixed `#9827 `__ diff --git a/test/python/quantum_info/test_synthesis.py b/test/python/quantum_info/test_synthesis.py index 099ffb87191e..ac5119604591 100644 --- a/test/python/quantum_info/test_synthesis.py +++ b/test/python/quantum_info/test_synthesis.py @@ -591,44 +591,6 @@ def test_psx_zsx_special_cases(self): self.assertTrue(np.allclose(unitary, Operator(qc_zsx).data)) self.assertTrue(np.allclose(unitary, Operator(qc_zsxx).data)) - def test_float_input_angles_and_phase(self): - """Test angles and phase with float input.""" - decomposer = OneQubitEulerDecomposer("PSX") - input_matrix = np.array( - [ - [0.70710678, 0.70710678], - [0.70710678, -0.70710678], - ], - dtype=np.float64, - ) - (theta, phi, lam, gamma) = decomposer.angles_and_phase(input_matrix) - expected_theta = 1.5707963267948966 - expected_phi = 0.0 - expected_lam = 3.141592653589793 - expected_gamma = -0.7853981633974483 - self.assertAlmostEqual(theta, expected_theta) - self.assertAlmostEqual(phi, expected_phi) - self.assertAlmostEqual(lam, expected_lam) - self.assertAlmostEqual(gamma, expected_gamma) - - def test_float_input_angles(self): - """Test angles with float input.""" - decomposer = OneQubitEulerDecomposer("PSX") - input_matrix = np.array( - [ - [0.70710678, 0.70710678], - [0.70710678, -0.70710678], - ], - dtype=np.float64, - ) - (theta, phi, lam) = decomposer.angles(input_matrix) - expected_theta = 1.5707963267948966 - expected_phi = 0.0 - expected_lam = 3.141592653589793 - self.assertAlmostEqual(theta, expected_theta) - self.assertAlmostEqual(phi, expected_phi) - self.assertAlmostEqual(lam, expected_lam) - # FIXME: streamline the set of test cases class TestTwoQubitWeylDecomposition(CheckDecompositions):