Skip to content

Output of UniTensor.GetTotalQnums not sorted #2

@yingjerkao

Description

@yingjerkao
import Tor10
bd_sym_1 = Tor10.Bond(3, Tor10.BD_KET, qnums=[[0, 2, 1, 0],
                                                [1, 1, -1, 1],
                                                [2, -1, 1, 0]])
bd_sym_2 = Tor10.Bond(4, Tor10.BD_KET, qnums=[[-1, 0, -1, 3],
                                                [0, 0, -1, 2],
                                                [1, 0, 1, 0],
                                                [2, -2, -1, 1]])
bd_sym_3 = Tor10.Bond(2, Tor10.BD_BRA, qnums=[[-4, 3, 0, -1],
                                                [1, 1, -2, 3]])

sym_T = Tor10.UniTensor(bonds=[bd_sym_1, bd_sym_2, bd_sym_3], rowrank=2, labels=[1, 2, 3])

tqin, tqout = sym_T.GetTotalQnums()

qin=Tor10.Bond(12,Tor10.BD_KET, qnums=[[+4, -3, +0, +1], [+3, -1, +2, +0], [+2, -1, +0, +2],
                                       [+1, -1, +0, +3], [+3, -1, -2, +2], [+2, +1, +0, +1],
                                       [+1, +1, -2, +3], [+0, +1, -2, +4], [+2, +0, +0, +1],
                                       [+1, +2, +2, +0], [+0, +2, +0, +2], [-1, +2, +0, +3]]
                           )
print(tqin)

print(qin)

Output

Dim = 12 |
KET     : U1::  +4 +3 +2 +1 +3 +2 +1 +0 +2 +1 +0 -1
          U1::  -3 -1 -1 -1 -1 +1 +1 +1 +0 +2 +2 +2
          U1::  +0 +2 +0 +0 -2 +0 -2 -2 +0 +2 +0 +0
          U1::  +1 +0 +2 +3 +2 +1 +3 +4 +1 +0 +2 +3
         
Dim = 12 |
KET     : U1::  +4 +3 +3 +2 +2 +2 +1 +1 +1 +0 +0 -1
          U1::  -3 -1 -1 +1 +0 -1 +2 +1 -1 +2 +1 +2
          U1::  +0 +2 -2 +0 +0 +0 +2 -2 +0 +0 -2 +0
          U1::  +1 +0 +2 +1 +1 +2 +0 +3 +3 +2 +4 +3

I wonder why bond qnums in the Bond.assign should be sorted? Or should we sort the output of UniTensor.GetTotalQnums?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions