yingjerkao / uni10

Official Repo for Uni10
28 stars 9 forks source link

transpose---python #13

Open rezah opened 7 years ago

rezah commented 7 years ago

Suppose mpo_uni10 is a tensor, the following is not the same!!!

mpo_uni10.getBlock().transpose(), mpo_uni10.transpose().getBlock()

The same for below: suppose Mat1, Mat2 are two matrices

Mat=Mat1 * Mat2 Mat.transpose() is not the same as (Mat1*Mat2).transpose()

I've attached the python code. R.py.tar.gz

yingjerkao commented 7 years ago

Bug is reproduced. If I change the code to

print   mpo_uni10.getBlock()
A=mpo_uni10.getBlock()
print A.transpose()
print mpo_uni10.transpose().getBlock()

The result looks ok. On the other hand, mpo_uni10.getBlock().transpose() gives weird result.

Haven't isolate the problem yet.

yingjerkao commented 7 years ago

getBlock() and transpose() have different return types

Matrix& transpose();

Matrix getBlock(bool diag = false)const;

SWIG might wrap them differently. Will investigate deeper.