bsc-quantic / Tenet.jl

Composable Tensor Network library in Julia
https://bsc-quantic.github.io/Tenet.jl/
Apache License 2.0
17 stars 1 forks source link

Extend `evolve` of an `MPS` with an `MPO` #169

Open jofrevalles opened 2 weeks ago

jofrevalles commented 2 weeks ago

Summary

This PR was left open in the legacy code in Qrochet (#35). This PR extends the evolve function, which evolves a Matrix Product State (MPS) using a Matrix Product Operator (MPO). The idea from @starsfordummies is that we contract the tensors of each corresponding site, and we then create the new λ with a kron product with the old λ (which come from the MPS) and the identity (comes from the MPO). Right now, this function only works for mps in the canonical form.

Example

Here we show how can we use this function:

julia> using Tenet

julia> ψ = rand(Chain, Open, State; n=8, χ=10); canonize!(ψ)
MPS (inputs=0, outputs=8)

julia> mpo = rand(Chain, Open, Operator; n=8, χ=10)
MPO (inputs=8, outputs=8)

julia> Tenet.@reindex! inputs(mpo) => outputs(ψ)
MPS (inputs=0, outputs=8)

julia> ψ = Tenet.evolve(ψ, mpo)
MPS (inputs=0, outputs=8)

julia> size.(tensors(ψ))
15-element Vector{Tuple{Int64, Vararg{Int64}}}:
 (8,)
 (40,)
 (80,)
 (100,)
 (80,)
 (40,)
 (8,)
 (2, 8)
 (2, 8, 40)
 (2, 40, 80)
 (2, 80, 100)
 (2, 100, 80)
 (2, 80, 40)
 (2, 40, 8)
 (2, 8)
mofeing commented 2 weeks ago

Yep, like I said in the previous PR, those virtual bond dimensions are a big problem.

jofrevalles commented 2 weeks ago

Yep, like I said in the previous PR, those virtual bond dimensions are a big problem.

I think that we just have to truncate.

mofeing commented 2 weeks ago

Yep, like I said in the previous PR, those virtual bond dimensions are a big problem.

I think that we just have to truncate.

Great, that should solve it.