-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMatrixAlgebraKitGenericSchurExt.jl
More file actions
51 lines (43 loc) · 1.51 KB
/
MatrixAlgebraKitGenericSchurExt.jl
File metadata and controls
51 lines (43 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module MatrixAlgebraKitGenericSchurExt
using MatrixAlgebraKit
using MatrixAlgebraKit: check_input, GS, Driver
import MatrixAlgebraKit: geev!, geevx!, gees!, eig_full!, eig_vals!, schur_full!, schur_vals!
using LinearAlgebra: Diagonal, sorteig!
using GenericSchur
const GSFloat = Union{Float16, ComplexF16, BigFloat, Complex{BigFloat}}
function MatrixAlgebraKit.default_eig_algorithm(
::Type{T};
balanced::Bool = false, driver::Driver = GS(), kwargs...
) where {T <: StridedMatrix{<:GSFloat}}
return QRIteration(; driver, balanced, kwargs...)
end
function geev!(::GS, A::AbstractMatrix, Dd::AbstractVector, V::AbstractMatrix; kwargs...)
D, Vmat = GenericSchur.eigen!(A)
copyto!(Dd, D)
length(V) > 0 && copyto!(V, Vmat)
return Dd, V
end
function gees!(driver::GS, A::AbstractMatrix, Z::AbstractMatrix, vals::AbstractVector)
S = GenericSchur.gschur(A)
copyto!(A, S.T)
length(Z) > 0 && copyto!(Z, S.Z)
copyto!(vals, sorteig!(S.values))
return A, Z, vals
end
Base.@deprecate(
eig_full!(A, DV, alg::GS_QRIteration),
eig_full!(A, DV, QRIteration(; driver = GS(), alg.kwargs...))
)
Base.@deprecate(
eig_vals!(A, D, alg::GS_QRIteration),
eig_vals!(A, D, QRIteration(; driver = GS(), alg.kwargs...))
)
Base.@deprecate(
schur_full!(A, TZv, alg::GS_QRIteration),
schur_full!(A, TZv, QRIteration(; driver = GS(), alg.kwargs...))
)
Base.@deprecate(
schur_vals!(A, vals, alg::GS_QRIteration),
schur_vals!(A, vals, QRIteration(; driver = GS(), alg.kwargs...))
)
end