diff --git a/src/mps.jl b/src/mps.jl index de71318..f5ca80e 100644 --- a/src/mps.jl +++ b/src/mps.jl @@ -896,7 +896,7 @@ function correlation_matrix( Li21 *= oᵢ * dag(psi[pL21])' else sᵢ = siteind(psi, pL21) - Li21 *= prime(dag(si[pL21]), !sᵢ) + Li21 *= prime(dag(psi[pL21]), !sᵢ) end Li21 *= psi[pL21] end diff --git a/test/base/test_mps.jl b/test/base/test_mps.jl index 65eed0e..015c06d 100644 --- a/test/base/test_mps.jl +++ b/test/base/test_mps.jl @@ -962,6 +962,9 @@ end @test inner(psi', MPO(a, s), psi) ≈ Cpm[i - ss + 1, j - ss + 1] end + # Test sites argument (also regression test for issue #105) + Cxz = correlation_matrix(psi, "X", "Z"; sites=2:2:6) + # Electron case s = siteinds("Electron", 8) psi = random_mps(s; linkdims=m)