Hi everyone,
I am trying to compute the expectation value of the operator Sy with respect to a random MPS both for S=1/2 and S=1 and in both cases I get an error of the type InexactError: Float64(0.0 + 0.7071067811865475im)
.
This is my code:
using ITensors
N=5
sites=siteinds("S=1",N)
psi=randomMPS(sites,10)
expect(psi,"Sy", sites=3)
Moreover, if I try to compute the expectation value in a more direct way
orthogonalize!(psi,3)
inner(psi[3],apply(op("Sy",sites,3),psi[3]))
the result is always 0 plus some imaginary error of the order e-19, e.g. 0.0 - 2.700806352051885e-19im
.
On the contrary, for the other standard spin operators (S_x, S_+, …) the results are reasonable and do coincide.
Thank you in advance for your help!