@@ -10,26 +10,7 @@ struct JordanMPO_AC_Hamiltonian{O1, O2, O3} <: DerivativeOperator
1010 E:: Union{O1, Missing} # finished
1111 C:: Union{O2, Missing} # starting
1212 B:: Union{O2, Missing} # ending
13- A:: O3 # continuing
14- function JordanMPO_AC_Hamiltonian (
15- onsite, not_started, finished, starting, ending, continuing
16- )
17- # obtaining storagetype of environments since these should have already mixed
18- # the types of the operator and state
19- gl = @coalesce (onsite, not_started, finished, starting, ending)
20- S = spacetype (gl)
21- M = storagetype (gl)
22- O1 = tensormaptype (S, 1 , 1 , M)
23- O2 = tensormaptype (S, 2 , 2 , M)
24- return new {O1, O2, typeof(continuing)} (
25- onsite, not_started, finished, starting, ending, continuing
26- )
27- end
28- function JordanMPO_AC_Hamiltonian {O1, O2, O3} (
29- onsite, not_started, finished, starting, ending, continuing
30- ) where {O1, O2, O3}
31- return new {O1, O2, O3} (onsite, not_started, finished, starting, ending, continuing)
32- end
13+ A:: Union{O3, Missing} # continuing
3314end
3415
3516"""
@@ -45,26 +26,10 @@ struct JordanMPO_AC2_Hamiltonian{O1, O2, O3, O4} <: DerivativeOperator
4526 CB:: Union{O2, Missing} # starting left - ending right
4627 CA:: Union{O3, Missing} # starting left - continuing right
4728 AB:: Union{O3, Missing} # continuing left - ending right
48- AA:: O4 # continuing left - continuing right
29+ AA:: Union{O4, Missing} # continuing left - continuing right
4930 BE:: Union{O2, Missing} # ending left
5031 DE:: Union{O1, Missing} # onsite left
5132 EE:: Union{O1, Missing} # finished
52- function JordanMPO_AC2_Hamiltonian (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
53- # obtaining storagetype of environments since these should have already mixed
54- # the types of the operator and state
55- gl = @coalesce (II, IC, ID, CB, CA, AB, BE, DE, EE)
56- S = spacetype (gl)
57- M = storagetype (gl)
58- O1 = tensormaptype (S, 1 , 1 , M)
59- O2 = tensormaptype (S, 2 , 2 , M)
60- O3 = tensormaptype (S, 3 , 3 , M)
61- return new {O1, O2, O3, typeof(AA)} (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
62- end
63- function JordanMPO_AC2_Hamiltonian {O1, O2, O3, O4} (
64- II, IC, ID, CB, CA, AB, AA, BE, DE, EE
65- ) where {O1, O2, O3, O4}
66- return new {O1, O2, O3, O4} (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
67- end
6833end
6934
7035# Constructors
@@ -139,7 +104,13 @@ function AC_hamiltonian(
139104 continuing = missing
140105 end
141106
142- return JordanMPO_AC_Hamiltonian (
107+ S = spacetype (GL)
108+ M = storagetype (GL)
109+ O1 = tensormaptype (S, 1 , 1 , M)
110+ O2 = tensormaptype (S, 2 , 2 , M)
111+ O3 = Core. Compiler. return_type (AC_hamiltonian, typeof ((GL_2, W. A, GR_2)))
112+
113+ return JordanMPO_AC_Hamiltonian {O1, O2, O3} (
143114 onsite, not_started, finished, starting, ending, continuing
144115 )
145116end
@@ -286,15 +257,21 @@ function AC2_hamiltonian(
286257 end
287258
288259 # continuing - continuing
289- # TODO : MPODerivativeOperator code reuse + optimization
290260 # # TODO : Think about how one could and whether one should store these objects and use them for (a) advancing environments in iDMRG, (b) reuse ind backwards-sweep in IDMRG, (c) subspace expansion
291261 if nonzero_length (W1. A) > 0 && nonzero_length (W2. A) > 0
292262 AA = AC2_hamiltonian (GL_2, W1. A, W2. A, GR_2)
293263 else
294264 AA = missing
295265 end
296266
297- return JordanMPO_AC2_Hamiltonian (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
267+ S = spacetype (GL)
268+ M = storagetype (GL)
269+ O1 = tensormaptype (S, 1 , 1 , M)
270+ O2 = tensormaptype (S, 2 , 2 , M)
271+ O3 = tensormaptype (S, 3 , 3 , M)
272+ O4 = Core. Compiler. return_type (AC2_hamiltonian, typeof ((GL_2, W1. A, W2. A, GR_2)))
273+
274+ return JordanMPO_AC2_Hamiltonian {O1, O2, O3, O4} (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
298275end
299276
300277# Actions
0 commit comments