Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/algorithms/changebonds/optimalexpand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function changebonds(

# Use the nullspaces and SVD decomposition to determine the optimal expansion space
VL = left_null(ψ.AL[i])
VR = right_null!(_transpose_tail(ψ.AR[i + 1]))
VR = right_null!(_transpose_tail(ψ.AR[i + 1]; copy = true))
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd)

Expand All @@ -57,7 +57,7 @@ function changebonds(ψ::MultilineMPS, H, alg::OptimalExpand, envs = environment

# Use the nullspaces and SVD decomposition to determine the optimal expansion space
VL = left_null(ψ.AL[i, j])
VR = right_null!(_transpose_tail(ψ.AR[i, j + 1]))
VR = right_null!(_transpose_tail(ψ.AR[i, j + 1]; copy = true))
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd)

Expand Down Expand Up @@ -86,7 +86,7 @@ function changebonds!(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = envir

#Calculate nullspaces for left and right
NL = left_null(ψ.AC[i])
NR = right_null!(_transpose_tail(ψ.AR[i + 1]))
NR = right_null!(_transpose_tail(ψ.AR[i + 1]; copy = true))

#Use this nullspaces and SVD decomposition to determine the optimal expansion space
intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR))
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/changebonds/randexpand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function changebonds(ψ::InfiniteMPS, alg::RandExpand)

# Use the nullspaces and SVD decomposition to determine the optimal expansion space
VL = left_null(ψ.AL[i])
VR = right_null!(_transpose_tail(ψ.AR[i + 1]))
VR = right_null!(_transpose_tail(ψ.AR[i + 1]; copy = true))
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd)

Expand All @@ -49,7 +49,7 @@ function changebonds!(ψ::AbstractFiniteMPS, alg::RandExpand)

#Calculate nullspaces for left and right
NL = left_null(ψ.AC[i])
NR = right_null!(_transpose_tail(ψ.AR[i + 1]))
NR = right_null!(_transpose_tail(ψ.AR[i + 1]; copy = true))

#Use this nullspaces and SVD decomposition to determine the optimal expansion space
intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR))
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/groundstate/idmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG, envs = environments(o
h = AC_hamiltonian(pos, ψ, H, ψ, envs)
_, ψ.AC[pos] = fixedpoint(h, ψ.AC[pos], :SR, alg_eigsolve)

ψ.C[pos - 1], temp = right_orth!(_transpose_tail(ψ.AC[pos]))
ψ.C[pos - 1], temp = right_orth!(_transpose_tail(ψ.AC[pos]; copy = (pos == 1)))
ψ.AR[pos] = _transpose_front(temp)

transfer_rightenv!(envs, ψ, H, ψ, pos - 1)
Expand Down
4 changes: 2 additions & 2 deletions src/states/orthoview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Base.getindex(v::CView{<:FiniteMPS, E}, i::Int)::E where {E}
end

for j in Iterators.reverse((i + 1):center)
v.parent.Cs[j], tmp = lq_compact!(_transpose_tail(v.parent.ACs[j]); positive = true)
v.parent.Cs[j], tmp = lq_compact!(_transpose_tail(v.parent.ACs[j]; copy = true); positive = true)
v.parent.ARs[j] = _transpose_front(tmp)
if j != i + 1 # last AC not needed
v.parent.ACs[j - 1] = _mul_tail(v.parent.ALs[j - 1], v.parent.Cs[j])
Expand Down Expand Up @@ -89,7 +89,7 @@ end
function Base.setindex!(v::CView{<:FiniteMPS}, vec, i::Int)
if ismissing(v.parent.Cs[i + 1])
if !ismissing(v.parent.ALs[i])
v.parent.Cs[i + 1], temp = lq_compact!(_transpose_tail(v.parent.AC[i + 1]); positive = true)
v.parent.Cs[i + 1], temp = lq_compact!(_transpose_tail(v.parent.AC[i + 1]; copy = true); positive = true)
v.parent.ARs[i + 1] = _transpose_front(temp)
else
v.parent.ALs[i], v.parent.Cs[i + 1] = qr_compact(v.parent.AC[i]; positive = true)
Expand Down
2 changes: 1 addition & 1 deletion src/states/quasiparticle_state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function RightGaugedQP(
)
# find the left null spaces for the TNS
excitation_space = Vect[typeof(sector)](sector => 1)
VRs = convert(Vector, map(right_null! ∘ _transpose_tail, right_gs.AR))
VRs = convert(Vector, map(x -> right_null!(_transpose_tail(x; copy = true)), right_gs.AR))
Xs = map(enumerate(VRs)) do (i, vr)
x = similar(
vr,
Expand Down
16 changes: 8 additions & 8 deletions src/utility/utility.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function _transpose_front(t::AbstractTensorMap) # make TensorMap{S,N₁+N₂-1,1}
return repartition(t, numind(t) - 1, 1)
function _transpose_front(t::AbstractTensorMap; copy::Bool = false)
return repartition(t, numind(t) - 1, 1; copy)
end
function _transpose_tail(t::AbstractTensorMap) # make TensorMap{S,1,N₁+N₂-1}
return repartition(t, 1, numind(t) - 1)
function _transpose_tail(t::AbstractTensorMap; copy::Bool = false) # make TensorMap{S,1,N₁+N₂-1}
return repartition(t, 1, numind(t) - 1; copy)
end
function _transpose_as(t1::AbstractTensorMap, t2::AbstractTensorMap)
return repartition(t1, numout(t2), numin(t2))
function _transpose_as(t1::AbstractTensorMap, t2::AbstractTensorMap; copy::Bool = false)
return repartition(t1, numout(t2), numin(t2); copy)
end

_mul_front(C, A) = _transpose_front(C * _transpose_tail(A))
Expand All @@ -28,7 +28,7 @@ function decompose_localmpo(

leftind = (N + 1, 1, 2)
rightind = (ntuple(x -> x + N + 1, N - 1)..., reverse(ntuple(x -> x + 2, N - 2))...)
V, C = left_orth!(transpose(inpmpo, (leftind, rightind)); trunc)
V, C = left_orth!(transpose(inpmpo, (leftind, rightind); copy = true); trunc)

A = transpose(V, ((2, 3), (1, 4)))
B = transpose(C, ((1, reverse(ntuple(x -> x + N, N - 2))...), ntuple(x -> x + 1, N - 1)))
Expand All @@ -43,7 +43,7 @@ function decompose_localmps(

leftind = (1, 2)
rightind = reverse(ntuple(x -> x + 2, N - 1))
A, C = left_orth!(transpose(state, (leftind, rightind)); trunc)
A, C = left_orth!(transpose(state, (leftind, rightind); copy = true); trunc)
B = _transpose_front(C)
return [A; decompose_localmps(B)]
end
Expand Down