Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conj for UniTensor #194

Closed
chiamin opened this issue Jul 22, 2023 · 7 comments
Closed

Conj for UniTensor #194

chiamin opened this issue Jul 22, 2023 · 7 comments
Labels
convo need further discussion enhancement New feature or request

Comments

@chiamin
Copy link
Collaborator

chiamin commented Jul 22, 2023

I found that Conj seems not supporting UniTensor; is it true? Here is code

import cytnx

T = cytnx.arange(2*3*4).reshape(2,3,4)
uT = cytnx.UniTensor(T, labels=["a","b","c"])
uT2 = cytnx.linalg.Conj(uT)
print(uT)
print(uT2)

and the error

Traceback (most recent call last):
  File "/home/chiamin/project/2023/cytnx/test.py", line 5, in <module>
    uT2 = cytnx.linalg.Conj(uT)
TypeError: Conj(): incompatible function arguments. The following argument types are supported:
    1. (Tin: cytnx.cytnx.Tensor) -> cytnx.cytnx.Tensor

Invoked with:

Another comment. I think Conj should not be defined in linalg since it is not a linear algebra operator.

@kaihsin
Copy link
Member

kaihsin commented Jul 23, 2023

But Conj is a linear algebra operation?

@kaihsin
Copy link
Member

kaihsin commented Jul 23, 2023

currently, for UniTensor, Conj is a member function. ofc we can wrap a linalg function for it to make it consistent?

@kaihsin kaihsin added enhancement New feature or request convo need further discussion labels Jul 23, 2023
@chiamin
Copy link
Collaborator Author

chiamin commented Jul 23, 2023

For Tensor, Conj is defined in cytnx.linalg

import cytnx

T = cytnx.arange(2*3*4).reshape(2,3,4)
T2 = cytnx.linalg.Conj(T)
print(T2)

OK I didn't know that there is a Conj member function. I confirm that the following code works.

import cytnx

T = cytnx.arange(2*3*4).reshape(2,3,4)
uT = cytnx.UniTensor(T, labels=["a","b","c"])
uT2 = uT.Conj()
print(uT)
print(uT2)

I was thinking to make it a global function in Cytnx, but I think a member function is also good.

@chiamin chiamin closed this as completed Jul 23, 2023
@kaihsin kaihsin reopened this Jul 25, 2023
@kaihsin
Copy link
Member

kaihsin commented Jul 25, 2023

I think we need this, but its not urgent

@chiamin
Copy link
Collaborator Author

chiamin commented Jul 25, 2023

Do you think we can make it before the draft is out? Conj is necessary for some applications so I think it is better to have it before the draft is out.

@kaihsin
Copy link
Member

kaihsin commented Jul 26, 2023 via email

@jeffry1829
Copy link
Collaborator

#207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
convo need further discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants