-
Notifications
You must be signed in to change notification settings - Fork 56
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
Takagi tol #393
Takagi tol #393
Conversation
Co-authored-by: Eli Bourassa <[email protected]>
Could you provide the matrix for which |
Here you are. The zip file includes .npy file of a matrix for which takagi fails. You can simply load the .npy file |
Thanks. That is a very interesting edge case you found. I suggest you use np.allclose(A, np.diag(np.diag(A)), rtol, atol) is True If this the case, then the Takagi is trivial: d = np.diag(A)
U = np.diag(np.exp(1j*0.5*np.angle(d)))
l = np.abs(d) |
Thanks Nico! I think it would be fine if we can just hardcode the diagonal edge case rather than suppress these numerical zeros. There are already multiple different cases that are treated differently in the function. What do you think? |
Agreed! I don't like the idea of suppressing things. One thing that requires some thinking is whether we need both an I do suggest to call the function input |
Also, please make sure to order the diagonal elements based on their absolute value (in increasing or decreasing order, following |
And also, extra also, why don't you make a PR directly into main? |
Context:
There were issues with Takagi decomposition, specifically sqrtm, with some matrix.
Description of the Change:
Implemented the tolerance parameter to kill small values in the elements of the matrix to be Takagi-decomposed.
Benefits:
Takagi decomposition works well.
Possible Drawbacks:
Takagi decomposition does not work well in other matrices because I have not fully understood why the decomposition have not done well before the change.
Related GitHub Issues: