-
|
Is there a difference in what happens on hardware for quantum.reset(qubit)Versus quantum.discard(qubit)
qubit = quantum.qubit()? Logically, they do the same thing, but I am forced to use the first one ( Makes sense so far. But it's not clear to me whether the two snippets compile down to the same hardware instructions. And if they do not compile to the same hardware instructions, then it's not clear which version should be preferred (due to, say, imposing constraints on the compiler or ion movement). I would expect the two to compile down to the exact same hardware instructions, but I do not want to make assumptions. Any guidance? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
In general there is no guarantee they share behaviour, it is runtime dependent. On Quantinuum hardware also they are different. Reset persists the identity of the ion, discard-then-allocate does not. Meaning in the second case the new ion is in general different to the discarded, the runtime therefore has freedom to pick an ion for you. In terms of optimisation then: use reset if you're sure keeping a handle to the same ion is useful (e.g. if after reset you know it will interact with the same ion it was interacting with before, thereby avoiding transport), and use discard and allocate to allow the runtime to make optimised choices for you (such choices will improve over time as the transport and allocate routines in the runtime improve). |
Beta Was this translation helpful? Give feedback.
@mark-koch points out this is in fact possible with the
with_ownedguppy feature: