Skip to content

Commit

Permalink
Fix issue where SVDCut produces InfiniteMPS that is not full rank (#174)
Browse files Browse the repository at this point in the history
* Avoid using constructor that expects full-rank matrix in SVDCut algorithm

* Add warning in InfiniteMPS constructor
  • Loading branch information
lkdvos authored Aug 12, 2024
1 parent 5665754 commit 0c44f67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/algorithms/changebonds/svdcut.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ function changebonds(ψ::InfiniteMPS, alg::SvdCut)
copied[i + 1] = _transpose_front(U' * _transpose_tail(copied[i + 1]))
end

return normalize!(InfiniteMPS(copied, complex(ncr)))
# make sure everything is full rank:
makefullrank!(copied)

# if the bond dimension is not changed, we can keep the same center, otherwise recompute
ψ = if space(ncr, 1) != space(copied[1], 1)
InfiniteMPS(copied)
else
InfiniteMPS(copied, complex(ncr))
end
return normalize!(ψ)
end

function changebonds(ψ, H, alg::SvdCut, envs=environments(ψ, H))
Expand Down
3 changes: 3 additions & 0 deletions src/states/infinitemps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ end
function InfiniteMPS(AL::AbstractVector{<:GenericMPSTensor}, C₀::MPSBondTensor; kwargs...)
AL = PeriodicArray(copy.(AL))

all(isfullrank, AL) ||
@warn "Constructing an MPS from tensors that are not full rank"

# initialize tensor storage
AC = similar.(AL)
AR = similar.(AL)
Expand Down

0 comments on commit 0c44f67

Please sign in to comment.