cda-tum / mqt-qcec

MQT QCEC - A tool for Quantum Circuit Equivalence Checking
https://mqt.readthedocs.io/projects/qcec
MIT License
90 stars 21 forks source link

🚸♻️ Streamline C++-Python Interface for `EquivalenceCheckingManager` #233

Closed burgholzer closed 1 year ago

burgholzer commented 1 year ago

Description

Up until now, an EquivalenceCheckingManager in Python could be constructed either from a Configuration object or via keyword arguments. In the verification methods this was used in an exclusive fashion, i.e., if keyword arguments were present, the configuration object was ignored. Not only is this kind of unintuitive, but this duality introduced lots of code in the bindings and all the different verification functions that had to distinguish between arguments provided in form of a configuration object or keyword arguments.

With this PR, this is no longer the case. Configuration objects are the only way to construct an EquivalenceCheckingManager now. To keep the interface of all the outfacing verification functions the same, a method is provided that parses keyword arguments into a configuration object. If a configuration object is already provided, keyword arguments override the existing values for the respective options. This means, that it is now possible to specify some (common) options in the form of a Configuration and other (on-demand) as keyword arguments.

Really happy about this change, as it removed quite some lines of code and simplified others.

Fixes #175

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Merging #233 (7d07e6e) into main (6563706) will increase coverage by 0.0%. The diff coverage is 100.0%.

@@          Coverage Diff          @@
##            main    #233   +/-   ##
=====================================
  Coverage   97.0%   97.0%           
=====================================
  Files         33      34    +1     
  Lines       1709    1721   +12     
  Branches     210     210           
=====================================
+ Hits        1658    1671   +13     
+ Misses        51      50    -1     
Flag Coverage Δ
cpp 97.0% <ø> (+<0.1%) :arrow_up:
python 97.3% <100.0%> (+0.3%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mqt/qcec/configuration.py 100.0% <100.0%> (ø)
mqt/qcec/parameterized.py 94.7% <100.0%> (-0.8%) :arrow_down:
mqt/qcec/verify.py 100.0% <100.0%> (ø)
mqt/qcec/verify_compilation_flow.py 100.0% <100.0%> (+3.0%) :arrow_up:
src/checker/dd/DDAlternatingChecker.cpp 88.8% <0.0%> (-1.2%) :arrow_down:
src/checker/dd/DDEquivalenceChecker.cpp 91.7% <0.0%> (+0.9%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.