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
Added example file with Infinite MPS to finite MPS function #72
Conversation
Thanks @nbaldelli, I like the idea of adding "dummy tensors" at the boundaries so it looks more like a finite MPS without dangling indices. Here is a simpler implementation: function finite_mps(ψ::InfiniteCanonicalMPS, range::AbstractRange)
@assert isone(step(range))
ψ_finite = ψ.AL[range]
ψ_finite[last(range)] *= ψ.C[last(range)]
l0 = linkind(ψ.AL, first(range) - 1 => first(range))
lN = linkind(ψ.AR, last(range) => last(range) + 1)
ψ_finite = MPS([δ(l0, dag(l0)'); [ψ_finiteᵢ for ψ_finiteᵢ in ψ_finite]; δ(dag(lN), lN')])
set_ortho_lims!(ψ_finite, (last(range) + 1):(last(range) + 1))
return ψ_finite
end This seems worth adding to the package. Could you make a PR for that, with a simple test? Then we don't need to implement this as a separate example, but just add the use of I noticed that when I do: range = 1:6
correlation_matrix(finite_mps(ψ, range), "Sz", "Sz"; sites=(range .+ 1))
|
@nbaldelli I fixed the issue with range = 1:6
correlation_matrix(finite_mps(ψ, range), "Sz", "Sz"; sites=(range .+ 1)) should work (once the new version of ITensors.jl is registered). |
Hi Matt, just tested the code with your formulation of |
Thanks @nbaldelli. Could you run the formatter to format the code? You can use: julia> using JuliaFormatter, ITensorInfiniteMPS; format(pkgdir(ITensorInfiniteMPS)) |
Cleaning up the code, in the end I moved the example to |
@mtfishman I think everything is fine now |
It looks like you still need to add |
Great, thanks @nbaldelli! |
Related to #71.
I mainly added a function
toMPS
thatInfiniteCanonicalMPS
I added two functions computing the correlation matrix (by explicitly applying the operators) for both the infinite and infinite chain to check for consistency. I did not add the comparison with the correlation function from
ITensorCorrelators
as It would add a dependency.