Skip to content

Commit

Permalink
Merge pull request #46 from CQCL/release/1.10.0
Browse files Browse the repository at this point in the history
Release/1.10.0
  • Loading branch information
cqc-melf authored Dec 20, 2022
2 parents 48378aa + afe6e77 commit 2c41e11
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Login
uses: atlassian/gajira-login@v3.0.0
uses: atlassian/gajira-login@v3.0.1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Create Bug
uses: atlassian/gajira-create@v3.0.0
uses: atlassian/gajira-create@v3.0.1
if: contains(github.event.issue.labels.*.name, 'bug')
with:
project: TKET
issuetype: Bug
summary: « [pytket-qiskit] ${{ github.event.issue.title }}»
description: ${{ github.event.issue.html_url }}
- name: Create Task
uses: atlassian/gajira-create@v3.0.0
uses: atlassian/gajira-create@v3.0.1
if: "! contains(github.event.issue.labels.*.name, 'bug')"
with:
project: TKET
Expand Down
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.32.0"
__extension_version__ = "0.33.0"
__extension_name__ = "pytket-qiskit"
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
~~~~~~~~~

0.33.0 (December 2022)
----------------------

* Fix handling of parameter when converting ``PauliEvolutionGate`` to
``QubitPauliOperator``.
* Updated pytket version requirement to 1.10.

0.32.0 (December 2022)
----------------------

Expand Down
6 changes: 3 additions & 3 deletions pytket/extensions/qiskit/backends/aer.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ def _process_model(noise_model: NoiseModel, gate_set: Set[OpType]) -> dict:
def _sparse_to_zx_tup(
pauli: QubitPauliString, n_qubits: int
) -> Tuple[np.ndarray, np.ndarray]:
x = np.zeros(n_qubits, dtype=np.bool8)
z = np.zeros(n_qubits, dtype=np.bool8)
x = np.zeros(n_qubits, dtype=np.bool_)
z = np.zeros(n_qubits, dtype=np.bool_)
for q, p in pauli.map.items():
i = _default_q_index(q)
z[i] = p in (Pauli.Z, Pauli.Y)
Expand All @@ -698,7 +698,7 @@ def _qubitpauliop_to_sparsepauliop(
operator: QubitPauliOperator, n_qubits: int
) -> SparsePauliOp:
n_ops = len(operator._dict)
table_array = np.zeros((n_ops, 2 * n_qubits), dtype=np.bool8)
table_array = np.zeros((n_ops, 2 * n_qubits), dtype=np.bool_)
coeffs = np.zeros(n_ops, dtype=np.float64)

for i, (term, coeff) in enumerate(operator._dict.items()):
Expand Down
4 changes: 3 additions & 1 deletion pytket/extensions/qiskit/qiskit_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ def _tk_gate_set(backend: "QiskitBackend") -> Set[OpType]:

def _qpo_from_peg(peg: PauliEvolutionGate, qubits: List[Qubit]) -> QubitPauliOperator:
op = peg.operator
t = peg.params[0]
qpodict = {}
for p, c in zip(op.paulis, op.coeffs):
if np.iscomplex(c):
raise ValueError("Coefficient for Pauli {} is non-real.".format(p))
coeff = param_to_tk(t) * c
qpslist = []
pstr = p.to_label()
for a in pstr:
Expand All @@ -233,7 +235,7 @@ def _qpo_from_peg(peg: PauliEvolutionGate, qubits: List[Qubit]) -> QubitPauliOpe
else:
assert a == "I"
qpslist.append(Pauli.I)
qpodict[QubitPauliString(qubits, qpslist)] = c
qpodict[QubitPauliString(qubits, qpslist)] = coeff
return QubitPauliOperator(qpodict)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=[
"pytket ~= 1.9",
"pytket ~= 1.10",
"qiskit ~= 0.39.0",
"qiskit_ibm_runtime ~= 0.8.0",
],
Expand Down
15 changes: 14 additions & 1 deletion tests/qiskit_convert_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
Aer,
IBMQ,
)
from qiskit.opflow import PauliTrotterEvolution # type: ignore
from qiskit.opflow import PauliOp, PauliSumOp, PauliTrotterEvolution, Suzuki # type: ignore
from qiskit.opflow.primitive_ops import PauliSumOp # type: ignore
from qiskit.quantum_info import Pauli # type: ignore
from qiskit.transpiler import PassManager # type: ignore
from qiskit.circuit.library import RYGate, MCMT # type: ignore
from qiskit.circuit import Parameter # type: ignore
Expand Down Expand Up @@ -716,3 +717,15 @@ def test_rebased_conversion() -> None:
u1 = tket_circzz.get_unitary()
u2 = tket_circzz2.get_unitary()
assert compare_unitaries(u1, u2)


# https://github.com/CQCL/pytket-qiskit/issues/24
def test_parametrized_evolution() -> None:
pauli_blocks = [PauliOp(Pauli("XXZ"), coeff=1.0), PauliOp(Pauli("YXY"), coeff=0.5)]
operator: PauliSumOp = sum(pauli_blocks) * Parameter("x")
evolved_circ_op = PauliTrotterEvolution(
trotter_mode=Suzuki(reps=2, order=4)
).convert(operator.exp_i())
qc: QuantumCircuit = evolved_circ_op.primitive
tk_qc: Circuit = qiskit_to_tk(qc)
assert len(tk_qc.free_symbols()) == 1

0 comments on commit 2c41e11

Please sign in to comment.