[Feature][QDP] Prototype interoperability with PennyLane and Qiskit

Open
#1,611 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python, rust

Research direction

Start with the Q4 interoperability discussion #1465 and the one-encode-path work in #1477, then locate the existing Encoder path and the framework APIs for state preparation. Define the adapter mapping and supported circuit subset, implement both milestones with optional framework imports, and add mapping tests, a design note, and one runnable example per framework. Done means the documented prototype handles the supported cases and rejects unsupported operations with a list of them.

Written by the indexing model from the issue text.

Description

bug docs enhancement question
Description

Add a small interoperability prototype so PennyLane and Qiskit users can use QDP for data encoding without adopting QuMat first.

The first milestone exposes QDP-encoded states as framework-native objects. A second milestone accepts a narrow, documented state-preparation circuit from each framework and maps it onto existing QDP encodings. This is a prototype to learn whether the workflow is useful, not a new execution engine.

Use case

A user already has a PennyLane QNode or a Qiskit circuit and wants QDP's GPU encoding and memory planning. Today they must either rebuild the preparation in QuMat or move intermediate arrays by hand. Circuit.initialize(state) covers the Qiskit case inside QuMat, but there is no direct framework-native entry point and no PennyLane support.

This is the interoperability area from the Q4 roadmap discussion (#1465): QDP as a preparation layer that other frameworks can call.

Proposed solution and alternatives

Proposed module: qumat.interop (name open for discussion), with framework modules imported lazily so neither PennyLane nor Qiskit becomes a hard dependency.

Milestone 1, QDP to framework:

  • encode_state(data, encoding=..., num_qubits=...) that calls the existing Encoder path and returns a state vector.
  • pennylane.state(...) returns an array suitable for qml.StatePrep / qml.QubitStateVector.
  • qiskit.state(...) returns a qiskit.quantum_info.Statevector or an initialize instruction.
  • The adapter should accept either an Encoder-produced tensor or a precomputed NumPy state vector, so mapping and framework handoff can be tested without a GPU. The end-to-end path uses the existing CUDA/AMD Encoder; there is no CPU QDP encoder today.
  • Tests skip cleanly when the optional framework is not installed.

Milestone 2, framework to QDP:

  • from_pennylane(circuit) and from_qiskit(circuit) for a documented subset only: basis-state preparation, amplitude state preparation, and angle encoding.
  • Reject unsupported operations with an error that lists them.
  • Do not transpile arbitrary gate sets.

Deliverables:

  • Prototype module.
  • Short design note covering the mapping, the supported subset, and where the adapter sits relative to QuMat and QDP.
  • Unit tests for the mapping.
  • One runnable example per framework.

Alternatives considered:

  • Full circuit transpilation into QuMat. Too large for a prototype and duplicates work in both frameworks.
  • Documentation-only array export. Does not close the workflow gap.

Out of scope:

  • Full gate-set transpilation.
  • QPU execution.
  • Replacing PennyLane or Qiskit.
  • New encodings.
  • Bypassing the one-encode-path work in #1477.
Related issues
  • Discussion #1465 (Q4 roadmap, interoperability area)
  • #1477 (one encode path), which the adapter should call
  • #1431 (Preprocessor bindings), if input validation is reused
Are you willing to submit a PR?

Yes.

Dominant language
Rust
Stars
2.3k
Forks
1k
Avg merge
2d 20h
Merged PRs (30d)
7

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/mahout

All issues in apache/mahout

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.