Skip to content

Commit

Permalink
Merge pull request #51 from CQCL/release/1.21.0
Browse files Browse the repository at this point in the history
Release/1.21.0
  • Loading branch information
cqc-melf authored Oct 17, 2023
2 parents 9497f7a + c2a93b0 commit 3f77e7c
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
needs: publish_to_pypi
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: build docs
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
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.30.0"
__extension_version__ = "0.31.0"
__extension_name__ = "pytket-qulacs"
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
~~~~~~~~~

0.31.0 (October 2023)
---------------------

* Updated pytket version requirement to 1.21.

0.30.0 (September 2023)
-----------------------

Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace_packages = True
check_untyped_defs = True

warn_redundant_casts = True
warn_unused_ignores = False
warn_unused_ignores = True
warn_no_return = False
warn_return_any = True
warn_unreachable = True
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/qulacs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Module for conversion from tket primitives to Qulacs primitives."""

# _metadata.py is copied to the folder after installation.
from ._metadata import __extension_version__, __extension_name__ # type: ignore
from ._metadata import __extension_version__, __extension_name__
from .backends import QulacsBackend

try:
Expand Down
20 changes: 10 additions & 10 deletions pytket/extensions/qulacs/backends/qulacs_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from random import Random
from uuid import uuid4
import numpy as np
from sympy import Expr # type: ignore
from qulacs import Observable, QuantumState # type: ignore
from sympy import Expr
from qulacs import Observable, QuantumState
from pytket.backends import (
Backend,
CircuitNotRunError,
Expand All @@ -33,17 +33,17 @@
from pytket.backends.backendinfo import BackendInfo
from pytket.backends.backendresult import BackendResult
from pytket.backends.resulthandle import _ResultIdTuple
from pytket.circuit import Circuit, OpType # type: ignore
from pytket.circuit import Circuit, OpType
from pytket.extensions.qulacs._metadata import __extension_version__
from pytket.passes import ( # type: ignore
from pytket.passes import (
BasePass,
SynthesiseTket,
SequencePass,
DecomposeBoxes,
FullPeepholeOptimise,
FlattenRegisters,
)
from pytket.predicates import ( # type: ignore
from pytket.predicates import (
GateSetPredicate,
NoClassicalControlPredicate,
NoFastFeedforwardPredicate,
Expand All @@ -52,10 +52,10 @@
DefaultRegisterPredicate,
Predicate,
)
from pytket.circuit import Pauli # type: ignore
from pytket.circuit import Pauli
from pytket.passes import auto_rebase_pass
from pytket.pauli import QubitPauliString # type: ignore
from pytket.architecture import Architecture # type: ignore
from pytket.pauli import QubitPauliString
from pytket.architecture import Architecture
from pytket.utils.operators import QubitPauliOperator
from pytket.utils.outcomearray import OutcomeArray
from pytket.extensions.qulacs.qulacs_convert import (
Expand Down Expand Up @@ -217,7 +217,7 @@ def process_circuits(
try:
phase = float(circuit.phase)
coeff = np.exp(phase * np.pi * 1j)
state *= coeff # type: ignore
state *= coeff
except TypeError:
warning(
"Global phase is dependent on a symbolic parameter, so cannot "
Expand Down Expand Up @@ -275,7 +275,7 @@ def get_operator_expectation_value(
if isinstance(coeff, Expr):
qulacs_coeff = complex(coeff.evalf()) # type: ignore
else:
qulacs_coeff = complex(coeff)
qulacs_coeff = complex(coeff) # type: ignore
observable.add_operator(qulacs_coeff, qulacs_qps)

expectation_value = self._expectation_value(state_circuit, observable)
Expand Down
10 changes: 5 additions & 5 deletions pytket/extensions/qulacs/qulacs_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""Conversion from to tket circuits to Qulacs circuits
"""
import numpy as np
from qulacs import QuantumCircuit, gate # type: ignore
from pytket.circuit import Circuit, OpType # type: ignore
from qulacs import QuantumCircuit, gate
from pytket.circuit import Circuit, OpType

_ONE_QUBIT_GATES = {
OpType.X: gate.X,
Expand Down Expand Up @@ -69,18 +69,18 @@ def tk_to_qulacs(
)

elif optype in _ONE_QUBIT_GATES:
qulacs_gate = _ONE_QUBIT_GATES[optype] # type: ignore
qulacs_gate = _ONE_QUBIT_GATES[optype]
index = index_map[com.qubits[0].index[0]]
add_gate = qulacs_gate(index)

elif optype in _ONE_QUBIT_ROTATIONS:
qulacs_gate = _ONE_QUBIT_ROTATIONS[optype] # type: ignore
qulacs_gate = _ONE_QUBIT_ROTATIONS[optype]
index = index_map[com.qubits[0].index[0]]
param = com.op.params[0] * np.pi
add_gate = qulacs_gate(index, -param) # parameter negated for qulacs

elif optype in _TWO_QUBIT_GATES:
qulacs_gate = _TWO_QUBIT_GATES[optype] # type: ignore
qulacs_gate = _TWO_QUBIT_GATES[optype]
id1 = index_map[com.qubits[0].index[0]]
id2 = index_map[com.qubits[1].index[0]]
add_gate = qulacs_gate(id1, id2)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
license="Apache 2",
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=["pytket ~= 1.19", "qulacs ~= 0.6.0"],
install_requires=["pytket ~= 1.21", "qulacs ~= 0.6.0"],
classifiers=[
"Environment :: Console",
"Programming Language :: Python :: 3.9",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_qulacs_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from openfermion.ops import QubitOperator # type: ignore
from openfermion.linalg import eigenspectrum # type: ignore
from pytket.backends import ResultHandle
from pytket.circuit import Circuit, BasisOrder, OpType, Qubit # type: ignore
from pytket.pauli import Pauli, QubitPauliString # type: ignore
from pytket.passes import CliffordSimp # type: ignore
from pytket.circuit import Circuit, BasisOrder, OpType, Qubit
from pytket.pauli import Pauli, QubitPauliString
from pytket.passes import CliffordSimp
from pytket.utils.operators import QubitPauliOperator
from pytket.utils.results import KwargTypes
from pytket.extensions.qulacs import QulacsBackend
Expand Down
6 changes: 3 additions & 3 deletions tests/test_qulacs_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import warnings

import numpy as np
from qulacs import QuantumCircuit, QuantumState # type: ignore
from qulacs.state import inner_product # type: ignore
from pytket.circuit import Circuit, OpType # type: ignore
from qulacs import QuantumCircuit, QuantumState
from qulacs.state import inner_product
from pytket.circuit import Circuit, OpType
from pytket.extensions.qulacs import tk_to_qulacs

warnings.filterwarnings("ignore", category=DeprecationWarning)
Expand Down

0 comments on commit 3f77e7c

Please sign in to comment.