Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
88590b0
add anisotropic Simple Update
sanderdemeyer Jun 6, 2025
e2eeb66
fix 3site su
sanderdemeyer Jun 6, 2025
996f9ba
Merge branch 'master' into su_anisotropic
sanderdemeyer Jun 16, 2025
308f3fb
make SiteDependentTruncation a new truncation scheme
sanderdemeyer Jun 16, 2025
72734de
Merge branch 'master' into su_anisotropic
sanderdemeyer Jun 16, 2025
58221d4
Merge branch 'master' into su_anisotropic
sanderdemeyer Jun 17, 2025
213b4f7
update on arguments and constructors
sanderdemeyer Jun 17, 2025
436f8cc
Fix 3-site SU for SiteDependentTruncationScheme
sanderdemeyer Jun 17, 2025
12ff1bd
small documentation update
sanderdemeyer Jun 17, 2025
b92df22
Change name and add rotl90
sanderdemeyer Jun 17, 2025
ff5930e
fix export
sanderdemeyer Jun 17, 2025
578b54e
change arguments in test
sanderdemeyer Jun 17, 2025
e06f568
add test for 3-site cluster update
sanderdemeyer Jun 18, 2025
076b3c8
change test to increase patch coverage
sanderdemeyer Jun 18, 2025
e515976
change name again
sanderdemeyer Jun 18, 2025
83c5ac8
Merge branch 'QuantumKitHub:master' into su_anisotropic
sanderdemeyer Jun 18, 2025
0e405f0
small updates
sanderdemeyer Jun 19, 2025
53d0ac6
Merge branch 'master' into su_anisotropic
sanderdemeyer Jun 19, 2025
acf19cb
rewrite mirror_antidiag
sanderdemeyer Jun 19, 2025
d1d1298
add test on non-square unit cell and fix bug
sanderdemeyer Jun 20, 2025
721cd2b
make the new test a separate test to test bipartite=true
sanderdemeyer Jun 20, 2025
ad21266
Restore old Heisenberg SU-AD test
Yue-Zhengyuan Jun 20, 2025
0ff0f7d
Add test of SU with SiteDependentTruncation
Yue-Zhengyuan Jun 20, 2025
136ec18
Add TODO on bipartite check for SiteDependentTruncation
Yue-Zhengyuan Jun 20, 2025
84a277f
Merge branch 'master' into su_anisotropic
sanderdemeyer Jun 24, 2025
5b98cc9
Update src/algorithms/time_evolution/simpleupdate3site.jl
sanderdemeyer Jun 24, 2025
ec2897c
remove redundant TensorKit. before TruncationScheme
sanderdemeyer Jun 24, 2025
0db17a0
remove redundant TensorKit. before TruncationScheme bis
sanderdemeyer Jun 24, 2025
1707d3c
remove redundant where clauses
lkdvos Jun 24, 2025
6854da9
Add selection support with symbol
lkdvos Jun 24, 2025
4eee139
Change back constant
lkdvos Jun 24, 2025
615fa7f
Also simplify rotation
lkdvos Jun 24, 2025
e70759a
Remove test on Hubbard SU with SiteDependentTruncation
Yue-Zhengyuan Jun 25, 2025
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
3 changes: 2 additions & 1 deletion src/PEPSKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ using .Defaults: set_scheduler!
export set_scheduler!
export SVDAdjoint, FullSVDReverseRule, IterSVD
export CTMRGEnv, SequentialCTMRG, SimultaneousCTMRG
export FixedSpaceTruncation, HalfInfiniteProjector, FullInfiniteProjector
export FixedSpaceTruncation, SiteDependentTruncation
export HalfInfiniteProjector, FullInfiniteProjector
export LocalOperator, physicalspace
export expectation_value, cost_function, product_peps, correlation_length, network_value
export correlator
Expand Down
20 changes: 16 additions & 4 deletions src/algorithms/time_evolution/simpleupdate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
col::Int,
gate::AbstractTensorMap{T,S,2,2},
peps::InfiniteWeightPEPS,
alg::SimpleUpdate,
trscheme::TensorKit.TruncationScheme,
) where {T<:Number,S<:ElementarySpace}
Nr, Nc = size(peps)
@assert 1 <= row <= Nr && 1 <= col <= Nc
Expand All @@ -47,7 +47,7 @@
B = _absorb_weights(B, peps.weights, row, cp1, Tuple(1:4), sqrtsB, false)
# apply gate
X, a, b, Y = _qr_bond(A, B)
a, s, b, ϵ = _apply_gate(a, b, gate, alg.trscheme)
a, s, b, ϵ = _apply_gate(a, b, gate, trscheme)
A, B = _qr_bond_undo(X, a, b, Y)
# remove environment weights
_allfalse = ntuple(Returns(false), 3)
Expand Down Expand Up @@ -94,7 +94,13 @@
direction == 1 ? gate : gate_mirrored,
(CartesianIndex(r, 1), CartesianIndex(r, 2)),
)
ϵ = _su_bondx!(r, 1, term, peps2, alg)
ϵ = _su_bondx!(

Check warning on line 97 in src/algorithms/time_evolution/simpleupdate.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate.jl#L97

Added line #L97 was not covered by tests
r,
1,
term,
peps2,
truncation_scheme(alg.trscheme; direction, r, c, mirror_antidiag=true),
)
peps2.vertices[rp1, 2] = deepcopy(peps2.vertices[r, 1])
peps2.vertices[rp1, 1] = deepcopy(peps2.vertices[r, 2])
peps2.weights[1, rp1, 2] = deepcopy(peps2.weights[1, r, 1])
Expand All @@ -106,7 +112,13 @@
direction == 1 ? gate : gate_mirrored,
(CartesianIndex(r, c), CartesianIndex(r, c + 1)),
)
ϵ = _su_bondx!(r, c, term, peps2, alg)
ϵ = _su_bondx!(
r,
c,
term,
peps2,
truncation_scheme(alg.trscheme; direction, r, c, mirror_antidiag=true),
)
end
end
if direction == 2
Expand Down
16 changes: 13 additions & 3 deletions src/algorithms/time_evolution/simpleupdate3site.jl
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@
end

function _su3site_se!(
row::Int, col::Int, gs::Vector{T}, peps::InfiniteWeightPEPS, alg::SimpleUpdate
row::Int,
col::Int,
gs::Vector{T},
peps::InfiniteWeightPEPS,
trscheme::TensorKit.TruncationScheme,
) where {T<:AbstractTensorMap}
Nr, Nc = size(peps)
@assert 1 <= row <= Nr && 1 <= col <= Nc
Expand All @@ -384,7 +388,7 @@
coords = ((row, col), (row, cp1), (rm1, cp1))
# weights in the cluster
wt_idxs = ((1, row, col), (2, row, cp1))
wts, ϵ = apply_gatempo!(Ms, gs; trunc=alg.trscheme)
wts, ϵ = apply_gatempo!(Ms, gs; trunc=trscheme)

Check warning on line 391 in src/algorithms/time_evolution/simpleupdate3site.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate3site.jl#L391

Added line #L391 was not covered by tests
for (wt, wt_idx) in zip(wts, wt_idxs)
peps.weights[CartesianIndex(wt_idx)] = wt / norm(wt, Inf)
end
Expand Down Expand Up @@ -418,7 +422,13 @@
for site in CartesianIndices(peps2.vertices)
r, c = site[1], site[2]
gs = gatempos[i][r, c]
_su3site_se!(r, c, gs, peps2, alg)
_su3site_se!(

Check warning on line 425 in src/algorithms/time_evolution/simpleupdate3site.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate3site.jl#L425

Added line #L425 was not covered by tests
r,
c,
gs,
peps2,
truncation_scheme(alg.trscheme, direction, r, c; mirror_antidiag=true),
)
end
peps2 = (i == 1) ? rotl90(peps2) : rotr90(peps2)
end
Expand Down
35 changes: 35 additions & 0 deletions src/algorithms/truncation/truncationschemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
"""
struct FixedSpaceTruncation <: TensorKit.TruncationScheme end

struct SiteDependentTruncation <: TensorKit.TruncationScheme
trschemes::Array{T,3} where {T<:TensorKit.TruncationScheme}
end

function SiteDependentTruncation(trscheme::TensorKit.TruncationScheme, Nr::Int, Nc::Int)
return SiteDependentTruncation(reshape(fill(trscheme, Nr, Nc), 2, Nr, Nc))

Check warning on line 15 in src/algorithms/truncation/truncationschemes.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/truncation/truncationschemes.jl#L14-L15

Added lines #L14 - L15 were not covered by tests
end

function SiteDependentTruncation(
trschemes::Tuple{T,S}, Nr::Int, Nc::Int
) where {T<:TensorKit.TruncationScheme,S<:TensorKit.TruncationScheme}
return SiteDependentTruncation(
reshape([trschemes[mod1(i, 2)] for i in 1:(2 * Nr * Nc)], 2, Nr, Nc)
)
end

const TRUNCATION_SCHEME_SYMBOLS = IdDict{Symbol,Type{<:TruncationScheme}}(
:fixedspace => FixedSpaceTruncation,
:notrunc => TensorKit.NoTruncation,
Expand All @@ -25,3 +41,22 @@

return isnothing(η) ? alg_type() : alg_type(η)
end

function truncation_scheme(trscheme::T; kwargs...) where {T<:TensorKit.TruncationScheme}
return trscheme
end

function truncation_scheme(
trscheme::SiteDependentTruncation;
direction::Int,
r::Int,
c::Int,
mirror_antidiag::Bool=false,
)
if mirror_antidiag && direction == 2
depth, Nr, Nc = size(trscheme.trschemes)
@assert depth == 2
return trscheme.trschemes[direction, Nc - c + 1, Nr - r + 1]
end
return trscheme.trschemes[direction, r, c]
end
27 changes: 26 additions & 1 deletion test/examples/heisenberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,32 @@ end
maxiter = 5000
for (n, (dt, tol)) in enumerate(zip(dts, tols))
Dbond2 = (n == 2) ? Dbond + 2 : Dbond
trscheme = truncerr(1e-10) & truncdim(Dbond2)
if n == 2
trscheme = SiteDependentTruncation(
(truncerr(tol) & truncdim(Dbond2), truncerr(tol) & truncdim(Dbond2 + 1)),
N1,
N2,
)
elseif n == 3
trscheme = SiteDependentTruncation(
reshape(
[truncerr(tol) & truncdim(Dbond2) truncerr(tol) & truncdim(Dbond2 + 1) truncerr(
tol
) & truncdim(
Dbond2
) truncerr(tol) & truncdim(Dbond2 + 1) truncerr(tol) & truncdim(Dbond2) truncerr(
tol
) & truncdim(
Dbond2
) truncerr(tol) & truncdim(Dbond2) truncerr(tol) & truncdim(Dbond2)],
2,
2,
2,
),
)
else
trscheme = truncerr(tol) & truncdim(Dbond2)
end
alg = SimpleUpdate(dt, tol, maxiter, trscheme)
result = simpleupdate(wpeps, ham, alg; bipartite=false)
wpeps = result[1]
Expand Down
Loading