Probability of a POVM

Hi everyone,
I don’t k ow if it’s a naive question,but here it is my doubt.
If I have my physical system encoded into an MPS \ket{\psi_0},how can measure a POVM, constructed by local operator acting on a single site?
In more detail, how can I put in code the following expression:

P=tr(\rho*M)

where \rho=\ket{\psi_0}\bra{\psi_0} and M is something like M=\mathbb{1}\otimes\mathbb{1}. . .\otimes M. . .\otimes 1\otimes 1\otimes 1.
Thank you in advance for your help :slight_smile:

If your MPS represents a pure state \ket{\psi_0} then \rho = \ket{\psi_0}\bra{\psi_0} and then

P = \text{Tr}[\rho M] = \text{Tr}[\ket{\psi_0}\bra{\psi_0} M] = \bra{\psi_0} M \ket{\psi_0}

So it is just a regular measurement of a local operator. Then you can use the expect method to do this measurement. Here is a link to the documentation about that method.

For example, if your operator M=S^z_7 then you could do:

values = expect(psi,"Sz",sites=7) # Julia code

If your operator is not one provided with ITensor, you can pass a custom matrix to the expect function as well.

I just noticed this question is in the “C++ Questions” category, so here are your similar options for C++ ITensor:

We also have an expect function in C++ which takes operators that are supported by the SiteSet you are using. You can optionally pass a range of sites to measure over, such as

auto values = expect(psi,sites,"Sz",range1(2,4));

Alternatively you can measure a custom ITensor operator using the following “Code Formula” tutorial:
http://itensor.org/docs.cgi?vers=cppv3&page=formulas/measure_mps

1 Like

Thank you as always Miles !

1 Like