Skip to content

🐛 fix check for density matrices in compute tables #568

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

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

burgholzer
Copy link
Member

Description

This PR fixes an easy to overlook bug in the compute table implementation. The check in the old implementation was never evaluating to true due to the types being used in the various compute tables.
This allowed matrix and density matrix nodes to me mixed because the subsequent condition was never checked.
This PR adjusts the condition so that the checks are evaluated for both, addition and multiplication of density matrices.

Note that this has quite some interesting consequences, where a density matrix can have two successors that have exactly the same structure, but are represented by different DDs due to one (0-successor) representing a density matrix and one (1-successor) representing a matrix. Although both successors have to represent diagonal matrices for this to occur.

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 fix Fix for something that isn't working DD Anything related to the DD package c++ Anything related to C++ code labels Mar 22, 2024
@burgholzer burgholzer self-assigned this Mar 22, 2024
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.2%. Comparing base (6be2196) to head (806283e).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #568   +/-   ##
=====================================
  Coverage   91.1%   91.2%           
=====================================
  Files        132     132           
  Lines      13896   13901    +5     
  Branches    2194    2195    +1     
=====================================
+ Hits       12672   12679    +7     
+ Misses      1224    1222    -2     
Flag Coverage Δ
cpp 90.9% <ø> (+<0.1%) ⬆️
python 99.5% <ø> (ø)
Files Coverage Δ
include/mqt-core/dd/ComputeTable.hpp 100.0% <ø> (ø)

... and 2 files with indirect coverage changes

@burgholzer burgholzer enabled auto-merge (squash) March 22, 2024 20:03
@burgholzer burgholzer merged commit e89b51f into main Mar 22, 2024
@burgholzer burgholzer deleted the fix-compute-table-lookup branch March 22, 2024 20:07
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 DD Anything related to the DD package fix Fix for something that isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant