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

Improving interface determination in pauli_decompose #4577

Merged
merged 5 commits into from
Sep 8, 2023

Conversation

obliviateandsurrender
Copy link
Contributor

@obliviateandsurrender obliviateandsurrender commented Sep 6, 2023

Context: Improving support for determining the non-numpy interfaces when enclosed within builtin types.

Description of the Change: We use next(iter([*matrix[0]]), [])) instead of matrix to determine the interface to work with.

Benefits: All interfaces are identified correctly for the provided matrix object.

Possible Drawbacks: None

Related GitHub Issues: None

@timmysilv
Copy link
Contributor

can you give an example for when this happens? I'm guessing something like batched matrices in a list? Perhaps a test would help highlight what you're fixing. While we're here, what was this line intended to do before this change?

@obliviateandsurrender
Copy link
Contributor Author

A very simple example might be the following - [[jnp.array(0), jnp.array(1)], [jnp.array(2), jnp.array(3)]]
Previously we would have recognized it as a numpy, but with the updated implementation it should be correctly identified as jax.

Copy link
Contributor

@DSGuala DSGuala 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 as soon as merge conflicts are solved 👍

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f0219b7) 99.64% compared to head (4090b1f) 99.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4577   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files         376      376           
  Lines       33123    33123           
=======================================
  Hits        33007    33007           
  Misses        116      116           
Files Changed Coverage Δ
pennylane/pauli/conversion.py 100.00% <100.00%> (ø)

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

@obliviateandsurrender obliviateandsurrender merged commit af17d7d into master Sep 8, 2023
38 checks passed
@obliviateandsurrender obliviateandsurrender deleted the paul-decomp-list branch September 8, 2023 21:27
mudit2812 pushed a commit that referenced this pull request Sep 12, 2023
**Context:** Improving support for determining the `non-numpy`
interfaces when enclosed within builtin types.

**Description of the Change:** We use `next(iter([*matrix[0]]), []))`
instead of `matrix` to determine the interface to work with.

**Benefits:** All interfaces are identified correctly for the provided
matrix object.

**Possible Drawbacks:** None

**Related GitHub Issues:** None
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.

3 participants