Closed JustinS6626 closed 3 years ago
Well there's lots of ways to do this, the most useful of which probably depends on your ultimate aim. Here's two.
Setup:
%config InlineBackend.figure_formats = ['svg']
import quimb.tensor as qtn
L = 2**4
mera = qtn.MERA.rand_invar(L)
Circuit
circ = qtn.Circuit(L)
circ.cnot(3, 4)
(circ.psi & mera).draw(color=['PSI0', 'CNOT'])
The circuit methods by default split low-rank gates, thus the two tensors. This might be good if you are wanting to apply a lot of QC style gates.
import quimb as qu
psi = qtn.MPS_computational_state('0' * L, tags='PSI0')
psi.gate_(qu.CNOT(), (3, 4), tags='CNOT')
Might be good if you want to apply more arbitrary operators, the Circuit class is really calling this under the hood. Note two differences:
D=1
MPS (though these bonds could be squeeze
'd away).gate(..., contract='auto-split-gate')
These methods that work with an entire TensorNetwork1D
instance are probably more convenient than low level bond-cutting and inserting tensors manually, but I can give an example of that too if you want.
Thank you very much again! That helps a lot! There is one last thing I was wondering. Since I need to control the evolution of the state closely, I am using the circuit approach, and I am wondering the optimal method to use for evolving and measuring. If I evolve and measure the state as an MPS, will I lose the effects of the MERA setup? I am sorry for the endless stream of questions, but I am very inexperienced working with quimb, and with tensor network models in general.
On a note related to my earlier question regarding the connection of ket tensors to a MERA network, I am wondering about applying a gate between the ket tensors and the unitaries. Should I use the gate() method, or do I need to use the insert_operator method? I am particularly wondering about how to add a CNOT gate between kets and unitaries.