Skip to content

Commit

Permalink
Add unit test and release note
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson committed Mar 28, 2024
1 parent 748b801 commit 7a8f177
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"}``.
43 changes: 43 additions & 0 deletions test/utils/test_equivalence.py
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 7a8f177

Please sign in to comment.