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

Update DecompositionUndefinedError for Exp class #4571

Merged
merged 6 commits into from
Sep 8, 2023
Merged

Conversation

Jaybsoni
Copy link
Contributor

@Jaybsoni Jaybsoni commented Sep 5, 2023

Context:
When calling the decomposition for the Exp class with num_steps specified, an error was raised suggesting to set num_steps. The real source of the error was caused because the underlying operator was not unitary. The error message was misleading.

Description of the Change:
Update the decomposition function to perform added validation before raising error.

Benefits:
More informative error messages.

Possible Drawbacks:
None

Related GitHub Issues:
Fixes #4537

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

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.

@Jaybsoni
Copy link
Contributor Author

Jaybsoni commented Sep 5, 2023

[sc-44544]

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ea7423e) 99.64% compared to head (709ca0d) 99.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4571   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files         376      376           
  Lines       33071    33076    +5     
=======================================
+ Hits        32955    32960    +5     
  Misses        116      116           
Files Changed Coverage Δ
pennylane/ops/op_math/exp.py 98.81% <100.00%> (+0.03%) ⬆️

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

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

Nice 🚀

@Jaybsoni Jaybsoni enabled auto-merge (squash) September 8, 2023 17:34
@Jaybsoni Jaybsoni merged commit df45c72 into master Sep 8, 2023
39 checks passed
@Jaybsoni Jaybsoni deleted the fix_exp_error branch September 8, 2023 18:03
mudit2812 pushed a commit that referenced this pull request Sep 8, 2023
**Context:**
When calling the decomposition for the `Exp` class with `num_steps`
specified, an error was raised suggesting to set `num_steps`. The real
source of the error was caused because the underlying operator was not
unitary. The error message was misleading.

**Description of the Change:**
Update the decomposition function to perform added validation before
raising error.

**Benefits:**
More informative error messages.

**Possible Drawbacks:**
None

**Related GitHub Issues:**
Fixes #4537
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.

[BUG] Using qml.exp with a real coefficient raises an unintuitive error on decomposition
3 participants