Skip to content

Commit 939c885

Browse files
authored
Fix add_physical_charge for JordanMPOTensor (#273)
* Fix `add_physical_charge` for `JordanMPOTensor` * remove unneeded name qualifier
1 parent 83cf3e6 commit 939c885

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/operators/jordanmpotensor.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ function _conj_mpo(W::JordanMPOTensor)
307307
return JordanMPOTensor(V, A, B, C, D)
308308
end
309309

310+
function add_physical_charge(O::JordanMPOTensor, charge::Sector)
311+
sectortype(O) == typeof(charge) || throw(SectorMismatch())
312+
auxspace = Vect[typeof(charge)](charge => 1)'
313+
Vdst = left_virtualspace(O)
314+
fuse(physicalspace(O), auxspace)
315+
fuse(physicalspace(O), auxspace) right_virtualspace(O)
316+
Odst = JordanMPOTensor{scalartype(O)}(undef, Vdst)
317+
for (I, v) in nonzero_pairs(O)
318+
Odst[I] = add_physical_charge(v, charge)
319+
end
320+
return Odst
321+
end
322+
310323
# Utility
311324
# -------
312325
function Base.copy(W::JordanMPOTensor)

test/algorithms.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ end
920920

921921
@testset "Sector conventions" begin
922922
L = 4
923-
H = TestSetup.XY_model(U1Irrep; L)
923+
H = XY_model(U1Irrep; L)
924924

925925
H_dense = convert(TensorMap, H)
926926
vals_dense = eigvals(H_dense)

0 commit comments

Comments
 (0)