You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integer matrix exponentiation in schurpow (#51992)
This improves type-inference by avoiding recursion, as the `A^p` method
calls `schurpow` if `p` is a float. After this, the result of `schurpow`
is inferred as a small `Union`:
```julia
julia> @inferred Union{Matrix{ComplexF64}, Matrix{Float64}} LinearAlgebra.schurpow([1.0 2; 3 4], 2.0)
2×2 Matrix{Float64}:
7.0 10.0
15.0 22.0
```
One concern here might be that for large `p`, the `A^Int(p)` computation
might be expensive by repeated multiplication, as opposed to
diagonalization. However, this may only be the case for really large
`p`, which may not be commonly encountered.
I've added a test, but I'm unsure if `schurpow` is deemed to be an
internal function, and this test is unwise. Unfortunately, the return
type of `A^p` isn't concretely inferred yet as there are too many
possible types that are returned, so I couldn't test for that.
0 commit comments