-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
missing cbrt(A::AbstractMatrix) #47513
Comments
Hey , I want to contribute and try to write code for cbrt() function of matrix. But I am new to contributing to julia and concept of cube root of a matrix. Can you please elaborate this point
|
For However, the Moreover, the julia> cbrt(-1)
-1.0
julia> complex(-1)^(1//3)
0.5 + 0.8660254037844386im and the matrix version should do the same. |
Related to #36534 — the question of which branch cut should be used is non-obvious even for I don't think this is a "good first issue" because the linear-algebra here may be tricky, especially for non-real-symmetric matrices where you can't use eigenvalues. |
Consistent with the discussion in #36534, I think we would only want to define this for real matrices and (probably) for complex-Hermitian matrices. |
@stevengj I would like to work on this. Give me couple of days to understand the code base and contribution guidelines. By the way which file I would have to edit? |
look for where sqrt of matrix is defined. next to that seems like a good place. |
@theWiseAman Kindly let me know if I can be of help with this implementation... |
This is not such an easy issue to work on unless you understand a fair amount of linear algebra. In particular, until you understand why At minimum, you need to understand this paper (which also gives a |
As discussed above, I wouldn't support complex matrices, because it relies on nonstandard branch cuts that will be different from
If you have problems with |
Based on my revised reading of the requirements of this issue, taking into consideration the latest post by the author (@stevengj), please find below a summary of the goals of this issue and a plan. GoalAkin to scalar values, cube-root of a real-valued matrix can be arranged to be real-valued. In Julia, presently, cube-root of a matrix via
Plan
Implementation notesExcept for the algorithm indicated by OP in [1], a quick search revealed no literature from Preparation
Overall TODOs
References
|
For real-symmetric matrices, you should definitely use the |
This paper has an algorithm for computing p-th real roots from the quasi-triangular Schur decomposition: |
Implementation #1
❤️ Thank you, @cafaxo for the reference. The PR below is based on your suggestion. Comments are welcome!
See PR #50661 for more details. |
I just noticed that this function is missing, even though we have
sqrt(A)
andA^(1/3)
for matrices.Seems like it should be
straightforward andreasonable to add.cbrt(A::AbstractMatrix) = A^(1//3)
may beis definitely insufficient, however: we should at least have a specializedcbrt(A::AbstractMatrix{<:Real})
method that always returns a type-stable real matrix.This paper (which we use for
sqrt(A)
) also gives a matrixcbrt
algorithm (that yields a real root if you usecbrt
in equation 5.2) for the non-real-symmetric case. (The real-symmetric case is easy because you just applycbrt
to the eigenvalues.)The text was updated successfully, but these errors were encountered: