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

Custom boolean functions for supporting noise models #5674

Merged
merged 74 commits into from
Jun 11, 2024

Conversation

obliviateandsurrender
Copy link
Contributor

@obliviateandsurrender obliviateandsurrender commented May 9, 2024

Context: We aim to have a custom boolean function that could serve as a building block for creating noise models.

Description of the Change:

  1. Generalizes the existing BooleanFn to work with arbitrary args and kwargs.
  2. Adds NoiseConditionals as a class that helps build BooleanFn required for creating noise models.
  3. Adds methods like wire/op_eq/in to enhance the building experience for the above BooleanFn.

Benefits:

Possible Drawbacks:

Related GitHub Issues: [sc-63080]

Copy link
Contributor

github-actions bot commented May 9, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented May 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (b7b4b75) to head (e2e7a31).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5674      +/-   ##
==========================================
- Coverage   99.68%   99.67%   -0.01%     
==========================================
  Files         415      417       +2     
  Lines       38898    38748     -150     
==========================================
- Hits        38774    38623     -151     
- Misses        124      125       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trbromley
Copy link
Contributor

Thanks @obliviateandsurrender! Would you mind linking the corresponding SC story?

pennylane/boolean_fn.py Outdated Show resolved Hide resolved
pennylane/boolean_fn.py Outdated Show resolved Hide resolved
@obliviateandsurrender obliviateandsurrender marked this pull request as ready for review May 10, 2024 21:35
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks good to go 💯. A left a few comments, also would suggest adding some tests for wires_in and wires_eq comparing with operations (specifically with operations of multiple wires like CNOT or some template)

Good job!

pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
Copy link
Contributor

@KetpuntoG KetpuntoG left a comment

Choose a reason for hiding this comment

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

Looks great, good job! Here are a few minor comments.
I've been also doing a lot of tricky testing and I see it's bulletproof 😎

pennylane/noise/conditionals.py Show resolved Hide resolved
pennylane/noise/conditionals.py Show resolved Hide resolved
pennylane/noise/conditionals.py Show resolved Hide resolved
tests/noise/test_conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @obliviateandsurrender! Really excited for this feature and thank you for making it a reality. I've left comments primarily around the documentation.

doc/code/qml_noise.rst Outdated Show resolved Hide resolved
doc/code/qml_noise.rst Outdated Show resolved Hide resolved
doc/code/qml_noise.rst Outdated Show resolved Hide resolved
doc/code/qml_noise.rst Show resolved Hide resolved
doc/code/qml_noise.rst Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
pennylane/noise/conditionals.py Outdated Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @obliviateandsurrender, approved! I'll look at the follow up PRs over the coming days.

doc/code/qml_noise.rst Outdated Show resolved Hide resolved
doc/code/qml_noise.rst Show resolved Hide resolved
@obliviateandsurrender obliviateandsurrender merged commit 6599b3b into master Jun 11, 2024
40 checks passed
@obliviateandsurrender obliviateandsurrender deleted the noise-models-1 branch June 11, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants