Skip to content

Commit 2c41e11

Browse files
authored
Merge pull request #46 from CQCL/release/1.10.0
Release/1.10.0
2 parents 48378aa + afe6e77 commit 2c41e11

File tree

7 files changed

+32
-10
lines changed

7 files changed

+32
-10
lines changed

.github/workflows/issue.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ jobs:
1010
runs-on: ubuntu-22.04
1111
steps:
1212
- name: Login
13-
uses: atlassian/gajira-login@v3.0.0
13+
uses: atlassian/gajira-login@v3.0.1
1414
env:
1515
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
1616
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
1717
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
1818
- name: Create Bug
19-
uses: atlassian/gajira-create@v3.0.0
19+
uses: atlassian/gajira-create@v3.0.1
2020
if: contains(github.event.issue.labels.*.name, 'bug')
2121
with:
2222
project: TKET
2323
issuetype: Bug
2424
summary: « [pytket-qiskit] ${{ github.event.issue.title }}»
2525
description: ${{ github.event.issue.html_url }}
2626
- name: Create Task
27-
uses: atlassian/gajira-create@v3.0.0
27+
uses: atlassian/gajira-create@v3.0.1
2828
if: "! contains(github.event.issue.labels.*.name, 'bug')"
2929
with:
3030
project: TKET

_metadata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__extension_version__ = "0.32.0"
1+
__extension_version__ = "0.33.0"
22
__extension_name__ = "pytket-qiskit"

docs/changelog.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
~~~~~~~~~
33

4+
0.33.0 (December 2022)
5+
----------------------
6+
7+
* Fix handling of parameter when converting ``PauliEvolutionGate`` to
8+
``QubitPauliOperator``.
9+
* Updated pytket version requirement to 1.10.
10+
411
0.32.0 (December 2022)
512
----------------------
613

pytket/extensions/qiskit/backends/aer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ def _process_model(noise_model: NoiseModel, gate_set: Set[OpType]) -> dict:
685685
def _sparse_to_zx_tup(
686686
pauli: QubitPauliString, n_qubits: int
687687
) -> Tuple[np.ndarray, np.ndarray]:
688-
x = np.zeros(n_qubits, dtype=np.bool8)
689-
z = np.zeros(n_qubits, dtype=np.bool8)
688+
x = np.zeros(n_qubits, dtype=np.bool_)
689+
z = np.zeros(n_qubits, dtype=np.bool_)
690690
for q, p in pauli.map.items():
691691
i = _default_q_index(q)
692692
z[i] = p in (Pauli.Z, Pauli.Y)
@@ -698,7 +698,7 @@ def _qubitpauliop_to_sparsepauliop(
698698
operator: QubitPauliOperator, n_qubits: int
699699
) -> SparsePauliOp:
700700
n_ops = len(operator._dict)
701-
table_array = np.zeros((n_ops, 2 * n_qubits), dtype=np.bool8)
701+
table_array = np.zeros((n_ops, 2 * n_qubits), dtype=np.bool_)
702702
coeffs = np.zeros(n_ops, dtype=np.float64)
703703

704704
for i, (term, coeff) in enumerate(operator._dict.items()):

pytket/extensions/qiskit/qiskit_convert.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ def _tk_gate_set(backend: "QiskitBackend") -> Set[OpType]:
217217

218218
def _qpo_from_peg(peg: PauliEvolutionGate, qubits: List[Qubit]) -> QubitPauliOperator:
219219
op = peg.operator
220+
t = peg.params[0]
220221
qpodict = {}
221222
for p, c in zip(op.paulis, op.coeffs):
222223
if np.iscomplex(c):
223224
raise ValueError("Coefficient for Pauli {} is non-real.".format(p))
225+
coeff = param_to_tk(t) * c
224226
qpslist = []
225227
pstr = p.to_label()
226228
for a in pstr:
@@ -233,7 +235,7 @@ def _qpo_from_peg(peg: PauliEvolutionGate, qubits: List[Qubit]) -> QubitPauliOpe
233235
else:
234236
assert a == "I"
235237
qpslist.append(Pauli.I)
236-
qpodict[QubitPauliString(qubits, qpslist)] = c
238+
qpodict[QubitPauliString(qubits, qpslist)] = coeff
237239
return QubitPauliOperator(qpodict)
238240

239241

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
packages=find_namespace_packages(include=["pytket.*"]),
4545
include_package_data=True,
4646
install_requires=[
47-
"pytket ~= 1.9",
47+
"pytket ~= 1.10",
4848
"qiskit ~= 0.39.0",
4949
"qiskit_ibm_runtime ~= 0.8.0",
5050
],

tests/qiskit_convert_test.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
Aer,
2727
IBMQ,
2828
)
29-
from qiskit.opflow import PauliTrotterEvolution # type: ignore
29+
from qiskit.opflow import PauliOp, PauliSumOp, PauliTrotterEvolution, Suzuki # type: ignore
3030
from qiskit.opflow.primitive_ops import PauliSumOp # type: ignore
31+
from qiskit.quantum_info import Pauli # type: ignore
3132
from qiskit.transpiler import PassManager # type: ignore
3233
from qiskit.circuit.library import RYGate, MCMT # type: ignore
3334
from qiskit.circuit import Parameter # type: ignore
@@ -716,3 +717,15 @@ def test_rebased_conversion() -> None:
716717
u1 = tket_circzz.get_unitary()
717718
u2 = tket_circzz2.get_unitary()
718719
assert compare_unitaries(u1, u2)
720+
721+
722+
# https://github.com/CQCL/pytket-qiskit/issues/24
723+
def test_parametrized_evolution() -> None:
724+
pauli_blocks = [PauliOp(Pauli("XXZ"), coeff=1.0), PauliOp(Pauli("YXY"), coeff=0.5)]
725+
operator: PauliSumOp = sum(pauli_blocks) * Parameter("x")
726+
evolved_circ_op = PauliTrotterEvolution(
727+
trotter_mode=Suzuki(reps=2, order=4)
728+
).convert(operator.exp_i())
729+
qc: QuantumCircuit = evolved_circ_op.primitive
730+
tk_qc: Circuit = qiskit_to_tk(qc)
731+
assert len(tk_qc.free_symbols()) == 1

0 commit comments

Comments
 (0)