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

Approximate equivalence checking #443

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

TeWas
Copy link
Contributor

@TeWas TeWas commented Aug 13, 2024

Description

Introducing approximate equivalence checking by computing the Frobenius inner product between 𝑈 and 𝑉 and comparing the result to a predefined threshold. This enhancement allows for a more flexible comparison that accounts for near-equivalent circuits. The DDAlternatingChecker and DDEquivalenceChecker have been adapted to incorporate this approach.

Additionally, the HybridSchrodingerFeynmanChecker has been added. The checker divides a circuit horizontally into two halves: a lower part and an upper part. This is achieved by cutting controlled gates that cross the middle line according to the Schmidt decomposition.

By leveraging key trace equalities - specifically,

  • $tr[L \otimes U] = tr[L] \cdot tr[U]$
  • $tr[L + U] = tr[L] + tr[U]$

we can treat the lower and upper circuit parts, as well as the summands from the Schmidt decomposition, independently. This enables parallel trace computation, allowing to check the equivalence of larger, yet shallow circuits.

Fixes #442

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 c++ Anything related to C++ code labels Aug 13, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 94.77912% with 13 lines in your changes missing coverage. Please review.

Project coverage is 95.4%. Comparing base (472e756) to head (b92d53e).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...c/checker/dd/DDHybridSchrodingerFeynmanChecker.cpp 93.5% 9 Missing ⚠️
...e/checker/dd/DDHybridSchrodingerFeynmanChecker.hpp 91.6% 2 Missing ⚠️
src/checker/dd/DDEquivalenceChecker.cpp 87.5% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #443     +/-   ##
=======================================
+ Coverage   95.3%   95.4%   +0.1%     
=======================================
  Files         40      42      +2     
  Lines       1835    2057    +222     
  Branches     224     261     +37     
=======================================
+ Hits        1749    1964    +215     
- Misses        86      93      +7     
Flag Coverage Δ
cpp 95.9% <94.7%> (+0.1%) ⬆️
python 93.8% <100.0%> (+<0.1%) ⬆️
Files with missing lines Coverage Δ
include/Configuration.hpp 0.0% <ø> (ø)
include/EquivalenceCheckingManager.hpp 100.0% <100.0%> (ø)
include/checker/EquivalenceChecker.hpp 100.0% <100.0%> (ø)
src/Configuration.cpp 100.0% <100.0%> (ø)
src/EquivalenceCheckingManager.cpp 93.5% <100.0%> (+1.0%) ⬆️
src/checker/dd/DDAlternatingChecker.cpp 98.7% <100.0%> (+<0.1%) ⬆️
src/mqt/qcec/configuration.py 100.0% <100.0%> (ø)
...e/checker/dd/DDHybridSchrodingerFeynmanChecker.hpp 91.6% <91.6%> (ø)
src/checker/dd/DDEquivalenceChecker.cpp 94.8% <87.5%> (-0.7%) ⬇️
...c/checker/dd/DDHybridSchrodingerFeynmanChecker.cpp 93.5% <93.5%> (ø)

... and 2 files with indirect coverage changes

@TeWas TeWas marked this pull request as ready for review October 10, 2024 06:21
@TeWas TeWas marked this pull request as draft October 11, 2024 07:37
@TeWas TeWas marked this pull request as ready for review October 14, 2024 06:49
test/test_hsf.cpp Fixed Show fixed Hide fixed
- Handle HSF-related errors in the EquivalenceCheckingManager via DDHybridSchrodingerFeynmanChecker::canHandle
- Refactor HSF to inherit from EquivalenceChecker instead of DDEquivalenceChecker and avoid redundant initializations
- Disable optimizations for the HSF checker
@burgholzer burgholzer added the minor Part of a minor release label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Anything related to C++ code feature New feature or request minor Part of a minor release
Projects
Status: In Progress
Status: In Progress
Development

Successfully merging this pull request may close these issues.

✨ Approximate Equivalence Checking
2 participants