Skip to content

Conversation

@KetpuntoG
Copy link
Contributor

@KetpuntoG KetpuntoG commented Nov 4, 2025

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    test directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the doc/releases/changelog-dev.md file, summarizing the
    change, and including a link back to the PR.

  • The PennyLane source code conforms to
    PEP8 standards.
    We check all of our code against Pylint.
    To lint modified files, simply pip install pylint, and then
    run pylint pennylane/path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:

A new template MultiplexerStatePreparation has been added. This template allows prepare arbitrary states
using SelectPauliRot operations.

[sc-100288]

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

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.

@KetpuntoG KetpuntoG changed the title template + tests Adding qml.MultiplexerStatePreparation Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.43%. Comparing base (768083a) to head (b5e6576).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8581   +/-   ##
=======================================
  Coverage   99.43%   99.43%           
=======================================
  Files         588      589    +1     
  Lines       62727    62783   +56     
=======================================
+ Hits        62373    62429   +56     
  Misses        354      354           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@obliviateandsurrender obliviateandsurrender left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG! Good work, leaving the first set of comments.

f"State vectors must be of length {2 ** len(wires)}; vector has length {n_amplitudes}."
)

norm = qml.math.linalg.norm(state_vector)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we always do the norm computation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean here? Maybe adding an attribute "check"?
(I based this in QROMStatePreparation)

@staticmethod
def compute_decomposition(state_vector, wires): # pylint: disable=arguments-differ
with qml.queuing.AnnotatedQueue() as q:
_multiplexer_state_prep_decomposition(state_vector, wires)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this also be queuing under the queuing context? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked with Astral and he linked to this example:

def compute_decomposition(

@DSGuala DSGuala requested review from DSGuala and soranjh November 19, 2025 16:17
@DSGuala
Copy link
Contributor

DSGuala commented Nov 19, 2025

[SC-104270]

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.

4 participants