Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Synthesis of Encoder Circuits for Stabilizer Codes #275

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

pehamTom
Copy link
Member

@pehamTom pehamTom commented Aug 30, 2024

Description

This PR introduces functionality to automatically synthesize encoder circuits for arbitrary stabilizer codes. Since this is closely related to state preparation circuit synthesis, this PR refactors and unifies the respective synthesis methods into a circuit_synthesis module.

Planned Features:

  • Optimal (gate or depth) encoder circuit synthesis for CSS codes
  • Heuristic encoder circuit synthesis for CSS codes
  • Optimal (gate or depth) circuit synthesis for non-CSS ancilla states
  • Heuristic circuit synthesis for non-CSS ancilla states

The last parts were canceled because qecc functionality already allows for the construction of such state preparation circuits.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@burgholzer burgholzer added feature New feature or request minor Minor version update refactor Changes the refactor the code base labels Aug 30, 2024
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 54 lines in your changes missing coverage. Please review.

Project coverage is 87.3%. Comparing base (bcec628) to head (dc782c6).

Files with missing lines Patch % Lines
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 91.0% 37 Missing ⚠️
src/mqt/qecc/circuit_synthesis/encoding.py 86.8% 15 Missing ⚠️
src/mqt/qecc/circuit_synthesis/state_prep.py 94.7% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #275     +/-   ##
=======================================
+ Coverage   83.5%   87.3%   +3.7%     
=======================================
  Files         49      51      +2     
  Lines       4148    4318    +170     
  Branches     372     372             
=======================================
+ Hits        3467    3770    +303     
+ Misses       681     548    -133     
Flag Coverage Δ *Carryforward flag
cpp 83.7% <ø> (ø) Carriedforward from fa49694
python 89.4% <90.4%> (+6.0%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
src/mqt/qecc/circuit_synthesis/__init__.py 100.0% <100.0%> (ø)
src/mqt/qecc/circuit_synthesis/simulation.py 84.7% <ø> (ø)
src/mqt/qecc/circuit_synthesis/state_prep.py 89.9% <94.7%> (ø)
src/mqt/qecc/circuit_synthesis/encoding.py 86.8% <86.8%> (ø)
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 91.0% <91.0%> (ø)

Comment on lines 75 to 88
# def gate_optimal_encoding_circuit(code: CSSCode) -> QuantumCircuit:
# """Synthesize an encoding circuit for the given CSS code using the minimal number of gates.

# Args:
# code: The CSS code to synthesize the encoding circuit for.
# optimize_depth: Whether to optimize the depth of the circuit.

# Returns:
# The synthesized encoding circuit and the qubits that are used to encode the logical qubits.
# """
# logging.info("Starting optimal encoding circuit synthesis.")
# checks, logicals, _ = _get_matrix_with_fewest_checks(code)
# checks, cnots = heuristic_gaussian_elimination(np.vstack((checks, logicals)), parallel_elimination=optimize_depth)
# cnots = cnots[::-1]

Check notice

Code scanning / CodeQL

Commented-out code

This comment appears to contain commented-out code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request minor Minor version update refactor Changes the refactor the code base
Projects
Status: In Progress
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants