Skip to content

Commit d5b7e59

Browse files
committed
change sector convention quasiparticle state
1 parent f0fc1cd commit d5b7e59

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/states/quasiparticle_state.jl

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ function LeftGaugedQP(datfun, left_gs, right_gs=left_gs;
3131
sector=one(sectortype(left_gs)), momentum=0.0)
3232
# find the left null spaces for the TNS
3333
excitation_space = Vect[typeof(sector)](sector => 1)
34-
VLs = [adjoint(rightnull(adjoint(v))) for v in left_gs.AL]
35-
Xs = [TensorMap{scalartype(left_gs)}(undef, _lastspace(VLs[loc])',
36-
excitation_space' *
37-
right_virtualspace(right_gs, loc))
38-
for loc in 1:length(left_gs)]
39-
fill_data!.(Xs, datfun)
34+
VLs = convert(Vector, map(leftnull, left_gs.AL))
35+
Xs = map(enumerate(VLs)) do (i, vl)
36+
x = similar(vl,
37+
right_virtualspace(vl)
38+
excitation_space
39+
right_virtualspace(right_gs, i))
40+
return fill_data!(x, datfun)
41+
end
4042
left_gs isa InfiniteMPS ||
4143
momentum == zero(momentum) ||
4244
@warn "momentum is ignored for finite quasiparticles"
@@ -45,13 +47,15 @@ end
4547

4648
function RightGaugedQP(datfun, left_gs, right_gs=left_gs;
4749
sector=one(sectortype(left_gs)), momentum=0.0)
48-
#find the left null spaces for the TNS
50+
# find the left null spaces for the TNS
4951
excitation_space = Vect[typeof(sector)](sector => 1)
50-
VRs = [adjoint(leftnull(adjoint(v))) for v in _transpose_tail.(right_gs.AR)]
51-
Xs = [TensorMap{scalartype(left_gs)}(undef, left_virtualspace(right_gs, loc)',
52-
excitation_space' * _firstspace(VRs[loc]))
53-
for loc in 1:length(left_gs)]
54-
fill_data!.(Xs, datfun)
52+
VRs = convert(Vector, map(rightnull! _transpose_tail, right_gs.AR))
53+
Xs = map(enumerate(VRs)) do (i, vr)
54+
x = similar(vr,
55+
left_virtualspace(left_gs, i)'
56+
excitation_space _firstspace(vr))
57+
return fill_data!(x, datfun)
58+
end
5559
left_gs isa InfiniteMPS ||
5660
momentum == zero(momentum) ||
5761
@warn "momentum is ignored for finite quasiparticles"
@@ -68,10 +72,10 @@ function Base.similar(v::RightGaugedQP, T=scalartype(v))
6872
v.momentum)
6973
end
7074

71-
Base.getindex(v::LeftGaugedQP, i::Int) = v.VLs[mod1(i, end)] * v.Xs[mod1(i, end)];
75+
Base.getindex(v::LeftGaugedQP, i::Int) = v.VLs[mod1(i, end)] * v.Xs[mod1(i, end)]
7276
function Base.getindex(v::RightGaugedQP, i::Int)
7377
@plansor t[-1 -2; -3 -4] := v.Xs[mod1(i, end)][-1; -3 1] * v.VRs[mod1(i, end)][1; -4 -2]
74-
end;
78+
end
7579

7680
function Base.setindex!(v::LeftGaugedQP, B, i::Int)
7781
v.Xs[mod1(i, end)] = v.VLs[mod1(i, end)]' * B

0 commit comments

Comments
 (0)