Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5600289
greedy schedule solver
masa10-f Nov 15, 2025
a052c38
add greedy search option
masa10-f Nov 15, 2025
7de65fa
add unit test for greedy search
masa10-f Nov 15, 2025
5601fca
apply auto-ruff fix
masa10-f Nov 15, 2025
9aad1d6
stash changes
masa10-f Nov 16, 2025
c13617a
Merge branch 'master' into greedy-scheduling
masa10-f Nov 16, 2025
7b23597
add throughput calculation in pattern
masa10-f Nov 16, 2025
259affe
make throughput as a property
masa10-f Nov 16, 2025
6558c80
fix greedy minimize time algorithm
masa10-f Nov 16, 2025
b539077
fix minimize space scheduler
masa10-f Nov 16, 2025
6869113
fix algorithm
masa10-f Nov 16, 2025
287b7b9
update test
masa10-f Nov 16, 2025
4d1054c
add max qubit count attribute
masa10-f Nov 17, 2025
8b5fe5a
remove unnecessary type
masa10-f Nov 17, 2025
65fbae1
fix branch where max_qubit_count is not None
masa10-f Nov 17, 2025
4f7032f
add test with max qubit constraints
masa10-f Nov 17, 2025
b1739e4
fix test
masa10-f Nov 17, 2025
ea31542
add greedy option for scheduler
masa10-f Nov 17, 2025
d27eca3
remove wrapper
masa10-f Nov 17, 2025
51df271
add extra properties into pattern
masa10-f Nov 17, 2025
26330ca
add pauli simplification in feedforward module
masa10-f Nov 17, 2025
cebc457
optimize the performance of greedy scheduler
masa10-f Nov 17, 2025
f84425b
Merge branch 'master' into greedy-scheduling
masa10-f Dec 20, 2025
f6786f0
avoid error when meas basis is None
masa10-f Dec 20, 2025
81797ea
fix ruff errors
masa10-f Dec 20, 2025
ada4355
fix type errors
masa10-f Dec 20, 2025
9640464
add type annotations on greedy scheduler test
masa10-f Dec 20, 2025
5faaa6f
detect cyclic error
masa10-f Dec 20, 2025
b3346bc
fix activation cost
masa10-f Dec 20, 2025
fdb1566
improve the solver performance
masa10-f Dec 20, 2025
939d7bc
fix mypy and ruff errors
masa10-f Dec 20, 2025
3004dc2
raise an error when no tick command is included in pattern
masa10-f Dec 25, 2025
88636fc
fix the difinition of volume and max_volume
masa10-f Dec 25, 2025
8caa096
fix graph structure
masa10-f Dec 25, 2025
aa19e3a
fix ruff error
masa10-f Dec 25, 2025
5a4c059
modify the meas logic in greedy minimize time algorithm
masa10-f Dec 28, 2025
6c4dc9d
improve the depth of minimize_time greedy algorithm
masa10-f Dec 31, 2025
d8cd603
mitigate the alive time memory size
masa10-f Dec 31, 2025
eaf7e81
add ALAP post-processing to minimize active volume in greedy_minimize…
masa10-f Dec 31, 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
60 changes: 59 additions & 1 deletion graphqomb/feedforward.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import typing_extensions

from graphqomb.common import Plane
from graphqomb.common import Axis, Plane, determine_pauli_axis
from graphqomb.graphstate import BaseGraphState, odd_neighbors

if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -277,3 +277,61 @@ def propagate_correction_map( # noqa: C901, PLR0912
new_zflow[parent] ^= {child_z}

return new_xflow, new_zflow


def pauli_simplification( # noqa: C901, PLR0912
graph: BaseGraphState,
xflow: Mapping[int, AbstractSet[int]],
zflow: Mapping[int, AbstractSet[int]] | None = None,
) -> tuple[dict[int, set[int]], dict[int, set[int]]]:
r"""Simplify the correction maps by removing redundant Pauli corrections.

Parameters
----------
graph : `BaseGraphState`
Underlying graph state.
xflow : `collections.abc.Mapping`\[`int`, `collections.abc.Set`\[`int`\]\]
Correction map for X.
zflow : `collections.abc.Mapping`\[`int`, `collections.abc.Set`\[`int`\]\] | `None`
Correction map for Z. If `None`, it is generated from xflow by odd neighbors.

Returns
-------
`tuple`\[`dict`\[`int`, `set`\[`int`\]\], `dict`\[`int`, `set`\[`int`\]\]]
Updated correction maps for X and Z after simplification.
"""
if zflow is None:
zflow = {node: odd_neighbors(xflow[node], graph) - {node} for node in xflow}

new_xflow = {k: set(vs) for k, vs in xflow.items()}
new_zflow = {k: set(vs) for k, vs in zflow.items()}

inv_xflow: dict[int, set[int]] = {}
inv_zflow: dict[int, set[int]] = {}
for k, vs in xflow.items():
for v in vs:
inv_xflow.setdefault(v, set()).add(k)
for k, vs in zflow.items():
for v in vs:
inv_zflow.setdefault(v, set()).add(k)

for node in graph.physical_nodes - graph.output_node_indices.keys():
meas_basis = graph.meas_bases.get(node)
if meas_basis is None:
continue
meas_axis = determine_pauli_axis(meas_basis)
if meas_axis is None:
continue

if meas_axis == Axis.X:
for parent in inv_xflow.get(node, set()):
new_xflow[parent] -= {node}
elif meas_axis == Axis.Z:
for parent in inv_zflow.get(node, set()):
new_zflow[parent] -= {node}
elif meas_axis == Axis.Y:
for parent in inv_xflow.get(node, set()) & inv_zflow.get(node, set()):
new_xflow[parent] -= {node}
new_zflow[parent] -= {node}

return new_xflow, new_zflow
Loading
Loading