-
Notifications
You must be signed in to change notification settings - Fork 53
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
Bloqs non-unitary gates #214
Comments
Cirq has a I considered adding functionality to the density matrix simulator to do this at simulation time, rather than requiring the user to transform the circuit in advance, but it ended up just being messy and not worth it. In particular you'd have to be able to add qubits dynamically to the simulation with this approach, and at the time this would break the whole pipeline. Possibly now with ancilla support, this would be easier. While doing this it occurred to me that there's probably a more space-efficient representation than a density matrix. I believe the classical bits should be representable by 2^N states, so the full state should be |
Oh, actually I did do a prototype of doing this at runtime. Completely forgot. |
And I guess one advantage of doing this at simulation time is that you don't have to fully unroll the loops in advance. So in a situation where the loop can't be unrolled but does deterministically halt, like |
One more thing, given the deferred measurements principle, you may not necessarily need to trace out the original, and thus not need a density matrix. You'd have to be able to account for ancillas representing the classical bits, but the state vector of that whole system should be enough to represent everything you need to know. Unless there are limitations to the deferred measurements principle that cause it not to apply in some situations. (In which case the deferred measurements transformer in Cirq probably needs fixed too--it intentionally does not add a dephase op after measurements, so that the resulting circuit could run in the state vector simulator). |
I would think that -- more often than not -- if you're measuring or deleting information, you'd want the density matrix rather than a statevector with a bunch of extra indices you thought you deleted. |
Yeah, but you might be able to peel that off at the very end, which would allow you to run the simulation as a state vector including the ancillas representing measurement, then get the partial trace of the actual qubits without those ancillas as the final step. It'd be more efficient than maintaining a density matrix throughout the entire simulation, and allow quimb to continue doing most of the work. That's assuming the approach is logically correct of course, which I'm not 100% certain. |
One of the benefits of using something like quimb is that the tensor contraction ordering is distinct from the tensor network construction. Better yet: it will try to find a good contraction ordering automatically. As such, it's best to keep things as factored as possible when constructing the tensor network. If you're dealing with a lot of bits that get traced out (deleted), it's probably a lot more efficient to get rid of them as quickly as possible. |
Closing as redundant with the linked roadmap items. |
The bloqs data structure can represent non-unitary gates. For example: you can create a "measure" bloq that has one incoming wire and zero outgoing wires. This probably isn't ideal for interacting with protocols.
xref #445 #448
The text was updated successfully, but these errors were encountered: