diff --git a/releasenotes/notes/translate-subexperiments-08be7848b440f6ed.yaml b/releasenotes/notes/translate-subexperiments-08be7848b440f6ed.yaml new file mode 100644 index 000000000..c11bfe9f5 --- /dev/null +++ b/releasenotes/notes/translate-subexperiments-08be7848b440f6ed.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The functions, :func:`.generate_qpd_experiments` and :func:`decompose_qpd_instructions`, now accept an optional argument, ``translate_to_qpu``, which accepts a string denoting whether the instructions sampled for cutting should be translated to a particular QPU architecture. Accepted inputs are: ``{"heron", "eagle"}``. diff --git a/test/utils/test_equivalence.py b/test/utils/test_equivalence.py new file mode 100644 index 000000000..4aab6d9a7 --- /dev/null +++ b/test/utils/test_equivalence.py @@ -0,0 +1,43 @@ +# This code is a Qiskit project. + +# (C) Copyright IBM 2024. + +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +"""Tests for CKT equivalence libraries.""" + +import unittest + +import numpy as np +from qiskit.circuit import EquivalenceLibrary +from qiskit.circuit.library.standard_gates import SdgGate + + +from circuit_knitting.utils.equivalence import equivalence_libraries + + +class TestEquivalenceLibraries(unittest.TestCase): + def setUp(self): + self.heron_lib = equivalence_libraries["heron"] + self.eagle_lib = equivalence_libraries["eagle"] + self.standard_lib = equivalence_libraries["standard"] + + def test_equivalence_library_dict(self): + assert isinstance(self.heron_lib, EquivalenceLibrary) + assert isinstance(self.eagle_lib, EquivalenceLibrary) + assert self.standard_lib == None + + def test_equivalence_heron(self): + heron_equivalence = self.heron_lib.get_entry(SdgGate())[0] + assert heron_equivalence.data[0].operation.name == "rz" + assert heron_equivalence.data[0].operation.params == [-np.pi / 2] + + def test_equivalence_eagle(self): + eagle_equivalence = self.eagle_lib.get_entry(SdgGate())[0] + assert eagle_equivalence.data[0].operation.name == "rz" + assert eagle_equivalence.data[0].operation.params == [-np.pi / 2]