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

Rust exeception raised when transpiling PaulEvolutionGate with measurements against backend #13586

Open
nonhermitian opened this issue Dec 19, 2024 · 4 comments · May be fixed by #13591
Open
Labels
bug Something isn't working
Milestone

Comments

@nonhermitian
Copy link
Contributor

Environment

  • Qiskit version: 1.3.1
  • Python version:
  • Operating system: linux

What is happening?

backend = provider.backend('ibm_nazca')

hamiltonian = SparsePauliOp.from_list([('IXX', 1), ('IYY', 1), ('IZZ', 1),
                                       ('XXI', 1), ('YYI', 1), ('ZZI', 1)])

N = 8
qc = QuantumCircuit(3)
# Initial state 110
qc.x([1, 2])
op = PauliEvolutionGate(hamiltonian, time=1)
qc.append(op.power(N), [0,1,2])
qc.measure_all()

transpile(qc, backend)

gives

thread '' panicked at crates/circuit/src/interner.rs:147:14:
the caller is responsible for only using interner keys from the correct interner
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

PanicException: the caller is responsible for only using interner keys from the correct interner

How can we reproduce the issue?

run above

What should happen?

it should work. It does if I first compile against no backend, and then use those circuits as input to the backend transpile

Any suggestions?

No clue

@nonhermitian nonhermitian added the bug Something isn't working label Dec 19, 2024
@Cryoris
Copy link
Contributor

Cryoris commented Dec 20, 2024

This is caused by an issue in the UnitarySynthesis for 3+ qubit blocks (when calling op.power you convert the PauliEvo gate into a UnitaryGate), which is fixed by #13591.

Out of interest: Are you using power to repeat the circuit here or are you interested in the unitary of that power? I'm asking because power converts the gate to a matrix and then computes the matrix power. To repeat the gate object, you can use op.repeat(N).

@Cryoris Cryoris added this to the 1.3.2 milestone Dec 20, 2024
@nonhermitian
Copy link
Contributor Author

I am interested in applying the gate multiple times, which is what I expect the power op to do. There is no mention of any implementation difference between power and repeat, so an user is most likely unaware of the points you mention.

@jakelishman
Copy link
Member

Gate.power:

Raise this gate to the power of exponent.

Implemented either as a unitary gate (ref. UnitaryGate) or as an annotated operation (ref. AnnotatedOperation).

Gate.repeat:

Creates an instruction with self repeated :math:n times.

Do you have suggestions for how we could make this implementation difference clear for you?

@nonhermitian
Copy link
Contributor Author

Perhaps explicitly mention the power method is numerical and thus only works for small numbers of qubits, and then point users to the repeat method in the docstring for power?

Could also do a similar cross-reference for the repeat docstrings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants