1717Base. length (H:: MPODerivativeOperator ) = length (H. operators)
1818Base. length (:: MPOContractedDerivativeOperator{L, R, N} ) where {L, R, N} = N
1919
20- const MPO_C_Hamiltonian{L, R} = MPOContractedDerivativeOperator {L, Tuple{}, R}
20+ const MPO_C_Hamiltonian{L, R} = MPODerivativeOperator {L, Tuple{}, R}
2121MPO_C_Hamiltonian (GL, GR) = MPODerivativeOperator (GL, (), GR)
2222
2323const MPO_AC_Hamiltonian{L, O, R} = MPODerivativeOperator{L, Tuple{O}, R}
@@ -26,9 +26,6 @@ MPO_AC_Hamiltonian(GL, O, GR) = MPODerivativeOperator(GL, (O,), GR)
2626const MPO_AC2_Hamiltonian{L, O₁, O₂, R} = MPODerivativeOperator{L, Tuple{O₁, O₂}, R}
2727MPO_AC2_Hamiltonian (GL, O1, O2, GR) = MPODerivativeOperator (GL, (O1, O2), GR)
2828
29- const MPO_Contracted_C_Hamiltonian{L, R} = MPOContractedDerivativeOperator{L, R, 0 }
30- MPO_Contracted_C_Hamiltonian (GL:: L , GR:: R ) where {L, R} = MPOContractedDerivativeOperator {L,R,0} (GL, GR)
31-
3229const MPO_Contracted_AC_Hamiltonian{L, R} = MPOContractedDerivativeOperator{L, R, 1 }
3330MPO_Contracted_AC_Hamiltonian (GL:: L , GR:: R ) where {L, R} = MPOContractedDerivativeOperator {L,R,1} (GL, GR)
3431
@@ -56,19 +53,16 @@ function AC2_hamiltonian(site::Int, below, operator, above, envs)
5653 leftenv (envs, site, below), O1, O2, rightenv (envs, site + 1 , below)
5754 )
5855end
59- function C_hamiltonian (site:: Int , below:: _HAM_MPS_TYPES , operator:: MPOHamiltonian{<:MPOTensor} , above:: _HAM_MPS_TYPES , envs)
60- return MPO_Contracted_C_Hamiltonian (leftenv (envs, site + 1 , below), rightenv (envs, site, below))
61- end
62- function AC_hamiltonian (site:: Int , below:: _HAM_MPS_TYPES , operator:: MPOHamiltonian{<:MPOTensor} , above:: _HAM_MPS_TYPES , envs)
56+ function AC_hamiltonian (site:: Int , below:: _HAM_MPS_TYPES , operator:: MPO{<:MPOTensor} , above:: _HAM_MPS_TYPES , envs)
6357 O = operator[site]
6458 GL = leftenv (envs, site, below)
6559 return AC_hamiltonian (GL, O, rightenv (envs, site, below))
6660end
6761function AC_hamiltonian (GL:: MPSTensor , O:: MPOTensor , GR:: MPSTensor )
6862 @plansor GLW[- 1 - 2 - 3 ; - 4 - 5 ] ≔ GL[- 1 1 ; - 4 ] * O[1 - 2 ; - 5 - 3 ]
69- return MPO_Contracted_AC_Hamiltonian (GLW, O, GR)
63+ return MPO_Contracted_AC_Hamiltonian (GLW, GR)
7064end
71- function AC2_hamiltonian (site:: Int , below:: _HAM_MPS_TYPES , operator:: MPOHamiltonian {<:MPOTensor} , above:: _HAM_MPS_TYPES , envs)
65+ function AC2_hamiltonian (site:: Int , below:: _HAM_MPS_TYPES , operator:: MPO {<:MPOTensor} , above:: _HAM_MPS_TYPES , envs)
7266 O1 = operator[site]
7367 O2 = operator[site + 1 ]
7468 GL = leftenv (envs, site, below)
@@ -164,12 +158,8 @@ function (h::MPO_AC2_Hamiltonian{<:MPSTensor, <:MPOTensor, <:MPOTensor, <:MPSTen
164158 h. operators[2 ][7 - 6 ; 4 5 ] * τ[5 - 5 ; 2 3 ]
165159 return y isa AbstractBlockTensorMap ? only (y) : y
166160end
167- function (h:: MPO_Contracted_C_Hamiltonian )(x:: MPSBondTensor )
168- @plansor y[- 1 ; - 2 ] ≔ h. leftenv[- 1 3 ; 1 ] * x[1 ; 2 ] * h. rightenv[2 3 ; - 2 ]
169- return y isa AbstractBlockTensorMap ? only (y) : y
170- end
171161function (h:: MPO_Contracted_AC_Hamiltonian )(
172- x:: GenericMPSTensor {<:Any, 3 }
162+ x:: AbstractTensorMap {<:Any, <:Any, 2, 1 }
173163 )
174164 @plansor y[- 1 - 2 ; - 3 ] ≔ h. leftenv[- 1 - 2 3 ; 1 2 ] * x[1 2 ; 4 ] * h. rightenv[4 3 ; - 3 ]
175165 return y isa AbstractBlockTensorMap ? only (y) : y
@@ -179,5 +169,4 @@ function (h::MPO_Contracted_AC2_Hamiltonian)(
179169 )
180170 @plansor y[- 1 - 2 ; - 3 - 4 ] ≔ h. leftenv[- 1 - 2 5 ; 1 2 ] * x[1 2 ; 3 4 ] * h. rightenv[3 4 5 ; - 3 - 4 ]
181171 return y isa AbstractBlockTensorMap ? only (y) : y
182- end
183- # # TODO : Which interface should we use for an inplace += version to be used in hamiltonian_derivatives.jl?
172+ end
0 commit comments