Skip to content

✨ added state preparation routines for GHZ and W state #445

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

Conversation

BertiFlorea
Copy link
Collaborator

@BertiFlorea BertiFlorea commented Oct 19, 2023

Description

In #341 the DD package provided methods for directly constructing DD for computational basis states or any product state that can be constructed from the single-qubit states |0>, |1>, |+>, |->, |L>, |R>.

Updates

There are now 2 routines which implement the

  • GHZ state
  • W state,
    also, there are unit tests which check that the preparation routines provide the desired states for a smaller number of qubits.

Fixes #341

Notes

In the beginning, I tried adding the routines to a different header file, however, I noticed that it was a lot easier to stick to the current structure and add the functions to the Package.hpp header inside the DD package. Additionally, I tried to use the existing functions in order to create & normalize the decision diagrams.

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 enhancement New feature or request DD Anything related to the DD package c++ Anything related to C++ code labels Oct 19, 2023
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #445 (ae4679c) into main (6809ce2) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #445   +/-   ##
=====================================
  Coverage   90.1%   90.1%           
=====================================
  Files        111     111           
  Lines      11817   11845   +28     
  Branches    2057    2065    +8     
=====================================
+ Hits       10649   10677   +28     
  Misses      1168    1168           
Flag Coverage Δ
cpp 89.9% <100.0%> (+<0.1%) ⬆️
python 100.0% <ø> (ø)
Files Coverage Δ
include/dd/Package.hpp 94.9% <100.0%> (+0.1%) ⬆️

@burgholzer burgholzer linked an issue Oct 19, 2023 that may be closed by this pull request
@burgholzer burgholzer added this to the DD Package Improvements milestone Oct 19, 2023
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋🏼

Many thanks for this nice initial contribution. I just went through your changes and left some comments on things that I believe still need a more detailed look/some changes.

Note that #444 will hopefully land soon and that might require some changes within this PR. No action item for now though.

Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the changes here! Looking way better already 👍🏼
I left some comments inline on how to improve it even further and a minor request for some more generic tests that I think would make sense.

Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the latest set of changes. We are really getting there. I think this should be the last round of changes requested. After that, we are good to merge.

@BertiFlorea BertiFlorea force-pushed the add-state-preparation-routines branch from eb03ca5 to 818983d Compare November 15, 2023 15:10
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for this nice addition!

@burgholzer burgholzer merged commit 305afc0 into munich-quantum-toolkit:main Nov 15, 2023
burgholzer added a commit that referenced this pull request Dec 15, 2023
## Description

One of the recently introduced tests (in #445) adjusted the DD package
tolerance to trigger a potential error.
However, that test did not restore the tolerance to its prior setting.
At least locally, this has led to quite some strange errors of
subsequent tests failing.
I am kind of puzzled that this hasn't led to any CI failures.
Anyway, this PR fixes the underlying issue by properly resetting the
tolerance to its original value.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

- [x] The pull request only contains commits that are related to it.
- [x] I have added appropriate tests and documentation.
- [x] I have made sure that all CI jobs on GitHub pass.
- [x] The pull request introduces no new warnings and follows the
project's style guidelines.
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ State Preparation Routines for DD Package
2 participants