Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022", "macos-latest"]
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]

name: "Python ${{ matrix.python }} / ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
Expand Down
22 changes: 8 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,14 @@ classifiers = [
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Physics",
]
requires-python = ">=3.8,<3.13"
dynamic = ["version"]
dependencies = [
"graphix>=0.2.15",
"sympy>=1.9",
]
[project.optional-dependencies]
dev = [
"black==24.4.0",
"isort==5.13.2",
"pytest",
"parameterized",
"tox",
]
requires-python = ">=3.9,<3.14"
dynamic = ["version", "dependencies", "optional-dependencies"]

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }

[tool.setuptools.dynamic.optional-dependencies]
dev = { file = ["requirements-dev.txt"] }

[project.urls]
Documentation = "https://graphix.readthedocs.io"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
graphix @ git+https://github.com/thierry-martinez/graphix@parameterized
graphix @ git+https://github.com/thierry-martinez/graphix@branch_selector
sympy>=1.9
16 changes: 5 additions & 11 deletions tests/test_sympy_parameter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import pytest
from graphix import Circuit
from graphix.branch_selector import RandomBranchSelector
from numpy.random import Generator

from graphix_symbolic import SympyParameter
Expand Down Expand Up @@ -34,18 +35,11 @@ def test_parameter_pattern_simulation(backend, fx_rng: Generator) -> None:
circuit = Circuit(1)
circuit.rz(0, alpha)
pattern = circuit.transpile().pattern
# Both simulations (numeric and symbolic) will use the same
# seed for random number generation, to ensure that the
# explored branch is the same for the two simulations.
seed = fx_rng.integers(2**63)
result_subs_then_simulate = pattern.subs(alpha, 0.5).simulate_pattern(
backend, pr_calc=False, rng=np.random.default_rng(seed)
)
# Note: pr_calc=False is mandatory since we cannot compute
# probabilities on symbolic states; we explore one arbitrary
# branch.
result_subs_then_simulate = pattern.subs(alpha, 0.5).simulate_pattern(backend, rng=fx_rng)
# We cannot compute probabilities on symbolic states; we explore
# one arbitrary branch.
result_simulate_then_subs = pattern.simulate_pattern(
backend, pr_calc=False, rng=np.random.default_rng(seed), symbolic=True
backend, branch_selector=RandomBranchSelector(pr_calc=False), rng=fx_rng, symbolic=True
).subs(alpha, 0.5)
if backend == "statevector":
assert np.allclose(result_subs_then_simulate.psi, result_simulate_then_subs.psi)
Expand Down
Loading