Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c7291d0
Added `quick.circuit.Ansatz`
ACE07-Sev Mar 14, 2025
1c43c85
Update circuit_utils.py
ACE07-Sev Mar 14, 2025
7ea0c02
Update circuit_utils.py
ACE07-Sev Mar 14, 2025
b49a3f2
Update Training Ansatzes.ipynb
ACE07-Sev Mar 15, 2025
71c1d27
Fixed #28
ACE07-Sev Mar 22, 2025
647bce0
Merge pull request #49 from Qualition/circuit-eq-fix
ACE07-Sev Mar 22, 2025
eb5cb5a
Changed Type to type due to typing deprecation
ACE07-Sev Mar 25, 2025
8e0fb50
Merge pull request #48 from Qualition/optimizer-refactor
ACE07-Sev Mar 25, 2025
09c1f9b
Merge pull request #50 from Qualition/typing-type-deprecation
ACE07-Sev Mar 25, 2025
a853223
- Added `quick.circuit.from_framework.FromPennylane` to convert circu…
ACE07-Sev Apr 26, 2025
1d53238
Added pyright to pyproject.toml
ACE07-Sev Apr 30, 2025
19344b2
- Trying an idea by using rounding on M2 (this will be okay given M2 …
ACE07-Sev May 19, 2025
20fb1bf
- Trying an idea for fixing floating point error with uniformly contr…
ACE07-Sev May 19, 2025
5d26bb4
- Trying an idea by rounding v u r only.
ACE07-Sev May 19, 2025
9b0428b
- Trying rounding the gates during application in Multiplexor (roundi…
ACE07-Sev May 19, 2025
56add99
- Trying an idea to see if the two qubit inconsistency between differ…
ACE07-Sev May 23, 2025
6fdbbc0
- Printing full output for two qubit case
ACE07-Sev May 23, 2025
cf1c937
- Testing to see if the phase difference seen in previous push is due…
ACE07-Sev May 23, 2025
796c9b2
- Trying an idea for fixing the two-qubit issue (Turns out it's not d…
ACE07-Sev May 25, 2025
b4a3fc8
- Checking if the windows non-rounded fail is due to wrong diagonaliz…
ACE07-Sev May 25, 2025
16fe3a3
- Trying a quick sanity check (P is real-symmetric, so conj shouldn't…
ACE07-Sev May 25, 2025
aa8d8dd
- Added print lines to see what is causing the uniformly controlled i…
ACE07-Sev May 26, 2025
2b2e611
- Checking the single qubit gates produced to see if they are the cau…
ACE07-Sev May 26, 2025
3492fdc
Fixed the mypy issue
ACE07-Sev May 26, 2025
cfa1199
- Checking to see if the issue is from `extract_uvr_matrices` (the si…
ACE07-Sev May 26, 2025
300eb7c
- Trying cmath for uniformly controlled issue.
ACE07-Sev May 26, 2025
5efb196
- Trying rounding again, with 16 decimals
ACE07-Sev May 26, 2025
ae0d633
- Added full framework to the uniformly controlled testers.
ACE07-Sev May 26, 2025
3db28fa
- Updated workflow ymls
ACE07-Sev May 26, 2025
10ddce1
- Bumped versions where possible to minimize warnings.
ACE07-Sev May 27, 2025
77767ca
- Added additional testers for known cases of M2 diagnolization issues.
ACE07-Sev Jun 1, 2025
d09b3f4
- Added more unit tests.
ACE07-Sev Jul 7, 2025
9809d42
- Minimized test cases for UC to make debugging easier.
ACE07-Sev Jul 7, 2025
952a342
- Updated workflow to run all workflows.
ACE07-Sev Jul 7, 2025
5e9277e
- Checking diagonal.
ACE07-Sev Jul 8, 2025
11748eb
- Checking why diagonal is different on different os.
ACE07-Sev Jul 8, 2025
25a3082
- Additional prints to pinpoint divergence.
ACE07-Sev Jul 8, 2025
a91feed
- Fixed testing for better assertion of the property based on D U' = …
ACE07-Sev Jul 12, 2025
a784b6e
- Fixes style for E252.
ACE07-Sev Jul 12, 2025
5c93153
- Added type hints to `repetition_verify` in `quick.circuit.circuit_u…
ACE07-Sev Jul 14, 2025
7ee77a8
- Added `calculate_entanglement_entropy()` and `calculate_entanglemen…
ACE07-Sev Jul 20, 2025
c7d5852
- Added repeat and tensor to `quick.circuit` module via `__mul__` and…
ACE07-Sev Jul 21, 2025
a04315f
- Updated to improve coverage.
ACE07-Sev Jul 21, 2025
f36dee1
- Slight fix to `is_statevector` to handle 2 dimensional arrays where…
ACE07-Sev Jul 22, 2025
c7d7221
Merge pull request #58 from Qualition/two-qubit-synthesis-floating-po…
ACE07-Sev Jul 22, 2025
692037f
- Changed default value from mutable empty list to None.
ACE07-Sev Jul 22, 2025
c6def9c
Merge pull request #60 from Qualition/codacy-improvements
ACE07-Sev Jul 22, 2025
6ee1a26
- Removed unused import.
ACE07-Sev Jul 23, 2025
8ced796
Merge pull request #61 from Qualition/codacy-improvements
ACE07-Sev Jul 23, 2025
8e920ed
- Renamed `quick.compiler.Compiler` to `ShendeCompiler` given specifi…
ACE07-Sev Jul 25, 2025
23b2d19
- Removed prints left accidentally.
ACE07-Sev Jul 25, 2025
ed2ed7c
- Removed accidentally left tester from `optimizer` deprecation of `S…
ACE07-Sev Jul 25, 2025
0b81920
Merge pull request #62 from Qualition/primitives-remake
ACE07-Sev Jul 27, 2025
d828ade
- Refactored `quick.primitives`.
ACE07-Sev Jul 30, 2025
7eba257
- Uncommented import in `__init__.py`
ACE07-Sev Jul 30, 2025
e7e6d23
- Added partial trace, trace, and tensor product to `quick.primitives…
ACE07-Sev Aug 5, 2025
f793ab2
- Added `.reverse_bits()` method to `quick.primitives.Statevector` an…
ACE07-Sev Aug 10, 2025
ad6a4e9
- Fixed typo.
ACE07-Sev Aug 11, 2025
211f3d9
- Added contraction logic to `quick.primitives` for Operator and Stat…
ACE07-Sev Aug 28, 2025
fb7998b
- Bumped pennylane to 0.42.3 to avoid #8112 error on pennylane repo.
ACE07-Sev Aug 28, 2025
355900f
- Replaced `Self` with `Statevector` given `Self` is not available in…
ACE07-Sev Aug 28, 2025
f699e36
- Added `.decompose_gate()` to `quick.circuit.Circuit`.
ACE07-Sev Sep 17, 2025
7231be9
- Added frobenius distance to `quick.metrics`.
ACE07-Sev Sep 19, 2025
692ca80
- Added new predicates.
ACE07-Sev Oct 18, 2025
5730c60
- Removed trailing whitespaces in some test files.
ACE07-Sev Oct 18, 2025
606525c
Merge pull request #63 from Qualition/primitives-remake
ACE07-Sev Oct 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ on:
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
permissions:
attestations: write
id-token: write
Expand All @@ -32,7 +35,10 @@ jobs:
name: Publish Python 🐍 distribution 📦 to PyPI
needs: build
if: ${{ github.event.action == 'published' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
environment:
name: pypi
url: https://pypi.org/project/quick-core/${{ github.ref_name }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
Expand Down
413 changes: 413 additions & 0 deletions notebooks/Training Ansatzes.ipynb

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ version = "0.0.0"
dependencies = [
"cirq-core == 1.4.1",
"genQC == 0.1.0",
"numpy >= 1.23,< 3.0",
"pennylane == 0.39.0",
"pytket == 1.37.0",
"pytket-qiskit == 0.62.0",
"pytket-cirq == 0.39.0",
"qiskit == 1.3.1",
"qiskit_aer == 0.16.0",
"qiskit_ibm_runtime == 0.34.0",
"qiskit-transpiler-service == 0.4.14",
"numpy >= 1.23",
"pennylane == 0.42.3",
"pytket == 2.4.1",
"pytket-qiskit == 0.68.0",
"pytket-cirq == 0.40.0",
"qiskit == 2.0.1",
"qiskit_aer == 0.17.0",
"qiskit_ibm_runtime == 0.39.0",
"qiskit-ibm-transpiler == 0.11.0",
"quimb == 1.10.0",
"tket2 == 0.6.0"
"tket2 == 0.10.0"
]
requires-python = ">=3.10, <3.13"
authors = [
Expand Down Expand Up @@ -60,6 +60,10 @@ include = ["quick*"]
[tool.setuptools.package-data]
"quick" = ["py.typed"]

[tools.pyright]
include = ["quick", "tests"]
typeCheckingMode = "strict"

[tool.codeflash]
# All paths are relative to this pyproject.toml's directory.
module-root = "quick"
Expand Down
21 changes: 10 additions & 11 deletions quick/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import numpy as np
from numpy.typing import NDArray
from types import NotImplementedType
from typing import Type

from quick.circuit import Circuit

Expand Down Expand Up @@ -59,14 +58,14 @@ class Backend(ABC):
"""
def __init__(
self,
device: str="CPU"
device: str = "CPU"
) -> None:
""" Initialize a `quick.backend.Backend` instance.
"""
if device not in ["CPU", "GPU"]:
raise ValueError(f"Invalid device: {device}. Must be either 'CPU' or 'GPU'.")
self.device = device
self._qc_framework: Type[Circuit]
self._qc_framework: type[Circuit]

@staticmethod
def backendmethod(method):
Expand Down Expand Up @@ -177,7 +176,7 @@ def get_operator(
def get_counts(
self,
circuit: Circuit,
num_shots: int=1024
num_shots: int = 1024
) -> dict[str, int]:
""" Get the counts of the backend.

Expand Down Expand Up @@ -316,7 +315,7 @@ class NoisyBackend(Backend, ABC):
`device` : str
The device to use for simulating the circuit.
This can be either "CPU", or "GPU".
`_qc_framework` : Type[quick.circuit.Circuit]
`_qc_framework` : type[quick.circuit.Circuit]
The quantum computing framework to use.
`noisy` : bool
Whether the simulation is noisy or not.
Expand All @@ -332,7 +331,7 @@ def __init__(
self,
single_qubit_error: float,
two_qubit_error: float,
device: str="CPU"
device: str = "CPU"
) -> None:
""" Initialize a `quick.backend.NoisyBackend` instance.
"""
Expand All @@ -348,7 +347,7 @@ def __init__(

self.noisy = self.single_qubit_error > 0.0 or self.two_qubit_error > 0.0

self._qc_framework: Type[Circuit]
self._qc_framework: type[Circuit]


class FakeBackend(Backend, ABC):
Expand All @@ -367,7 +366,7 @@ class FakeBackend(Backend, ABC):
`device` : str
The device to use for simulating the circuit.
This can be either "CPU", or "GPU".
`_qc_framework` : Type[quick.circuit.Circuit]
`_qc_framework` : type[quick.circuit.Circuit]
The quantum computing framework to use.
`_backend_name` : str
The name of the backend to use (usually the name of the backend being emulated).
Expand All @@ -381,12 +380,12 @@ class FakeBackend(Backend, ABC):
"""
def __init__(
self,
device: str="CPU"
device: str = "CPU"
) -> None:
""" Initialize a `quick.backend.FakeBackend` instance.
"""
super().__init__(device=device)
self._qc_framework: Type[Circuit]
self._qc_framework: type[Circuit]
self._backend_name: str
self._max_num_qubits: int

Expand Down Expand Up @@ -452,7 +451,7 @@ def get_operator(
def get_counts(
self,
circuit: Circuit,
num_shots: int=1024
num_shots: int = 1024
) -> dict[str, int]:
""" Get the counts of the backend.

Expand Down
8 changes: 4 additions & 4 deletions quick/backend/qiskit_backends/aer_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class AerBackend(NoisyBackend):
"""
def __init__(
self,
single_qubit_error: float=0.0,
two_qubit_error: float=0.0,
device: str="CPU"
single_qubit_error: float = 0.0,
two_qubit_error: float = 0.0,
device: str = "CPU"
) -> None:

super().__init__(
Expand Down Expand Up @@ -189,7 +189,7 @@ def get_operator(
def get_counts(
self,
circuit: Circuit,
num_shots: int=1024
num_shots: int = 1024
) -> dict[str, int]:

if len(circuit.measured_qubits) == 0:
Expand Down
7 changes: 4 additions & 3 deletions quick/backend/qiskit_backends/fake_ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import numpy as np
from numpy.typing import NDArray
import warnings

from qiskit.primitives import BackendSamplerV2 as BackendSampler # type: ignore
from qiskit_aer import AerSimulator # type: ignore
Expand Down Expand Up @@ -89,7 +90,7 @@ def __init__(
self,
hardware_name: str,
qiskit_runtime: QiskitRuntimeService,
device: str="CPU"
device: str = "CPU"
) -> None:

super().__init__(device=device)
Expand All @@ -113,7 +114,7 @@ def __init__(
self._op_backend = AerSimulator.from_backend(backend, device="GPU", method="unitary")
else:
if self.device == "GPU" and available_devices["GPU"] is None:
print("Warning: GPU acceleration is not available. Defaulted to CPU.")
warnings.warn("Warning: GPU acceleration is not available. Defaulted to CPU.")
self._counts_backend = BackendSampler(backend=AerSimulator.from_backend(backend))
self._op_backend = AerSimulator.from_backend(backend, method="unitary")

Expand Down Expand Up @@ -161,7 +162,7 @@ def get_operator(
def get_counts(
self,
circuit: Circuit,
num_shots: int=1024
num_shots: int = 1024
) -> dict[str, int]:

result = self._counts_backend.run([circuit.circuit], shots=num_shots).result()
Expand Down
2 changes: 2 additions & 0 deletions quick/circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dag",
"gate_matrix",
"from_framework",
"Ansatz",
"Circuit",
"CirqCircuit",
"PennylaneCircuit",
Expand All @@ -32,5 +33,6 @@
from quick.circuit.pennylanecircuit import PennylaneCircuit
from quick.circuit.quimbcircuit import QuimbCircuit
from quick.circuit.tketcircuit import TKETCircuit
from quick.circuit.ansatz import Ansatz
import quick.circuit.from_framework as from_framework
import quick.circuit.dag as dag
Loading
Loading