@@ -30,7 +30,7 @@ function changebonds!(ψ::InfiniteMPS, alg::RandExpand)
3030 V = sample_space (infimum (right_virtualspace (VL), space (VR, 1 )), alg. trscheme)
3131
3232 # obtain (orthogonal) directions as isometries in that direction
33- XL = randisometry (storagetype (VL), right_virtualspace (VL) ← V)
33+ XL = randisometry (scalartype (VL), right_virtualspace (VL) ← V)
3434 AL′[i] = VL * XL
3535 XR = randisometry (storagetype (VL), space (VR, 1 ) ← V)
3636 AR′[i + 1 ] = XR * VR
@@ -73,8 +73,8 @@ function changebonds!(ψ::AbstractFiniteMPS, alg::RandExpand)
7373end
7474
7575function sample_space (V, strategy)
76- S = TensorKit. SectorDict (c => Random. randexp (dim (V, c)) for c in sectors (V))
77- ind = MatrixAlgebraKit. findtruncated (S, strategy)
76+ S = TensorKit. SectorDict (c => sort! ( Random. rand (dim (V, c)); rev = true ) for c in sectors (V))
77+ ind = MatrixAlgebraKit. findtruncated_svd (S, strategy)
7878 return TensorKit. Factorizations. truncate_space (V, ind)
7979end
8080
@@ -110,7 +110,7 @@ function changebonds!(ψ::InfiniteMPS, alg::RandPerturbedExpand)
110110 # add (orthogonal) directions as isometries in that direction
111111 VL = left_null (ψ. AL[i])
112112 V = sample_space (right_virtualspace (VL), alg. trscheme)
113- XL = randisometry (storagetype (VL), right_virtualspace (VL) ← V)
113+ XL = randisometry (scalartype (VL), right_virtualspace (VL) ← V)
114114 ψ. AL[i] = catdomain (ψ. AL[i], VL * XL)
115115
116116 # make sure the next site fits, by "absorbing" into a larger tensor
@@ -122,15 +122,46 @@ function changebonds!(ψ::InfiniteMPS, alg::RandPerturbedExpand)
122122 end
123123
124124 # properly regauge the state:
125+ makefullrank! (ψ. AL)
125126 ψ. AR .= similar .(ψ. AL)
126- ψ. AC .= similar .(ψ. AL)
127+ # ψ.AC .= similar.(ψ.AL)
127128
128129 # initial guess for gauge is embedded original C
129130 C₀ = similar (ψ. C[0 ], right_virtualspace (ψ. AL[end ]) ← left_virtualspace (ψ. AL[1 ]))
130131 absorb! (id! (C₀), ψ. C[0 ])
131132
132- gaugefix! (ψ, ψ. AL, C₀; order = :LR , alg. alg_gauge. maxiter, alg. alg_gauge. tol)
133+ gaugefix! (ψ, ψ. AL, C₀; order = :R , alg. alg_gauge. maxiter, alg. alg_gauge. tol)
134+
135+ for i in reverse (1 : length (ψ))
136+ # obtain space by sampling the support of left nullspace
137+ # add (orthogonal) directions as isometries in that direction
138+ AR_tail = _transpose_tail (ψ. AR[i]; copy = true )
139+ VR = right_null (AR_tail)
140+ V = sample_space (space (VR, 1 ), alg. trscheme)
141+ XR = randisometry (scalartype (VR), space (VR, 1 ) ← V)
142+ ψ. AR[i] = _transpose_front (catcodomain (AR_tail, XR' * VR))
143+
144+ # make sure the next site fits, by "absorbing" into a larger tensor
145+ # with some random noise to ensure state is still gauge-able
146+ AR = ψ. AR[i - 1 ]
147+ AR′ = similar (AR, left_virtualspace (AR) ⊗ physicalspace (AR) ← left_virtualspace (ψ. AR[i]))
148+ scale! (randn! (AR′), alg. noisefactor)
149+ ψ. AR[i - 1 ] = TensorKit. absorb! (AR′, AR)
150+ end
151+
152+ # properly regauge the state:
153+ makefullrank! (ψ. AR)
154+ ψ. AL .= similar .(ψ. AR)
155+ ψ. AC .= similar .(ψ. AR)
156+
157+ # initial guess for gauge is embedded original C
158+ C₀ = similar (ψ. C[0 ], right_virtualspace (ψ. AR[end ]) ← left_virtualspace (ψ. AR[1 ]))
159+ absorb! (id! (C₀), ψ. C[0 ])
160+
161+ gaugefix! (ψ, ψ. AR, C₀; order = :LR , alg. alg_gauge. maxiter, alg. alg_gauge. tol)
133162 mul! .(ψ. AC, ψ. AL, ψ. C)
134163
135164 return ψ
136165end
166+
167+ changebonds (ψ:: InfiniteMPS , alg:: RandPerturbedExpand ) = changebonds! (copy (ψ), alg)
0 commit comments