yingjerkao / uni10

Official Repo for Uni10
28 stars 9 forks source link

Matrix.ctranspose()---python #19

Closed rezah closed 7 years ago

rezah commented 7 years ago

I use python and suppose M is a complex matrix:

M=uni10.CMatrix(D,D) M.randomize(uni10.CTYPE) print M.ctraspose()

error would be: File "/usr/local/lib/python2.7/dist-packages/pyUni10/pyUni10.py", line 1677, in getattr = lambda self, name: _swig_getattr(self, Matrix, name) File "/usr/local/lib/python2.7/dist-packages/pyUni10/pyUni10.py", line 74, in _swig_getattr return _swig_getattr_nondynamic(self, class_type, name, 0) File "/usr/local/lib/python2.7/dist-packages/pyUni10/pyUni10.py", line 69, in _swig_getattr_nondynamic return object.getattr(self, name) AttributeError: type object 'object' has no attribute 'getattr'

yingjerkao commented 7 years ago

print M.ctraspose()

Is this a typo?

It should be M.cTranspose()

yingjerkao commented 7 years ago

import pyUni10 as uni10 D=3 M=uni10.CMatrix(D,D) M.randomize(uni10.CTYPE) print M print M.cTranspose()

3 x 3 = 9, COMPLEX (0.142,0.837) (0.227,0.893) (0.474,0.288) (0.918,0.497) (0.111,0.786) (0.166,0.437) (0.633,0.460) (0.823,0.027) (0.702,0.194)

3 x 3 = 9, COMPLEX (0.656,-0.724) (0.234,-0.293) (0.745,-0.109) (0.180,-0.347) (0.141,-0.296) (0.404,-0.054) (0.933,-0.897) (0.359,-0.190) (0.862,-0.658)

rezah commented 7 years ago

Thank you, you are totally right, I did it because I followed this documentation, http://uni10-tutorials.readthedocs.io/en/latest/pyUni10.Matrix.html I've got confused because there are some differences between python functions and those C++ ones. A unique documentation is really useful.