8000 PurificationMPS.overlap() equal to MPS.overlap(). How to compute physical distances with PurificationMPS? · Issue #502 · tenpy/tenpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PurificationMPS.overlap() equal to MPS.overlap(). How to compute physical distances with PurificationMPS? #502

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

Closed
victorbayonamarchal opened this issue Apr 24, 2025 · 6 comments

Comments

@victorbayonamarchal
Copy link

Hello!
I have found myself recently with the problem of encoding density matrices in PurificationMPS. Once I have encoded the purification of the state to a PurificationMPS, I want to compute the distance between this PurificationMPS and another one to see if it is the same as the distance between the original density matrices. However, when computing the overlap over two PurificationMPS, I get the same as encoding the array as MPS. Is there a way to compute the distance over the physical part of the PurificationMPS?
Thank you!

@Jakob-Unfried
Copy link
Member

Hi, can you clarify exactly which distance/overlap you are interested in?

We probably dont have it out of the box, but I can help you get there

@victorbayonamarchal
Copy link
Author

I'm interested in measuring an analogous "Frobenius distance" for PurificationMPS, only accounting (somehow, I'm not quite sure how this could be done) for the physicial legs in the tensor. The context is that I am trying to measure convergence properties of different time evolutions given two random initial states. In terms of density matrices, I use the usual Frobenius distance, and I would like to find something similar when working with tensor networks.

Thank you again for the help!

@Jakob-Unfried
Copy link
Member

So you need overlaps of the form $\mathrm{Tr} [ \rho_1^\dagger \rho_2]$, correct?
are both of the density matrices given in terms of purification MPS?

@victorbayonamarchal
Copy link
Author

Yes, those kinds of overlaps, but tracing out the ancillary part in the PurificationMPS. I'm only interested in the distance of the physical part of the tensor.

@Jakob-Unfried
Copy link
Member
Jakob-Unfried commented Apr 25, 2025

Ok, gotcha.
This does not exist out of the box (in fact we are missing quite a few of these utility functions in purification MPS to deal with the density matrix it represents, see e.g. #501 )

First, what you need to do to compute this:
Normally, for pure MPS we care about overlaps like $<\phi|\psi>$ which are a diagram that has 2 MPS tensors per site, one from $\phi$ and one from $\psi$ .
This is implemented in MPS.overlap, using the TransferMatrix and looks like

        |    ---M[i]---M[i+1]- ... --M[i+L]---
        |       |      |             |
        |    ---N[j]*--N[j+1]* ... --N[j+L]*--

For the overlap, we have i=j always (the TransferMatrix allows more general stuff in other places).

In this case, $\mathrm{Tr}[ \rho_1^\dagger \rho_2]$ has four MPS tensors per site, since to form one density matrix we already need two copies of its purification MPS.
The diagram now looks like

        |       .      .             .
        |       |      |             |
        |    ---M[i]*--M[i+1]* ... --M[i+L]*--
        |       |      |             |
        |    ---M[i]---M[i+1]- ... --M[i+L]---
        |       |      |             |
        |    ---N[j]*--N[j+1]* ... --N[j+L]*--
        |       |      |             |
        |    ---N[j]---N[j+1]  ... --N[j+L]---
        |       |      |             |
        |       .      .             .

where the dots indicate to connect the top wires with the bottom wires
and where we always contract physical-physical or ancilla-ancilla, i.e. tensors without star have physical legs at the bottom and ancillas at the top, and tensors with star the otherway around.

So the clean strategy for a proper implementation would be the following:

  • In purification_mps, create a class like DensityMatrixTransferMatrix that works like the TransferMatrix but implements the 4-layer diagram above.
  • In PurificationMPS, create a method like density_matrix_overlap that works like MPS.overlap but uses the DensityMatrixTransferMatrix instead

If you are up for a challenge to do this implementation cleanly, we would welcome a PR on this.
I dont think we will have bandwidth to it ourselves anytime soon.

@victorbayonamarchal
Copy link
Author

Thank you very much! It worked. I'll prepare a PR as soon as possible :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0