Skip to content

Commit 5a103dd

Browse files
committed
Set concrete truncation strategy directly into decomposition alg
1 parent 86c0ad1 commit 5a103dd

4 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/algorithms/ctmrg/c4v.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Compute the C₄ᵥ projector from `eigh` decomposing the Hermitian `enlarged_co
191191
Also return the normalized eigenvalues as the new corner tensor.
192192
"""
193193
function c4v_projector!(enlarged_corner, alg::C4vEighProjector)
194-
alg = @set alg.trunc = truncation_strategy(alg, enlarged_corner)
194+
alg = _set_truncation(alg, truncation_strategy(alg, enlarged_corner))
195195
eigh_alg = decomposition_algorithm(alg)
196196

197197
D, V, truncation_error = eigh_trunc!(enlarged_corner, eigh_alg)

src/algorithms/ctmrg/projectors.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ end
5555
5656
Return the tensor decomposition algorithm of the `alg` projector algorithm.
5757
"""
58-
function decomposition_algorithm(alg::ProjectorAlgorithm)
59-
decomposition_alg = alg.decomposition_alg
60-
decomposition_alg = @set decomposition_alg.trunc = alg.trunc
61-
return decomposition_alg
62-
end
58+
decomposition_algorithm(alg::ProjectorAlgorithm) = alg.decomposition_alg
6359

6460
function truncation_strategy(alg::ProjectorAlgorithm, edge)
6561
if alg.trunc isa FixedSpaceTruncation
@@ -77,7 +73,7 @@ Update the truncation strategy of a given projector algorithm, keeping all other
7773
the same.
7874
"""
7975
function _set_truncation(alg::ProjectorAlgorithm, trunc::TruncationStrategy)
80-
alg´ = @set alg.trunc = trunc
76+
alg´ = @set alg.decomposition_alg.trunc = trunc
8177
return alg´
8278
end
8379

src/algorithms/ctmrg/sequential.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ function sequential_projectors(
9595
_, r, c = coordinate
9696
r′ = _prev(r, size(env, 2))
9797
trunc = truncation_strategy(alg, env.edges[WEST, r′, c])
98-
alg = @set alg.trunc = trunc
98+
alg´ = _set_truncation(alg, trunc)
9999
Q1 = TensorMap(EnlargedCorner(network, env, (SOUTHWEST, r, c)))
100100
Q2 = TensorMap(EnlargedCorner(network, env, (NORTHWEST, r′, c)))
101-
return compute_projector((Q1, Q2), alg)
101+
return compute_projector((Q1, Q2), alg´)
102102
end
103103
function sequential_projectors(
104104
coordinate::NTuple{3, Int}, network, env::CTMRGEnv, alg::FullInfiniteProjector
@@ -108,14 +108,14 @@ function sequential_projectors(
108108
coordinate_ne = _next_coordinate(coordinate_nw, rowsize, colsize)
109109
coordinate_se = _next_coordinate(coordinate_ne, rowsize, colsize)
110110
trunc = truncation_strategy(alg, env.edges[WEST, coordinate_nw[2:3]...])
111-
alg = @set alg.trunc = trunc
111+
alg´ = _set_truncation(alg, trunc)
112112
ec = (
113113
TensorMap(EnlargedCorner(network, env, coordinate_se)),
114114
TensorMap(EnlargedCorner(network, env, coordinate)),
115115
TensorMap(EnlargedCorner(network, env, coordinate_nw)),
116116
TensorMap(EnlargedCorner(network, env, coordinate_ne)),
117117
)
118-
return compute_projector(ec, alg)
118+
return compute_projector(ec, alg´)
119119
end
120120

121121
"""

src/algorithms/ctmrg/simultaneous.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function simultaneous_projectors(
9595
) where {E}
9696
coordinate′ = _next_coordinate(coordinate, size(env)[2:3]...)
9797
trunc = truncation_strategy(alg, env.edges[coordinate[1], coordinate′[2:3]...])
98-
alg′ = @set alg.trunc = trunc
98+
alg′ = _set_truncation(alg, trunc)
9999
ec = (enlarged_corners[coordinate...], enlarged_corners[coordinate′...])
100100
return compute_projector(ec, alg′)
101101
end
@@ -107,7 +107,7 @@ function simultaneous_projectors(
107107
coordinate3 = _next_coordinate(coordinate2, rowsize, colsize)
108108
coordinate4 = _next_coordinate(coordinate3, rowsize, colsize)
109109
trunc = truncation_strategy(alg, env.edges[coordinate[1], coordinate2[2:3]...])
110-
alg′ = @set alg.trunc = trunc
110+
alg′ = _set_truncation(alg, trunc)
111111
ec = (
112112
enlarged_corners[coordinate4...],
113113
enlarged_corners[coordinate...],

0 commit comments

Comments
 (0)