def horizontalPair(leftSite, rightSite, cleanLeft=True, cleanRight=True): pair = bops.multiContraction(leftSite, rightSite, '1', '3', cleanOr1=cleanLeft, cleanOr2=cleanRight) pair = bops.multiContraction(pair, ru.getPairUnitary(d), '37', '01') [left, right, te] = bops.svdTruncation(pair, [0, 1, 2, 6], [3, 4, 5, 7], '>>', maxBondDim=16) return bops.permute(left, [0, 4, 1, 2, 3]), bops.permute(right, [1, 2, 3, 0, 4])
def verticalPair(topSite, bottomSite, cleanTop=True, cleanBottom=True): pair = bops.multiContraction(topSite, bottomSite, '2', '0', cleanOr1=cleanTop, cleanOr2=cleanBottom) pair = bops.multiContraction(pair, ru.getPairUnitary(d), '37', '01', cleanOr1=True, cleanOr2=True) [top, bottom, te] = bops.svdTruncation(pair, [0, 1, 2, 6], [3, 4, 5, 7], '>>', maxBondDim=16) return bops.permute(top, [0, 1, 4, 2, 3]), bottom