Closed PabloAndresCQ closed 1 month ago
In PR #119 I am supporting MPS simulation of two-qubit gates acting on non-adjacent qubits. Rather than by introducing SWAPs eagerly, this is done by "pushing" a "message tensor" from the left qubit the gate acts on to the right qubit. This approach is the same idea I have used for TTNxGate
. It is comparable to eagerly adding SWAPs before each gate, with the advantages that: (1) the cost (in terms of increase in bond dimensions) is at most the same as adding SWAPs before each gate, (2) the qubits stay in their original position, (3) by skipping the need of adding SWAP gates, the truncation_fidelity
applies directly to the gates originally in the circuit.
Check whether [the advantage of this method vs using
prepare_circuit_mps
] is generally true for other circuits.
It is not. Although shallow circuits run generally faster with the new methid, I have identified some deep circuits on square lattices that run faster if prepare_circuit_mps
is executed (SWAPs added) before passing the circuit to the simulator. I suspect this might be due to a poor qubit mapping at the beginning of the circuit.
As a consequence, prepare_circuit_mps
is still supported for users that want to try if routing can improve the simulation runtime.
If so, update _apply_2q_unitary in MPSxGate so that it does SWAPs on its own.
Done, as discussed above.
What about
MPSxMPO
? Does the same apply?
Yes, and the new PR includes an implementation of simulation of two-qubit gates on non-adjacent qubits for MPSxMPO
as well.
I have noticed that for a certain class of shallow circuits, applying SWAPs eagerly immediately before each two-qubit gate is better than the routing approach from
prepare_mps
.TODO:
_apply_2q_unitary
inMPSxGate
so that it does SWAPs on its own.MPSxMPO
? Does the same apply?