GTorlai / PastaQ.jl

Package for Simulation, Tomography and Analysis of Quantum Computers
Apache License 2.0
142 stars 23 forks source link

contract(::MPS, ::MPS) #179

Open mtfishman opened 3 years ago

mtfishman commented 3 years ago

Implement a function contract(::MPS, ::MPS)/*(::MPS, ::MPS) that contracts two MPS over common site indices down to an ITensor. This would make it easy to compute a reduced density matrix, for example:

psi = MPS(...)
psidag = dag(psi)
rho_4 = contract(prime(psidag, siteind(psidag, 4)), psi)

A question about the design would be if you did something like this:

contract(psidag', psi)

it would be an outer product of the two MPS, which would be exponentially large. In theory it could output an MPO in that case, but then one would have to decide what the threshold is for making an MPO vs an ITensor.