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

Merged
merged 38 commits into from
Nov 20, 2024

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.71804% with 53 lines in your changes missing coverage. Please review.

Project coverage is 88.0%. Comparing base (b53722d) to head (94b955f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 91.3% 36 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   84.9%   88.0%   +3.1%     
=======================================
  Files         51      53      +2     
  Lines       4664    4834    +170     
  Branches     372     372             
=======================================
+ Hits        3961    4257    +296     
+ Misses       703     577    -126     
Flag Coverage Δ *Carryforward flag
cpp 83.6% <ø> (-0.2%) ⬇️ Carriedforward from 485b222
python 90.3% <90.7%> (+4.7%) ⬆️

*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/simulation_det.py 92.2% <ø> (ø)
src/mqt/qecc/circuit_synthesis/state_prep_det.py 88.3% <100.0%> (ø)
src/mqt/qecc/circuit_synthesis/state_prep.py 95.1% <94.7%> (ø)
src/mqt/qecc/circuit_synthesis/encoding.py 86.8% <86.8%> (ø)
src/mqt/qecc/circuit_synthesis/synthesis_utils.py 91.3% <91.3%> (ø)

... and 1 file with indirect coverage changes

---- 🚨 Try these New Features:

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.
@pehamTom pehamTom marked this pull request as ready for review November 20, 2024 14:29
@pehamTom pehamTom merged commit ef25257 into main Nov 20, 2024
21 of 22 checks passed
@pehamTom pehamTom deleted the encoding-circuits branch November 20, 2024 14:29
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: Done
Development

Successfully merging this pull request may close these issues.

3 participants