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 27 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 71.70330% with 103 lines in your changes missing coverage. Please review.

Project coverage is 83.1%. Comparing base (d7c02d4) to head (50dd009).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 64.0% 72 Missing ⚠️
src/mqt/qecc/circuit_synthesis/state_prep.py 67.3% 16 Missing ⚠️
src/mqt/qecc/circuit_synthesis/encoding.py 86.8% 15 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #275     +/-   ##
=======================================
- Coverage   83.6%   83.1%   -0.5%     
=======================================
  Files         49      51      +2     
  Lines       4162    4343    +181     
  Branches     372     372             
=======================================
+ Hits        3481    3611    +130     
- Misses       681     732     +51     
Flag Coverage Δ *Carryforward flag
cpp 83.9% <ø> (ø) Carriedforward from d7c02d4
python 82.6% <71.7%> (-0.8%) ⬇️

*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/encoding.py 86.8% <86.8%> (ø)
src/mqt/qecc/circuit_synthesis/state_prep.py 71.9% <67.3%> (ø)
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 64.0% <64.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.
Also added example circuits for the five qubit code and the 8,3,3 Gottesman code.

Also moved Notebooks to example folder.
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