Hi, Oinam; I'm a new postdoc at Virginia Tech, working on ctrlVQE. I've just discussed a couple of apparent bugs in the ctrlq code with other members of the group, and we wanted to share our thoughts with you.
Let T be the duration of an evolution. In the solve_trotter function, time separation is calculated as Δt=T/nstep, and a unitary U(t) is applied at both t=0 and t=T. It seems like the actual time separation should be Δt=T/(nstep-1).
Moreover, it seems like it's not exactly correct to apply equivalent Trotter steps at all times in tlist. One could omit t=0, amounting to a right-hand-side Riemann sum for the time integration, or omit t=T corresponding to an LHS integration (in which case tlist should be constructed with nsteps+1, and the current Δt calculation is correct; I've the idea that perhaps you meant to be using the LHS case, but maybe didn't realize numpy.linspace includes the endpoint?).
Better yet would be to apply a trapezoidal rule, writing U(t->t+Δt) = exp(-i Δt [H(t+Δt) + H(t)]/2) ≈ exp(-i Δt H(t+Δt) / 2) exp(-i Δt H(t) / 2). Ultimately, this simplifies to applying the same U(t) currently applied at each time step, except that U(t=0) and U(t=T) use an effective time separation Δt/2.
We also noted that one could apply an even more accurate higher-order product formula for each U(t->t+Δt), but this would significantly alter every U(t->t+Δt), instead of just the first and last, not likely worth the effort.
Hi, Oinam; I'm a new postdoc at Virginia Tech, working on ctrlVQE. I've just discussed a couple of apparent bugs in the ctrlq code with other members of the group, and we wanted to share our thoughts with you.
Let
Tbe the duration of an evolution. In thesolve_trotterfunction, time separation is calculated asΔt=T/nstep, and a unitaryU(t)is applied at botht=0andt=T. It seems like the actual time separation should beΔt=T/(nstep-1).Moreover, it seems like it's not exactly correct to apply equivalent Trotter steps at all times in
tlist. One could omitt=0, amounting to a right-hand-side Riemann sum for the time integration, or omitt=Tcorresponding to an LHS integration (in which casetlistshould be constructed withnsteps+1, and the currentΔtcalculation is correct; I've the idea that perhaps you meant to be using the LHS case, but maybe didn't realizenumpy.linspaceincludes the endpoint?).Better yet would be to apply a trapezoidal rule, writing
U(t->t+Δt) = exp(-i Δt [H(t+Δt) + H(t)]/2) ≈ exp(-i Δt H(t+Δt) / 2) exp(-i Δt H(t) / 2). Ultimately, this simplifies to applying the sameU(t)currently applied at each time step, except thatU(t=0)andU(t=T)use an effective time separationΔt/2.We also noted that one could apply an even more accurate higher-order product formula for each
U(t->t+Δt), but this would significantly alter everyU(t->t+Δt), instead of just the first and last, not likely worth the effort.