-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Error in matrix^power if eigenvalues are complex #340
Comments
If we revert this, I think we'd get rid of the error. The matrix power function could use some love. I don't think it is advisable to compute the eigen decomposition in the nonsymmetric case. We should do Algorithm 1 in http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.452.6407&rep=rep1&type=pdf which I think we are already doing for some of the other matrix function. That would also fix this issue. |
@andreasnoack Yes, if we replace the line in question ( eltype(v) <: Complex || (any(v.<0) && (v = complex(v))) the error should go away. But using "Algorithm 1" would be much better. IIUC, |
See also JuliaLang/julia#5840, JuliaLang/julia#12584 |
@alyst It would be great if you could prepare a PR. |
@andreasnoack There's already JuliaLang/julia#12584, which implements state-of-the-art Schur–Padé algorithm (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.297.2021&rep=rep1&type=pdf). I hope the author is around and that PR could be merged soon. |
True. I'd forgotten that PR. Hopefully, @mfasi can be persuaded to finish it. That would be a big improvement over what we have now. |
I agree. julia> A=[1 0;1 1]
2×2 Array{Int64,2}:
1 0
1 1
julia> A^7
2×2 Array{Int64,2}:
1 0
7 1
julia> A^7.00001
2×2 Array{Float64,2}:
1.0 0.0
0.0 1.0
julia> expm(7.00001 * logm(A))
2×2 Array{Float64,2}:
1.0 0.0
7.00001 1.0 |
@alyst @andreasnoack I am still around and willing to work on the PR. I seem to recollect that the patch was ready to be merged, when I stopped working on it. I will rebase the branch and see what happens. |
@mfasi Thanks! |
@mfasi That would be really great. |
Fixed by JuliaLang/julia#21184. |
The
M^p
code for the generic case (p::Number
) assumes thateig()
returns real eigenvalues that could be compared with0
. That gives an error if eigenvalues are complex. E.g. (julia 0.4.5):The text was updated successfully, but these errors were encountered: