yingjerkao / uni10

Official Repo for Uni10
28 stars 9 forks source link

complex-real python #20

Closed rezah closed 7 years ago

rezah commented 7 years ago

bdo = uni10.Bond(uni10.BD_OUT, 2) bdi = uni10.Bond(uni10.BD_IN, 2)

a=uni10.UniTensor(uni10.RTYPE,[ bdi, bdo]) a.randomize(uni10.RTYPE)

it should be real, but it's not? ComRel.py.zip

output:


COMPLEX

         ____________
        |            |
    0___|2          2|___1    
        |            |   
        |____________|

================BONDS=============== IN : (U1 = 0, P = 0, 0)|2, Dim = 2 OUT: (U1 = 0, P = 0, 0)|2, Dim = 2

===============BLOCKS=============== --- (U1 = 0, P = 0, 0): 2 x 2 = 4, COMPLEX

(0.394,0.840)    (0.798,0.783)

(0.198,0.912)    (0.768,0.335)
yingjerkao commented 7 years ago

Overloading in C++ doesn't translate directly to pyUni10 interface due to the limitation of Swig, so the UniTensor(uni10.RTYPE, xxx) interfaces are not exposed in pyUni10 and it will be mapped to UniTensor(uni10.CTYPE, xxx) interface when used.

Use a=uni10.UniTensor([ bdi, bdo]) instead.

We plan to phase out the Python wrapping interface and rewrite a Python version of uni10 using Cython.