Skip to content

Commit 4046fad

Browse files
committed
Start setting up ortho for mpohamiltonian
1 parent df76b90 commit 4046fad

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/operators/ortho.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function TensorKit.leftorth!(W::JordanMPOTensor; alg = QRpos())
2+
# orthogonalize second column against first
3+
WI = removeunit(W[1, 1, 1, 1], 1)
4+
@tensor t[l; r] := conj(WI[p; p' l]) * W.C[p; p' r]
5+
I = sectortype(W)
6+
S = spacetype(W)
7+
8+
@tensor t[l; r] := conj(removeunit(W[1, 1, 1, 1], 1)[p; p' l]) * W.C[p; p' r]
9+
@tensor C′[p; p' r] := W.C[p; p' r] - WI[p; p' l] * t[l; r]
10+
11+
# QR of second column
12+
CA = cat(insertleftunit(C′, 1), W.A; dims = 1)
13+
Q, r = leftorth(CA, ((3, 1, 2), (4,)); alg)
14+
Q′ = transpose(Q, ((2, 3), (1, 4)))
15+
V = codomain(W) physicalspace(W) BlockTensorKit.oplus(oneunit(S), right_virtualspace(Q′), oneunit(S))
16+
Q1 = SparseBlockTensorMap(Q′[2:end, 1, 1, 1])
17+
Q2 = removeunit(SparseBlockTensorMap(Q′[1:1, 1, 1, 1]), 1)
18+
19+
# Assemble output
20+
W′ = JordanMPOTensor(V, Q1, W.B, Q2, W.D)
21+
22+
R = similar(W, right_virtualspace(W′) right_virtualspace(W′))
23+
R[1, 1] = id!(R[1, 1])
24+
R[1, 2] = t
25+
R[2, 2] = r
26+
R[3, 3] = id!(R[3, 3])
27+
28+
return W′, R
29+
end

0 commit comments

Comments
 (0)