diff --git a/pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp b/pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp index 2d8a0f39d..3c3fddd08 100644 --- a/pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp +++ b/pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp @@ -291,7 +291,8 @@ class StateVectorCudaManaged if (opName == "Identity") { return; } else if (opName == "GlobalPhase") { - //TODO: Check the performance GlobalPhase implementation via scaling the statevector + // TODO: Check the performance GlobalPhase implementation via + // scaling the statevector const std::vector names(BaseType::getNumQubits(), "I"); std::vector tgts_all(BaseType::getNumQubits()); std::iota(tgts_all.begin(), tgts_all.end(), 0); @@ -486,7 +487,7 @@ class StateVectorCudaManaged return static_cast(BaseType::getNumQubits() - 1 - x); }); - std::transform(ctrls_values.begin(), ctrls_values.end(), + std::transform(ctrls_values.rbegin(), ctrls_values.rend(), ctrls_valuesInt.begin(), [&](bool x) { return static_cast(x); }); diff --git a/tests/lightning_qubit/test_adjoint_jacobian_class.py b/tests/lightning_qubit/test_adjoint_jacobian_class.py index 7fbaa19b1..3bff0e64a 100644 --- a/tests/lightning_qubit/test_adjoint_jacobian_class.py +++ b/tests/lightning_qubit/test_adjoint_jacobian_class.py @@ -166,7 +166,7 @@ def test_not_expectation_return_type(self, lightning_sv): self.calculate_jacobian(lightning_sv(num_wires=1), tape) @pytest.mark.skipif( - device_name != "lightning.qubit", + device_name not in ("lightning.qubit", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) @pytest.mark.parametrize("n_qubits", [1, 2, 3, 4]) diff --git a/tests/lightning_qubit/test_measurements_class.py b/tests/lightning_qubit/test_measurements_class.py index 9a606e66a..e418936c5 100644 --- a/tests/lightning_qubit/test_measurements_class.py +++ b/tests/lightning_qubit/test_measurements_class.py @@ -799,7 +799,7 @@ def test_controlled_qubit_gates(self, operation, n_qubits, control_value, tol, l assert np.allclose(result, expected, tol * 10) @pytest.mark.skipif( - device_name not in ("lightning.qubit", "lightning.tensor"), + device_name not in ("lightning.qubit", "lightning.tensor", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) def test_controlled_qubit_unitary_from_op(self, tol, lightning_sv): diff --git a/tests/test_adjoint_jacobian.py b/tests/test_adjoint_jacobian.py index 83713b1c6..8dff699b4 100644 --- a/tests/test_adjoint_jacobian.py +++ b/tests/test_adjoint_jacobian.py @@ -268,7 +268,7 @@ def test_Rot_gradient(self, stateprep, theta, dev): assert np.allclose(calculated_val, numeric_val, atol=tol, rtol=0) @pytest.mark.skipif( - device_name != "lightning.qubit", + device_name not in ("lightning.qubit", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) @pytest.mark.parametrize("n_qubits", [1, 2, 3, 4]) @@ -817,7 +817,7 @@ def circuit(p): assert np.allclose(jac_ad, jac_bp, atol=tol, rtol=0) @pytest.mark.skipif( - device_name != "lightning.qubit", + device_name not in ("lightning.qubit", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) @pytest.mark.parametrize( diff --git a/tests/test_gates.py b/tests/test_gates.py index da414c378..d586d35ac 100644 --- a/tests/test_gates.py +++ b/tests/test_gates.py @@ -372,7 +372,7 @@ def test_state_prep(n_targets, tol): @pytest.mark.skipif( - device_name != "lightning.qubit", + device_name not in ("lightning.qubit", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) @pytest.mark.parametrize("control_value", [False, True]) @@ -497,7 +497,7 @@ def circuit(): @pytest.mark.skipif( - device_name != "lightning.qubit", + device_name not in ("lightning.qubit", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) def test_controlled_qubit_unitary_from_op(tol): @@ -558,7 +558,7 @@ def test_paulirot(n_wires, n_targets, tol): @pytest.mark.skipif( - device_name not in ("lightning.qubit", "lightning.tensor"), + device_name not in ("lightning.qubit", "lightning.tensor", "lightning.gpu"), reason="N-controlled operations only implemented in lightning.qubit.", ) @pytest.mark.parametrize("control_wires", range(4))