question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong time value in Trotterized unitary

See original GitHub issue

Environment

  • Qiskit Terra version: 0.36.0
  • Python version: 3.8.8
  • Operating system: Mac 11.6.5

What is happening?

Computing a suzuki decomposition of a Hamiltonian for a given time t. If t is a float, everything works fine. If t is a Parameter object the value gets squared when it is bound.

How can we reproduce the issue?

from qiskit.opflow import X, Z, Suzuki
from qiskit.circuit import Parameter

time = 11.0
H = (X^X^X) + (Z^Z^Z)
U1 = Suzuki(1, order=1).convert(time * H)
print(U1)

t = Parameter('t')
U2 = Suzuki(1, order=1).convert(t * H)
U2_t = U2.bind_parameters({t:time})
print(U2_t)

which outputs on my device

ComposedOp([
  e^(-i*11.0 * XXX),
  e^(-i*11.0 * ZZZ)
])
ComposedOp([
  e^(-i*121.0 * (
    1.0 * XXX
  )),
  e^(-i*121.0 * (
    1.0 * ZZZ
  ))
])

What should happen?

What should happen is when the time value is bound to the Parameter object, it should show 11.0 inside the exponential, not 121.0.

Any suggestions?

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BramDocommented, Jun 5, 2022

I think we need to add

operator.coeff = 1

after getting coeff.

https://github.com/Qiskit/qiskit-terra/blob/2eee56616d50a9e26756f855ef4aa0135920ad78/qiskit/opflow/evolutions/trotterizations/suzuki.py#L62

I tried coeff = 1 instead of operator.coeff = 1. This solution works in my local qiskit terra. I will try to make with this solution my first contribution.

1 ComposedOp([ e^(-i*11.0 * XXX), e^(-i*11.0 * ZZZ) ]) 1 ComposedOp([ e^(-i*11.0 * ( 1.0 * XXX )), e^(-i*11.0 * ( 1.0 * ZZZ )) ])

1reaction
Cryoriscommented, Jun 2, 2022

Thanks for reporting this @ajrazander!

You can also use the PauliEvolutionGate instead, which we will shift to in the future 🙂

from qiskit.circuit import Parameter
from qiskit.circuit.library import PauliEvolutionGate
from qiskit.synthesis import SuzukiTrotter
from qiskit.opflow import X, Z

suzuki = SuzukiTrotter(order=2, reps=1)  # for order=1 you should use LieTrotter

time = 11.0
H = (X^X^X) + (Z^Z^Z)
U1 = PauliEvolutionGate(H, time=time, synthesis=suzuki).definition
print(U1)

t = Parameter('t')
U2 = PauliEvolutionGate(H, time=t, synthesis=suzuki).definition
U2_t = U2.bind_parameters({t:time})
print(U2_t)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ordering of Trotterization: Impact on Errors in Quantum ... - NCBI
The expectation value of the qubit Hamiltonian with this state is ... Firstly, the error will decrease with the number of time steps...
Read more >
Describing Trotterized Time Evolutions on Noisy Quantum ...
To perform such a digital simulation, the unitary time evolution is approximated ... in the Trotterized time evolution can be efficiently.
Read more >
Trotter Errors from Dynamical Structural Instabilities of Floquet ...
This results in a time evolution operator that is very different from ... changes in the phase-space structure of the Trotterized unitary.
Read more >
Trotterization in QM Theory 1 Introduction
energy values and the stationary states of the physical system. To get the time-dependant eigenvector |Ψ(t)〉, one needs the unitary ...
Read more >
Quantum localization bounds Trotter errors in digital ... - Science
This Trotterization comes inherently with an error that can be rigorously upper bounded via the accuracy of the global unitary time-evolution operator (3)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found