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

Implement `Infinite` `Boundary` Conditions for `MatrixProduct` and `ProjectedEntangledPair` Types #79

Closed jofrevalles closed 11 months ago

jofrevalles commented 11 months ago

Summary

In this PR, we resolve #77 by extending our MatrixProduct and ProjectedEntangledPair types to include support for infinite boundary conditions, materialized in the infinite Matrix Product States (iMPS) and infinite Projected Entangled Pair States (iPEPS). This creates a structure where the tensors cycle periodically, emulating an infinite system by using a finite system unit cell that repeats itself.

The tensors, Base.show and Base.length functions have been extended to support TensorNetworks with Infinte boundary conditions. Additional unit tests have been added to ensure the proper functioning of these new boundary conditions for both the MPS and MPO structures.

Nevertheless, the visualization of infinite boundary types is not yet supported and we should think about how to implement this.

Example

Let's create a MatrixProduct{State, Infinite} which consists of a cell of three tensors that repeat indefinitely:

julia> _arrays = [rand(1, 1, 2), rand(1, 1, 2), rand(1, 1, 2)]
3-element Vector{Array{Float64, 3}}:
 [0.17136137178613753;;; 0.1659622523369414]
 [0.23387611601182623;;; 0.5187233455849274]
 [0.025368244393775274;;; 0.2701565528371912]

julia> ψ = MatrixProduct{State,Infinite}(_arrays, order = (:l, :r, :o))
TensorNetwork{MatrixProduct{State, Infinite}, NamedTuple{(:plug, :interlayer, :χ), Tuple{Type{<:Plug}, Vector{Bijection{Int64, Symbol}}, Union{Nothing, Int64}}}}(#tensors=∞, #labels=∞)

julia> tensors(ψ, 1) == tensors(ψ, 4) == tensors(ψ, -2)
true
codecov[bot] commented 11 months ago

Codecov Report

Merging #79 (0f14437) into master (9e5349d) will decrease coverage by 0.82%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   78.27%   77.46%   -0.82%     
==========================================
  Files           9        9              
  Lines         695      701       +6     
==========================================
- Hits          544      543       -1     
- Misses        151      158       +7     
Files Changed Coverage Δ
src/Quantum/PEP.jl 0.00% <0.00%> (ø)
src/Quantum/Quantum.jl 76.04% <ø> (ø)
src/Tenet.jl 25.00% <ø> (-75.00%) :arrow_down:
src/Quantum/MP.jl 90.10% <100.00%> (-0.80%) :arrow_down:
jofrevalles commented 11 months ago

@mofeing, your requested changes should be fixed