diff --git a/src/algorithms/contractions/ctmrg/enlarge_corner.jl b/src/algorithms/contractions/ctmrg/enlarge_corner.jl index 013116da2..0dcfd32b7 100644 --- a/src/algorithms/contractions/ctmrg/enlarge_corner.jl +++ b/src/algorithms/contractions/ctmrg/enlarge_corner.jl @@ -25,10 +25,11 @@ Contract the enlarged northwest corner of the CTMRG environment, either by speci coordinates, environments and network, or by directly providing the tensors. ``` - C_northwest -- E_north -- + C_northwest -- E_north --in | | E_west -- A -- | | + out ``` """ function enlarge_northwest_corner( @@ -37,13 +38,10 @@ function enlarge_northwest_corner( ) return @tensor begin EC[χS DWt DWb; χ2] := E_west[χS DWt DWb; χ1] * C_northwest[χ1; χ2] - # already putting χE in front here to make next permute cheaper ECE[χS χE DWb DNb; DWt DNt] := EC[χS DWt DWb; χ2] * E_north[χ2 DNt DNb; χE] - ECEket[χS χE DEt DSt; DWb DNb d] := ECE[χS χE DWb DNb; DWt DNt] * ket(A)[d; DNt DEt DSt DWt] - corner[χS DSt DSb; χE DEt DEb] := ECEket[χS χE DEt DSt; DWb DNb d] * conj(bra(A)[d; DNb DEb DSb DWb]) end @@ -94,10 +92,11 @@ Contract the enlarged northeast corner of the CTMRG environment, either by speci coordinates, environments and network, or by directly providing the tensors. ``` - -- E_north -- C_northeast - | | - -- A -- E_east - | | + out-- E_north -- C_northeast + | | + -- A -- E_east + | | + in ``` """ function enlarge_northeast_corner( @@ -106,13 +105,10 @@ function enlarge_northeast_corner( ) return @tensor begin EC[χW DNt DNb; χ2] := E_north[χW DNt DNb; χ1] * C_northeast[χ1; χ2] - # already putting χE in front here to make next permute cheaper ECE[χW χS DNb DEb; DNt DEt] := EC[χW DNt DNb; χ2] * E_east[χ2 DEt DEb; χS] - ECEket[χW χS DSt DWt; DNb DEb d] := ECE[χW χS DNb DEb; DNt DEt] * ket(A)[d; DNt DEt DSt DWt] - corner[χW DWt DWb; χS DSt DSb] := ECEket[χW χS DSt DWt; DNb DEb d] * conj(bra(A)[d; DNb DEb DSb DWb]) end @@ -163,10 +159,11 @@ Contract the enlarged southeast corner of the CTMRG environment, either by speci coordinates, environments and network, or by directly providing the tensors. ``` - | | - -- A -- E_east - | | - -- E_south -- C_southeast + out + | | + -- A -- E_east + | | + in-- E_south -- C_southeast ``` """ function enlarge_southeast_corner( @@ -175,13 +172,10 @@ function enlarge_southeast_corner( ) return @tensor begin EC[χN DEt DEb; χ2] := E_east[χN DEt DEb; χ1] * C_southeast[χ1; χ2] - # already putting χE in front here to make next permute cheaper ECE[χN χW DEb DSb; DEt DSt] := EC[χN DEt DEb; χ2] * E_south[χ2 DSt DSb; χW] - ECEket[χN χW DNt DWt; DEb DSb d] := ECE[χN χW DEb DSb; DEt DSt] * ket(A)[d; DNt DEt DSt DWt] - corner[χN DNt DNb; χW DWt DWb] := ECEket[χN χW DNt DWt; DEb DSb d] * conj(bra(A)[d; DNb DEb DSb DWb]) end @@ -232,10 +226,11 @@ Contract the enlarged southwest corner of the CTMRG environment, either by speci coordinates, environments and network, or by directly providing the tensors. ``` + in | | E_west -- A -- | | - C_southwest -- E_south -- + C_southwest -- E_south --out ``` """ function enlarge_southwest_corner( @@ -244,13 +239,10 @@ function enlarge_southwest_corner( ) return @tensor begin EC[χE DSt DSb; χ2] := E_south[χE DSt DSb; χ1] * C_southwest[χ1; χ2] - # already putting χE in front here to make next permute cheaper ECE[χE χN DSb DWb; DSt DWt] := EC[χE DSt DSb; χ2] * E_west[χ2 DWt DWb; χN] - ECEket[χE χN DNt DEt; DSb DWb d] := ECE[χE χN DSb DWb; DSt DWt] * ket(A)[d; DNt DEt DSt DWt] - corner[χE DEt DEb; χN DNt DNb] := ECEket[χE χN DNt DEt; DSb DWb d] * conj(bra(A)[d; DNb DEb DSb DWb]) end diff --git a/src/algorithms/contractions/ctmrg/fullinf_env.jl b/src/algorithms/contractions/ctmrg/fullinf_env.jl index 47683b457..fc9a229d5 100644 --- a/src/algorithms/contractions/ctmrg/fullinf_env.jl +++ b/src/algorithms/contractions/ctmrg/fullinf_env.jl @@ -12,7 +12,9 @@ Contract four quadrants (enlarged corners) to form a full-infinite environment. |quadrant1| |quadrant2| |~~~~~~~~~| -- |~~~~~~~~~| | | | | + out | | | | + in | | | | | | |~~~~~~~~~| -- |~~~~~~~~~| |quadrant4| |quadrant3| @@ -26,7 +28,9 @@ In the same manner two halfs can be used to contract the full-infinite environme | half1 | |~~~~~~~~~~~~~~~~~~~~~~~~| | | | | + out | | | | + in | | | | | | |~~~~~~~~~~~~~~~~~~~~~~~~| | half2 | @@ -40,7 +44,9 @@ The environment can also be contracted directly from all its constituent tensors | | | | E_1 -- A_1 -- A_2 -- E_4 | | | | + out | | | | + in | | | | | | | E_8 -- A_4 -- A_3 -- E_5 | | | | @@ -54,6 +60,7 @@ Alternatively, contract the environment with a vector `x` acting on it | | | | E_1 -- A_1 -- A_2 -- E_4 | | | | + out | | | | [~~~~x~~~] | | | | | | @@ -112,15 +119,15 @@ function full_infinite_environment( E_1, E_2, E_3, E_4, E_5, E_6, E_7, E_8, A_1::P, A_2::P, A_3::P, A_4::P, ) where {P <: PEPSSandwich} - return @autoopt @tensor env[χ_in D_inabove D_inbelow; χ_out D_outabove D_outbelow] := - E_1[χ_in D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * - ket(A_1)[d1; D3 D11 D_inabove D1] * conj(bra(A_1)[d1; D4 D12 D_inbelow D2]) * + return @autoopt @tensor env[χ_out D_outabove D_outbelow; χ_in D_inabove D_inbelow] := + E_1[χ_out D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * + ket(A_1)[d1; D3 D11 D_outabove D1] * conj(bra(A_1)[d1; D4 D12 D_outbelow D2]) * ket(A_2)[d2; D5 D7 D9 D11] * conj(bra(A_2)[d2; D6 D8 D10 D12]) * E_3[χ3 D5 D6; χ4] * C_2[χ4; χ5] * E_4[χ5 D7 D8; χ6] * E_5[χ6 D13 D14; χ7] * C_3[χ7; χ8] * E_6[χ8 D15 D16; χ9] * ket(A_3)[d3; D9 D13 D15 D17] * conj(bra(A_3)[d3; D10 D14 D16 D18]) * - ket(A_4)[d4; D_outabove D17 D19 D21] * conj(bra(A_4)[d4; D_outbelow D18 D20 D22]) * - E_7[χ9 D19 D20; χ10] * C_4[χ10; χ11] * E_8[χ11 D21 D22; χ_out] + ket(A_4)[d4; D_inabove D17 D19 D21] * conj(bra(A_4)[d4; D_inbelow D18 D20 D22]) * + E_7[χ9 D19 D20; χ10] * C_4[χ10; χ11] * E_8[χ11 D21 D22; χ_in] end function full_infinite_environment( C_1, C_2, C_3, C_4, @@ -128,9 +135,9 @@ function full_infinite_environment( x::AbstractTensor{T, S, 3}, A_1::P, A_2::P, A_3::P, A_4::P, ) where {T, S, P <: PEPSSandwich} - return @autoopt @tensor env_x[χ_in D_inabove D_inbelow] := - E_1[χ_in D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * - ket(A_1)[d1; D3 D11 D_inabove D1] * conj(bra(A_1)[d1; D4 D12 D_inbelow D2]) * + return @autoopt @tensor env_x[χ_out D_outabove D_outbelow] := + E_1[χ_out D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * + ket(A_1)[d1; D3 D11 D_outabove D1] * conj(bra(A_1)[d1; D4 D12 D_outbelow D2]) * ket(A_2)[d2; D5 D7 D9 D11] * conj(bra(A_2)[d2; D6 D8 D10 D12]) * E_3[χ3 D5 D6; χ4] * C_2[χ4; χ5] * E_4[χ5 D7 D8; χ6] * E_5[χ6 D13 D14; χ7] * C_3[χ7; χ8] * E_6[χ8 D15 D16; χ9] * @@ -161,15 +168,15 @@ function full_infinite_environment( E_1, E_2, E_3, E_4, E_5, E_6, E_7, E_8, A_1::P, A_2::P, A_3::P, A_4::P, ) where {P <: PFTensor} - return @autoopt @tensor env[χ_in D_in; χ_out D_out] := - E_1[χ_in D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * - A_1[D1 D_in; D3 D11] * + return @autoopt @tensor env[χ_out D_out; χ_in D_in] := + E_1[χ_out D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * + A_1[D1 D_out; D3 D11] * A_2[D11 D9; D5 D7] * E_3[χ3 D5; χ4] * C_2[χ4; χ5] * E_4[χ5 D7; χ6] * E_5[χ6 D13; χ7] * C_3[χ7; χ8] * E_6[χ8 D15; χ9] * A_3[D17 D15; D9 D13] * - A_4[D21 D19; D_out D17] * - E_7[χ9 D19; χ10] * C_4[χ10; χ11] * E_8[χ11 D21; χ_out] + A_4[D21 D19; D_in D17] * + E_7[χ9 D19; χ10] * C_4[χ10; χ11] * E_8[χ11 D21; χ_in] end function full_infinite_environment( C_1, C_2, C_3, C_4, @@ -177,9 +184,9 @@ function full_infinite_environment( x::AbstractTensor{T, S, 2}, A_1::P, A_2::P, A_3::P, A_4::P, ) where {T, S, P <: PFTensor} - return @autoopt @tensor env_x[χ_in D_in] := - E_1[χ_in D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * - A_1[D1 D_in; D3 D11] * + return @autoopt @tensor env_x[χ_out D_out] := + E_1[χ_out D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * + A_1[D1 D_out; D3 D11] * A_2[D11 D9; D5 D7] * E_3[χ3 D5; χ4] * C_2[χ4; χ5] * E_4[χ5 D7; χ6] * E_5[χ6 D13; χ7] * C_3[χ7; χ8] * E_6[χ8 D15; χ9] * diff --git a/src/algorithms/contractions/ctmrg/gaugefix.jl b/src/algorithms/contractions/ctmrg/gaugefix.jl index 05123ebf6..554a8fbb8 100644 --- a/src/algorithms/contractions/ctmrg/gaugefix.jl +++ b/src/algorithms/contractions/ctmrg/gaugefix.jl @@ -9,17 +9,18 @@ $(SIGNATURES) Multiply corner tensor with incoming and outgoing gauge signs. ``` - corner -- σ_out -- + corner -- σ_in --in | - σ_in + σ_out | + out ``` """ function fix_gauge_corner( - corner::CTMRGCornerTensor, σ_in::CTMRGCornerTensor, σ_out::CTMRGCornerTensor + corner::CTMRGCornerTensor, σ_out::CTMRGCornerTensor, σ_in::CTMRGCornerTensor ) - return @autoopt @tensor corner_fix[χ_in; χ_out] := - σ_in[χ_in; χ1] * corner[χ1; χ2] * conj(σ_out[χ_out; χ2]) + return @autoopt @tensor corner_fix[χ_out; χ_in] := + σ_out[χ_out; χ1] * corner[χ1; χ2] * conj(σ_in[χ_in; χ2]) end """ @@ -82,25 +83,26 @@ $(SIGNATURES) Multiply edge tensor with incoming and outgoing gauge signs. ``` - -- σ_in -- edge -- σ_out -- + out-- σ_out -- edge -- σ_in --in + | ``` """ @generated function fix_gauge_edge( - edge::CTMRGEdgeTensor{T, S, N}, σ_in::CTMRGCornerTensor, σ_out::CTMRGCornerTensor + edge::CTMRGEdgeTensor{T, S, N}, σ_out::CTMRGCornerTensor, σ_in::CTMRGCornerTensor ) where {T, S, N} edge_fix_e = tensorexpr( :edge_fix, - (envlabel(:in), ntuple(i -> virtuallabel(i), N - 1)...), - (envlabel(:out),), + (envlabel(:out), ntuple(i -> virtuallabel(i), N - 1)...), + (envlabel(:in),), ) edge_e = tensorexpr( :edge, (envlabel(1), ntuple(i -> virtuallabel(i), N - 1)...), (envlabel(2),) ) - σ_in_e = tensorexpr(:σ_in, (envlabel(:in),), (envlabel(1),)) - σ_out_e = tensorexpr(:σ_out, (envlabel(:out),), (envlabel(2),)) + σ_out_e = tensorexpr(:σ_out, (envlabel(:out),), (envlabel(1),)) + σ_in_e = tensorexpr(:σ_in, (envlabel(:in),), (envlabel(2),)) return macroexpand( @__MODULE__, - :(return @autoopt @tensor $edge_fix_e := $σ_in_e * $edge_e * conj($σ_out_e)), + :(return @autoopt @tensor $edge_fix_e := $σ_out_e * $edge_e * conj($σ_in_e)), ) end diff --git a/src/algorithms/contractions/ctmrg/halfinf_env.jl b/src/algorithms/contractions/ctmrg/halfinf_env.jl index d8a0f3be4..e09fc9ae0 100644 --- a/src/algorithms/contractions/ctmrg/halfinf_env.jl +++ b/src/algorithms/contractions/ctmrg/halfinf_env.jl @@ -11,6 +11,7 @@ Contract two quadrants (enlarged corners) to form a half-infinite environment. |quadrant1| |quadrant2| |~~~~~~~~~| -- |~~~~~~~~~| | | | | + out in ``` The environment can also be contracted directly from all its constituent tensors. @@ -20,6 +21,7 @@ The environment can also be contracted directly from all its constituent tensors | | | | E_1 -- A_1 -- A_2 -- E_4 | | | | + out in ``` Alternatively, contract the environment with a vector `x` acting on it @@ -29,7 +31,7 @@ Alternatively, contract the environment with a vector `x` acting on it | | | | E_1 -- A_1 -- A_2 -- E_4 | | | | - [~~~x~~~~] + out [~~~x~~~~] ``` or contract the adjoint environment with `x`, e.g. as needed for iterative solvers. @@ -43,18 +45,18 @@ end function half_infinite_environment( C_1, C_2, E_1, E_2, E_3, E_4, A_1::P, A_2::P ) where {P <: PEPSSandwich} - return @autoopt @tensor env[χ_in D_inabove D_inbelow; χ_out D_outabove D_outbelow] := - E_1[χ_in D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * - ket(A_1)[d1; D3 D9 D_inabove D1] * conj(bra(A_1)[d1; D4 D10 D_inbelow D2]) * - ket(A_2)[d2; D5 D7 D_outabove D9] * conj(bra(A_2)[d2; D6 D8 D_outbelow D10]) * + return @autoopt @tensor env[χ_out D_outabove D_outbelow; χ_in D_inabove D_inbelow] := + E_1[χ_out D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * + ket(A_1)[d1; D3 D9 D_outabove D1] * conj(bra(A_1)[d1; D4 D10 D_outbelow D2]) * + ket(A_2)[d2; D5 D7 D_inabove D9] * conj(bra(A_2)[d2; D6 D8 D_inbelow D10]) * E_3[χ3 D5 D6; χ4] * C_2[χ4; χ5] * E_4[χ5 D7 D8; χ_out] end function half_infinite_environment( C_1, C_2, E_1, E_2, E_3, E_4, x::AbstractTensor{T, S, 3}, A_1::P, A_2::P ) where {T, S, P <: PEPSSandwich} - return @autoopt @tensor env_x[χ_in D_inabove D_inbelow] := - E_1[χ_in D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * - ket(A_1)[d1; D3 D9 D_inabove D1] * conj(bra(A_1)[d1; D4 D10 D_inbelow D2]) * + return @autoopt @tensor env_x[χ_out D_outabove D_outbelow] := + E_1[χ_out D1 D2; χ1] * C_1[χ1; χ2] * E_2[χ2 D3 D4; χ3] * + ket(A_1)[d1; D3 D9 D_outabove D1] * conj(bra(A_1)[d1; D4 D10 D_outbelow D2]) * ket(A_2)[d2; D5 D7 D11 D9] * conj(bra(A_2)[d2; D6 D8 D12 D10]) * E_3[χ3 D5 D6; χ4] * C_2[χ4; χ5] * E_4[χ5 D7 D8; χ6] * x[χ6 D11 D12] @@ -72,18 +74,18 @@ end function half_infinite_environment( C_1, C_2, E_1, E_2, E_3, E_4, A_1::P, A_2::P ) where {P <: PFTensor} - return @autoopt @tensor env[χ_in D_in; χ_out D_out] := - E_1[χ_in D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * - A_1[D1 D_in; D3 D9] * - A_2[D9 D_out; D5 D7] * - E_3[χ3 D5; χ4] * C_2[χ4; χ5] * E_4[χ5 D7; χ_out] + return @autoopt @tensor env[χ_out D_out; χ_in D_in] := + E_1[χ_out D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * + A_1[D1 D_out; D3 D9] * + A_2[D9 D_in; D5 D7] * + E_3[χ3 D5; χ4] * C_2[χ4; χ5] * E_4[χ5 D7; χ_in] end function half_infinite_environment( C_1, C_2, E_1, E_2, E_3, E_4, x::AbstractTensor{T, S, 2}, A_1::P, A::P ) where {T, S, P <: PFTensor} - return @autoopt @tensor env_x[χ_in D_in] := - E_1[χ_in D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * - A_1[D1 D_in; D3 D9] * + return @autoopt @tensor env_x[χ_out D_out] := + E_1[χ_out D1; χ1] * C_1[χ1; χ2] * E_2[χ2 D3; χ3] * + A_1[D1 D_out; D3 D9] * A_2[D9 D11; D5 D7] * E_3[χ3 D5; χ4] * C_2[χ4; χ5] * E_4[χ5 D7; χ6] * x[χ6 D11] diff --git a/src/algorithms/contractions/ctmrg/projector.jl b/src/algorithms/contractions/ctmrg/projector.jl index 6b469d0e6..d5069df87 100644 --- a/src/algorithms/contractions/ctmrg/projector.jl +++ b/src/algorithms/contractions/ctmrg/projector.jl @@ -8,21 +8,22 @@ Contract the CTMRG left projector with the higher-dimensional subspace facing to ``` C -- E_2 -- |~~| - | | |V'| -- isqS -- + | | |V'| -- isqS --in E_1 -- A -- |~~| | | + out ``` """ function left_projector(E_1, C, E_2, V, isqS, A::PEPSSandwich) - return @autoopt @tensor P_left[χ_in D_inabove D_inbelow; χ_out] := - E_1[χ_in D1 D2; χ1] * C[χ1; χ2] * E_2[χ2 D3 D4; χ3] * - ket(A)[d; D3 D5 D_inabove D1] * conj(bra(A)[d; D4 D6 D_inbelow D2]) * - conj(V[χ4; χ3 D5 D6]) * isqS[χ4; χ_out] + return @autoopt @tensor P_left[χ_out D_outabove D_outbelow; χ_in] := + E_1[χ_out D1 D2; χ1] * C[χ1; χ2] * E_2[χ2 D3 D4; χ3] * + ket(A)[d; D3 D5 D_outabove D1] * conj(bra(A)[d; D4 D6 D_outbelow D2]) * + conj(V[χ4; χ3 D5 D6]) * isqS[χ4; χ_in] end function left_projector(E_1, C, E_2, V, isqS, A::PFTensor) - return @autoopt @tensor P_left[χ_in D_in; χ_out] := - E_1[χ_in D1; χ1] * C[χ1; χ2] * E_2[χ2 D2; χ3] * - A[D1 D_in; D2 D3] * conj(V[χ4; χ3 D3]) * isqS[χ4; χ_out] + return @autoopt @tensor P_left[χ_out D_out; χ_in] := + E_1[χ_out D1; χ1] * C[χ1; χ2] * E_2[χ2 D2; χ3] * + A[D1 D_out; D2 D3] * conj(V[χ4; χ3 D3]) * isqS[χ4; χ_in] end """ @@ -31,23 +32,24 @@ $(SIGNATURES) Contract the CTMRG right projector with the higher-dimensional subspace facing to the right. ``` - |~~| -- E_2 -- C - -- isqS -- |U'| | | - |~~| -- A -- E_1 - | | + |~~| -- E_2 -- C + out-- isqS -- |U'| | | + |~~| -- A -- E_1 + | | + in ``` """ function right_projector(E_1, C, E_2, U, isqS, A::PEPSSandwich) - return @autoopt @tensor P_right[χ_in; χ_out D_outabove D_outbelow] := - isqS[χ_in; χ1] * conj(U[χ1; χ2 D1 D2]) * - ket(A)[d; D3 D5 D_outabove D1] * conj(bra(A)[d; D4 D6 D_outbelow D2]) * - E_2[χ2 D3 D4; χ3] * C[χ3; χ4] * E_1[χ4 D5 D6; χ_out] + return @autoopt @tensor P_right[χ_out; χ_in D_inabove D_inbelow] := + isqS[χ_out; χ1] * conj(U[χ1; χ2 D1 D2]) * + ket(A)[d; D3 D5 D_inabove D1] * conj(bra(A)[d; D4 D6 D_inbelow D2]) * + E_2[χ2 D3 D4; χ3] * C[χ3; χ4] * E_1[χ4 D5 D6; χ_in] end function right_projector(E_1, C, E_2, U, isqS, A::PFTensor) - return @autoopt @tensor P_right[χ_in; χ_out D_out] := - isqS[χ_in; χ1] * conj(U[χ1; χ2 D1]) * - A[D1 D_out; D2 D3] * - E_2[χ2 D2; χ3] * C[χ3; χ4] * E_1[χ4 D3; χ_out] + return @autoopt @tensor P_right[χ_out; χ_in D_in] := + isqS[χ_out; χ1] * conj(U[χ1; χ2 D1]) * + A[D1 D_in; D2 D3] * + E_2[χ2 D2; χ3] * C[χ3; χ4] * E_1[χ4 D3; χ_in] end """ diff --git a/src/algorithms/contractions/ctmrg/renormalize_corner.jl b/src/algorithms/contractions/ctmrg/renormalize_corner.jl index 23444e107..9a0d80ad6 100644 --- a/src/algorithms/contractions/ctmrg/renormalize_corner.jl +++ b/src/algorithms/contractions/ctmrg/renormalize_corner.jl @@ -5,11 +5,12 @@ Apply projectors to each side of a quadrant. ``` |~~~~~~~~| -- |~~~~~~| - |quadrant| |P_left| -- + |quadrant| |P_left| --in |~~~~~~~~| -- |~~~~~~| | | [P_right] | + out ``` """ @generated function renormalize_corner( @@ -51,22 +52,24 @@ Apply `renormalize_corner` to the enlarged northwest corner. ``` |~~~~~~~~| -- |~~~~~~| - |quadrant| |P_left| -- + |quadrant| |P_left| --in |~~~~~~~~| -- |~~~~~~| | | [P_right] | + out ``` Alternatively, provide the constituent tensors and perform the complete contraction. ``` C_northwest -- E_north -- |~~~~~~| - | | |P_left| -- + | | |P_left| --in E_west -- A -- |~~~~~~| | | [~~~~~P_right~~~~] | + out ``` """ function renormalize_northwest_corner((row, col), enlarged_env, P_left, P_right) @@ -84,20 +87,20 @@ end function renormalize_northwest_corner( E_west, C_northwest, E_north, P_left, P_right, A::PEPSSandwich ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1 D2] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1 D2] * E_west[χ1 D3 D4; χ2] * C_northwest[χ2; χ3] * E_north[χ3 D5 D6; χ4] * ket(A)[d; D5 D7 D1 D3] * conj(bra(A)[d; D6 D8 D2 D4]) * - P_left[χ4 D7 D8; χ_out] + P_left[χ4 D7 D8; χ_in] end function renormalize_northwest_corner( E_west, C_northwest, E_north, P_left, P_right, A::PFTensor ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1] * E_west[χ1 D3; χ2] * C_northwest[χ2; χ3] * E_north[χ3 D5; χ4] * A[D3 D1; D5 D7] * - P_left[χ4 D7; χ_out] + P_left[χ4 D7; χ_in] end @generated function renormalize_northwest_corner( @@ -135,23 +138,25 @@ end Apply `renormalize_corner` to the enlarged northeast corner. ``` - |~~~~~~~| -- |~~~~~~~~| - -- |P_right| |quadrant| - |~~~~~~~| -- |~~~~~~~~| - | | - [P_left] - | + |~~~~~~~| -- |~~~~~~~~| + out-- |P_right| |quadrant| + |~~~~~~~| -- |~~~~~~~~| + | | + [P_left] + | + in ``` Alternatively, provide the constituent tensors and perform the complete contraction. ``` - |~~~~~~~| -- E_north -- C_northeast - -- |P_right| | | - |~~~~~~~| -- A -- E_east - | | - [~~~~~P_left~~~~~] - | + |~~~~~~~| -- E_north -- C_northeast + out-- |P_right| | | + |~~~~~~~| -- A -- E_east + | | + [~~~~~P_left~~~~~] + | + in ``` """ function renormalize_northeast_corner((row, col), enlarged_env, P_left, P_right) @@ -171,20 +176,20 @@ end function renormalize_northeast_corner( E_north, C_northeast, E_east, P_left, P_right, A::PEPSSandwich ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1 D2] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1 D2] * E_north[χ1 D3 D4; χ2] * C_northeast[χ2; χ3] * E_east[χ3 D5 D6; χ4] * ket(A)[d; D3 D5 D7 D1] * conj(bra(A)[d; D4 D6 D8 D2]) * - P_left[χ4 D7 D8; χ_out] + P_left[χ4 D7 D8; χ_in] end function renormalize_northeast_corner( E_north, C_northeast, E_east, P_left, P_right, A::PFTensor ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1] * E_north[χ1 D3; χ2] * C_northeast[χ2; χ3] * E_east[χ3 D5; χ4] * A[D1 D7; D3 D5] * - P_left[χ4 D7; χ_out] + P_left[χ4 D7; χ_in] end @generated function renormalize_northeast_corner( @@ -222,23 +227,25 @@ end Apply `renormalize_corner` to the enlarged southeast corner. ``` - | - [P_right] - | | - |~~~~~~| -- |~~~~~~~~| - -- |P_left| |quadrant| - |~~~~~~| -- |~~~~~~~~| + out + | + [P_right] + | | + |~~~~~~| -- |~~~~~~~~| + in-- |P_left| |quadrant| + |~~~~~~| -- |~~~~~~~~| ``` Alternatively, provide the constituent tensors and perform the complete contraction. ``` - | - [~~~~P_right~~~~] - | | - |~~~~~~| -- A -- E_east - -- |P_left| | | - |~~~~~~| -- E_south -- C_southeast + out + | + [~~~~P_right~~~~] + | | + |~~~~~~| -- A -- E_east + in-- |P_left| | | + |~~~~~~| -- E_south -- C_southeast ``` """ function renormalize_southeast_corner((row, col), enlarged_env, P_left, P_right) @@ -256,20 +263,20 @@ end function renormalize_southeast_corner( E_east, C_southeast, E_south, P_left, P_right, A::PEPSSandwich ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1 D2] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1 D2] * E_east[χ1 D3 D4; χ2] * C_southeast[χ2; χ3] * E_south[χ3 D5 D6; χ4] * ket(A)[d; D1 D3 D5 D7] * conj(bra(A)[d; D2 D4 D6 D8]) * - P_left[χ4 D7 D8; χ_out] + P_left[χ4 D7 D8; χ_in] end function renormalize_southeast_corner( E_east, C_southeast, E_south, P_left, P_right, A::PFTensor ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1] * E_east[χ1 D3; χ2] * C_southeast[χ2; χ3] * E_south[χ3 D5; χ4] * A[D7 D5; D1 D3] * - P_left[χ4 D7; χ_out] + P_left[χ4 D7; χ_in] end @generated function renormalize_southeast_corner( @@ -307,22 +314,24 @@ end Apply `renormalize_corner` to the enlarged southwest corner. ``` + in | [P_left] | | - |~~~~~~~~| -- |~~~~~~| - |quadrant| |P_left| -- - |~~~~~~~~| -- |~~~~~~| + |~~~~~~~~| -- |~~~~~~~| + |quadrant| |P_right| --out + |~~~~~~~~| -- |~~~~~~~| ``` Alternatively, provide the constituent tensors and perform the complete contraction. ``` + in | [~~~~~P_left~~~~~] | | E_west -- A -- |~~~~~~~| - | | |P_right| -- + | | |P_right| --out C_southwest -- E_south -- |~~~~~~~| ``` """ @@ -341,20 +350,20 @@ end function renormalize_southwest_corner( E_south, C_southwest, E_west, P_left, P_right, A::PEPSSandwich ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1 D2] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1 D2] * E_south[χ1 D3 D4; χ2] * C_southwest[χ2; χ3] * E_west[χ3 D5 D6; χ4] * ket(A)[d; D7 D1 D3 D5] * conj(bra(A)[d; D8 D2 D4 D6]) * - P_left[χ4 D7 D8; χ_out] + P_left[χ4 D7 D8; χ_in] end function renormalize_southwest_corner( E_south, C_southwest, E_west, P_left, P_right, A::PFTensor ) - return @autoopt @tensor corner[χ_in; χ_out] := - P_right[χ_in; χ1 D1] * + return @autoopt @tensor corner[χ_out; χ_in] := + P_right[χ_out; χ1 D1] * E_south[χ1 D3; χ2] * C_southwest[χ2; χ3] * E_west[χ3 D5; χ4] * A[D5 D3; D7 D1] * - P_left[χ4 D7; χ_out] + P_left[χ4 D7; χ_in] end @generated function renormalize_southwest_corner( @@ -385,27 +394,28 @@ end # ---------------------------------- """ - renormalize_bottom_corner((r, c), env, projectors) - renormalize_bottom_corner(C_southwest, E_south, P_bottom) + renormalize_southwest_corner((r, c), env, projectors) + renormalize_southwest_corner(C_southwest, E_south, P_left) -Apply bottom projector to southwest corner and south edge. +Apply left projector to southwest corner and south edge. ``` + in | - [P_bottom] - | | - C -- E -- in + [P_left] + | | + C -- E --out ``` """ -function renormalize_bottom_corner((row, col), env::CTMRGEnv, projectors) +function renormalize_southwest_corner((row, col), env::CTMRGEnv, projectors) C_southwest = env.corners[SOUTHWEST, row, _prev(col, end)] E_south = env.edges[SOUTH, row, col] - P_bottom = projectors[1][row] - return renormalize_bottom_corner(C_southwest, E_south, P_bottom) + P_left = projectors[1][row] + return renormalize_southwest_corner(C_southwest, E_south, P_left) end -@generated function renormalize_bottom_corner( +@generated function renormalize_southwest_corner( C_southwest::CTMRGCornerTensor{<:Any, S}, E_south::CTMRGEdgeTensor{<:Any, S, N}, - P_bottom::AbstractTensorMap{<:Any, S, N, 1}, + P_left::AbstractTensorMap{<:Any, S, N, 1}, ) where {S, N} C_out_e = tensorexpr(:corner, (envlabel(:out),), (envlabel(:in),)) C_southwest_e = tensorexpr(:C_southwest, (envlabel(:SSW),), (envlabel(:WSW),)) @@ -414,50 +424,51 @@ end (envlabel(:out), ntuple(i -> virtuallabel(i), N - 1)...), (envlabel(:SSW),), ) - P_bottom_e = tensorexpr( - :P_bottom, + P_left_e = tensorexpr( + :P_left, (envlabel(:WSW), ntuple(i -> virtuallabel(i), N - 1)...), (envlabel(:in),), ) return macroexpand( @__MODULE__, - :(return @autoopt @tensor $C_out_e := $E_south_e * $C_southwest_e * $P_bottom_e), + :(return @autoopt @tensor $C_out_e := $E_south_e * $C_southwest_e * $P_left_e), ) end """ - renormalize_top_corner((row, col), env, projectors) - renormalize_top_corner(C_northwest, E_north, P_top) + renormalize_northwest_corner((row, col), env, projectors) + renormalize_northwest_corner(C_northwest, E_north, P_right) -Apply top projector to northwest corner and north edge. +Apply right projector to northwest corner and north edge. ``` - C -- E -- - | | - [~P_top~] + C --- E --in + | | + [P_right] | + out ``` """ -function renormalize_top_corner((row, col), env::CTMRGEnv, projectors) +function renormalize_northwest_corner((row, col), env::CTMRGEnv, projectors) C_northwest = env.corners[NORTHWEST, row, _prev(col, end)] E_north = env.edges[NORTH, row, col] - P_top = projectors[2][_next(row, end)] - return renormalize_top_corner(C_northwest, E_north, P_top) + P_right = projectors[2][_next(row, end)] + return renormalize_northwest_corner(C_northwest, E_north, P_right) end -@generated function renormalize_top_corner( +@generated function renormalize_northwest_corner( C_northwest::CTMRGCornerTensor{<:Any, S}, E_north::CTMRGEdgeTensor{<:Any, S, N}, - P_top::AbstractTensorMap{<:Any, S, 1, N}, + P_right::AbstractTensorMap{<:Any, S, 1, N}, ) where {S, N} C_out_e = tensorexpr(:corner, (envlabel(:out),), (envlabel(:in),)) C_northwest_e = tensorexpr(:C_northwest, (envlabel(:WNW),), (envlabel(:NNW),)) E_north_e = tensorexpr( :E_north, (envlabel(:NNW), ntuple(i -> virtuallabel(i), N - 1)...), (envlabel(:in),) ) - P_top_e = tensorexpr( - :P_top, (envlabel(:out),), (envlabel(:WNW), ntuple(i -> virtuallabel(i), N - 1)...) + P_right_e = tensorexpr( + :P_right, (envlabel(:out),), (envlabel(:WNW), ntuple(i -> virtuallabel(i), N - 1)...) ) return macroexpand( @__MODULE__, - :(return @autoopt @tensor $C_out_e := $E_north_e * $C_northwest_e * $P_top_e), + :(return @autoopt @tensor $C_out_e := $E_north_e * $C_northwest_e * $P_right_e), ) end diff --git a/src/algorithms/contractions/ctmrg/renormalize_edge.jl b/src/algorithms/contractions/ctmrg/renormalize_edge.jl index d4b5917aa..8e005285e 100644 --- a/src/algorithms/contractions/ctmrg/renormalize_edge.jl +++ b/src/algorithms/contractions/ctmrg/renormalize_edge.jl @@ -9,34 +9,34 @@ Absorb a local effective tensor `A` into the north edge using the given projecto environment tensors. ``` - |~~~~~~| -- E_north -- |~~~~~~~| - -- |P_left| | |P_right| -- - |~~~~~~| -- A -- |~~~~~~~| - | + |~~~~~~~| -- E_north -- |~~~~~~| + out-- |P_right| | |P_left| --in + |~~~~~~~| -- A -- |~~~~~~| + | ``` """ function renormalize_north_edge( - (row, col), env::CTMRGEnv, P_right, P_left, network::InfiniteSquareNetwork + (row, col), env::CTMRGEnv, P_left, P_right, network::InfiniteSquareNetwork ) return renormalize_north_edge( env.edges[NORTH, _prev(row, end), col], - P_right[NORTH, row, col], - P_left[NORTH, row, _prev(col, end)], + P_left[NORTH, row, col], + P_right[NORTH, row, _prev(col, end)], network[row, col], # so here it's fine ) end -function renormalize_north_edge(E_north, P_right, P_left, A) +function renormalize_north_edge(E_north, P_left, P_right, A) A_west = _rotl90_localsandwich(A) - return renormalize_west_edge(E_north, P_right, P_left, A_west) + return renormalize_west_edge(E_north, P_left, P_right, A_west) end # specialize PartitionFunction to avoid permute(A) -function renormalize_north_edge(E_north::CTMRG_PF_EdgeTensor, P_right, P_left, A::PFTensor) +function renormalize_north_edge(E_north::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor) return @tensor begin temp = permute(E_north, ((2, 1), (3,))) # impose D_N as 1st leg - PE[D_N D_E; χNW χ_E] := temp[D_N χNW; χNE] * P_right[χNE D_E; χ_E] + PE[D_N D_E; χNW χ_E] := temp[D_N χNW; χNE] * P_left[χNE D_E; χ_E] PEA[D_W χNW; D_S χ_E] := A[D_W D_S; D_N D_E] * PE[D_N D_E; χNW χ_E] - P_leftp = permute(P_left, ((1,), (3, 2))) - edge[χ_W D_S; χ_E] := P_leftp[χ_W; D_W χNW] * PEA[D_W χNW; D_S χ_E] + P_rightp = permute(P_right, ((1,), (3, 2))) + edge[χ_W D_S; χ_E] := P_rightp[χ_W; D_W χNW] * PEA[D_W χNW; D_S χ_E] end end @@ -68,65 +68,67 @@ end # --------- """ - renormalize_east_edge((row, col), env, P_top, P_bottom, network::InfiniteSquareNetwork{P}) - renormalize_east_edge(E_east, P_top, P_bottom, A::P) + renormalize_east_edge((row, col), env, P_left, P_right, network::InfiniteSquareNetwork{P}) + renormalize_east_edge(E_east, P_left, P_right, A::P) -Absorb a blocal effective tensor into the east edge using the given projectors and +Absorb a local effective tensor into the east edge using the given projectors and environment tensors. ``` + out | - [~~P_top~~~] - | | - -- A -- E_east - | | - [~P_bottom~] + [~P_right~] + | | + -- A -- E_east + | | + [~~P_left~] | + in ``` """ function renormalize_east_edge( - (row, col), env::CTMRGEnv, P_bottom, P_top, network::InfiniteSquareNetwork + (row, col), env::CTMRGEnv, P_left, P_right, network::InfiniteSquareNetwork ) return renormalize_east_edge( env.edges[EAST, row, _next(col, end)], - P_bottom[EAST, row, col, end], - P_top[EAST, _prev(row, end), col], + P_left[EAST, row, col, end], + P_right[EAST, _prev(row, end), col], network[row, col], ) end -function renormalize_east_edge(E_east, P_bottom, P_top, A) +function renormalize_east_edge(E_east, P_left, P_right, A) A_west = _rot180_localsandwich(A) - return renormalize_west_edge(E_east, P_bottom, P_top, A_west) + return renormalize_west_edge(E_east, P_left, P_right, A_west) end # specialize PartitionFunction to avoid permute(A) -function renormalize_east_edge(E_east::CTMRG_PF_EdgeTensor, P_bottom, P_top, A::PFTensor) +function renormalize_east_edge(E_east::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor) return @tensor begin - temp = permute(P_top, ((3, 1), (2,))) # impose D_N as 1st leg + temp = permute(P_right, ((3, 1), (2,))) # impose D_N as 1st leg PE[D_N D_E; χN χSE] := temp[D_N χN; χNE] * E_east[χNE D_E; χSE] PEA[D_W χN; χSE D_S] := A[D_W D_S; D_N D_E] * PE[D_N D_E; χN χSE] - edge[χ_N D_W; χ_S] := PEA[D_W χ_N; χSE D_S] * P_bottom[χSE D_S; χ_S] + edge[χ_N D_W; χ_S] := PEA[D_W χ_N; χSE D_S] * P_left[χSE D_S; χ_S] end end @generated function renormalize_east_edge( - E_east::CTMRGEdgeTensor{T, S, N}, P_bottom, P_top, A::PEPOSandwich{H} + E_east::CTMRGEdgeTensor{T, S, N}, P_left, P_right, A::PEPOSandwich{H} ) where {T, S, N, H} @assert N == H + 3 E_out_e = _pepo_edge_expr(:edge, :out, :in, :W, H) - P_top_e = _pepo_codomain_projector_expr(:P_top, :out, :N, :N, H) + P_right_e = _pepo_codomain_projector_expr(:P_right, :out, :N, :N, H) E_east_e = _pepo_edge_expr(:E_east, :N, :S, :E, H) ket_e, bra_e, pepo_es = _pepo_sandwich_expr(:A, H) - P_bottom_e = _pepo_domain_projector_expr(:P_bottom, :S, :S, :in, H) + P_left_e = _pepo_domain_projector_expr(:P_left, :S, :S, :in, H) rhs = Expr( :call, :*, - P_top_e, + P_right_e, E_east_e, ket_e, Expr(:call, :conj, bra_e), pepo_es..., - P_bottom_e, + P_left_e, ) return macroexpand(@__MODULE__, :(return @autoopt @tensor $E_out_e := $rhs)) @@ -143,11 +145,10 @@ Absorb a local effective tensor into the south edge using the given projectors a environment tensors. ``` - | - |~~~~~~~| -- A -- |~~~~~~| - -- |P_right| | |P_left| -- - |~~~~~~~| -- E_south -- |~~~~~~| - | + | + |~~~~~~| -- A -- |~~~~~~~| + in-- |P_left| | |P_right| --out + |~~~~~~| -- E_south -- |~~~~~~~| ``` """ function renormalize_south_edge( @@ -160,14 +161,12 @@ function renormalize_south_edge( network[row, col], ) end - function renormalize_south_edge(E_south, P_left, P_right, A) A_west = _rotr90_localsandwich(A) return renormalize_west_edge(E_south, P_left, P_right, A_west) end - +# specialize PartitionFunction to avoid permute(A) function renormalize_south_edge(E_south::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor) - # specialize to avoid extra permute on A when calling renormalize_west_edge return @tensor begin P_leftp = permute(P_left, ((3, 2), (1,))) # impose χ_W as 1st leg PE[χ_W χSE; D_W D_S] := P_leftp[χ_W D_W; χSW] * E_south[χSE D_S; χSW] @@ -204,29 +203,31 @@ end # --------- """ - renormalize_west_edge((row, col), env, P_top, P_bottom, network::InfiniteSquareNetwork{P}) - renormalize_west_edge(E_west, P_top, P_bottom, A::P) + renormalize_west_edge((row, col), env, P_left, P_right, network::InfiniteSquareNetwork{P}) + renormalize_west_edge(E_west, P_left, P_right, A::P) Absorb a local effective tensor into the west edge using the given projectors and environment tensors. ``` - | - [~P_bottom~] - | | - E_west -- A -- - | | - [~~P_top~~~] - | + in + | + [~~P_left~] + | | + E_west -- A -- + | | + [~P_right~] + | + out ``` """ function renormalize_west_edge( # For simultaneous CTMRG scheme - (row, col), env::CTMRGEnv, P_top::Array{Pt, 3}, P_bottom::Array{Pb, 3}, network::InfiniteSquareNetwork, - ) where {Pt, Pb} + (row, col), env::CTMRGEnv, P_left, P_right, network::InfiniteSquareNetwork, + ) return renormalize_west_edge( env.edges[WEST, row, _prev(col, end)], - P_top[WEST, row, col], - P_bottom[WEST, _next(row, end), col], + P_left[WEST, row, col], + P_right[WEST, _next(row, end), col], network[row, col], ) end @@ -241,49 +242,46 @@ function renormalize_west_edge( # For sequential CTMRG scheme ) end function renormalize_west_edge( - E_west::CTMRG_PEPS_EdgeTensor, P_top, P_bottom, A::PEPSSandwich + E_west::CTMRG_PEPS_EdgeTensor, P_left, P_right, A::PEPSSandwich ) # starting with P_bottom to save one permute in the end return @tensor begin # already putting χE in front here to make next permute cheaper - PE[χS χNW DSb DWb; DSt DWt] := P_bottom[χS; χSW DSt DSb] * E_west[χSW DWt DWb; χNW] - + PE[χS χNW DSb DWb; DSt DWt] := P_right[χS; χSW DSt DSb] * E_west[χSW DWt DWb; χNW] PEket[χS χNW DNt DEt; DSb DWb d] := PE[χS χNW DSb DWb; DSt DWt] * ket(A)[d; DNt DEt DSt DWt] - corner[χS DEt DEb; χNW DNt DNb] := PEket[χS χNW DNt DEt; DSb DWb d] * conj(bra(A)[d; DNb DEb DSb DWb]) - - edge[χS DEt DEb; χN] := corner[χS DEt DEb; χNW DNt DNb] * P_top[χNW DNt DNb; χN] + edge[χS DEt DEb; χN] := corner[χS DEt DEb; χNW DNt DNb] * P_left[χNW DNt DNb; χN] end end -function renormalize_west_edge(E_west::CTMRG_PF_EdgeTensor, P_top, P_bottom, A::PFTensor) +function renormalize_west_edge(E_west::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor) return @tensor begin - PE[χ_S χNW; D_W D_S] := P_bottom[χ_S; χSW D_S] * E_west[χSW D_W; χNW] + PE[χ_S χNW; D_W D_S] := P_right[χ_S; χSW D_S] * E_west[χSW D_W; χNW] PEA[χ_S D_E; χNW D_N] := PE[χ_S χNW; D_W D_S] * A[D_W D_S; D_N D_E] - edge[χ_S D_E; χ_N] := PEA[χ_S D_E; χNW D_N] * P_top[χNW D_N; χ_N] + edge[χ_S D_E; χ_N] := PEA[χ_S D_E; χNW D_N] * P_left[χNW D_N; χ_N] end end @generated function renormalize_west_edge( - E_west::CTMRGEdgeTensor{T, S, N}, P_bottom, P_top, A::PEPOSandwich{H} + E_west::CTMRGEdgeTensor{T, S, N}, P_left, P_right, A::PEPOSandwich{H} ) where {T, S, N, H} @assert N == H + 3 E_out_e = _pepo_edge_expr(:edge, :out, :in, :E, H) - P_top_e = _pepo_codomain_projector_expr(:P_top, :out, :S, :S, H) + P_right_e = _pepo_codomain_projector_expr(:P_right, :out, :S, :S, H) E_west_e = _pepo_edge_expr(:E_west, :S, :N, :W, H) ket_e, bra_e, pepo_es = _pepo_sandwich_expr(:A, H) - P_bottom_e = _pepo_domain_projector_expr(:P_bottom, :N, :N, :in, H) + P_left_e = _pepo_domain_projector_expr(:P_left, :N, :N, :in, H) rhs = Expr( :call, :*, - P_top_e, + P_right_e, E_west_e, ket_e, Expr(:call, :conj, bra_e), pepo_es..., - P_bottom_e, + P_left_e, ) return macroexpand(@__MODULE__, :(return @autoopt @tensor $E_out_e := $rhs)) diff --git a/src/algorithms/ctmrg/sequential.jl b/src/algorithms/ctmrg/sequential.jl index 9818f79b2..63f6ba54f 100644 --- a/src/algorithms/ctmrg/sequential.jl +++ b/src/algorithms/ctmrg/sequential.jl @@ -139,10 +139,10 @@ function renormalize_sequentially(col::Int, projectors, network, env) # Apply projectors to renormalize corners and edge for row in axes(env.corners, 2) - C_southwest = renormalize_bottom_corner((row, col), env, projectors) + C_southwest = renormalize_southwest_corner((row, col), env, projectors) corners[SOUTHWEST, row, col] = C_southwest / norm(C_southwest) - C_northwest = renormalize_top_corner((row, col), env, projectors) + C_northwest = renormalize_northwest_corner((row, col), env, projectors) corners[NORTHWEST, row, col] = C_northwest / norm(C_northwest) E_west = renormalize_west_edge((row, col), env, projectors, network)