File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,14 +87,16 @@ See also [`eig_full(!)`](@ref eig_full) and [`eig_trunc(!)`](@ref eig_trunc).
8787
8888# Algorithm selection
8989# -------------------
90- # Default to LAPACK for `YALAPACK.BlasMat`
91- function default_algorithm ( :: typeof (eig_full!), :: Type{A} ;
92- kwargs... ) where {A <: YALAPACK.BlasMat }
90+ default_eig_algorithm (A; kwargs ... ) = default_eig_algorithm ( typeof (A); kwargs ... )
91+ default_eig_algorithm (T :: Type ; kwargs ... ) = throw ( MethodError (default_eig_algorithm, (T,)))
92+ function default_eig_algorithm ( :: Type{T} ; kwargs... ) where {T <: YALAPACK.BlasMat }
9393 return LAPACK_Expert (; kwargs... )
9494end
95- function default_algorithm (:: typeof (eig_vals!), :: Type{A} ;
96- kwargs... ) where {A<: YALAPACK.BlasMat }
97- return LAPACK_Expert (; kwargs... )
95+
96+ for f in (:eig_full! , :eig_vals! )
97+ @eval function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
98+ return default_eig_algorithm (A; kwargs... )
99+ end
98100end
99101
100102function select_algorithm (:: typeof (eig_trunc!), :: Type{A} , alg; trunc= nothing ,
Original file line number Diff line number Diff line change @@ -86,16 +86,20 @@ See also [`eigh_full(!)`](@ref eigh_full) and [`eigh_trunc(!)`](@ref eigh_trunc)
8686
8787# Algorithm selection
8888# -------------------
89- # Default to LAPACK for `YALAPACK.BlasMat`
90- function default_algorithm (:: typeof (eigh_full!), :: Type{A} ;
91- kwargs... ) where {A<: YALAPACK.BlasMat }
92- return LAPACK_MultipleRelativelyRobustRepresentations (; kwargs... )
89+ default_eigh_algorithm (A; kwargs... ) = default_eigh_algorithm (typeof (A); kwargs... )
90+ function default_eigh_algorithm (T:: Type ; kwargs... )
91+ throw (MethodError (default_eigh_algorithm, (T,)))
9392end
94- function default_algorithm (:: typeof (eigh_vals!), :: Type{A} ;
95- kwargs... ) where {A<: YALAPACK.BlasMat }
93+ function default_eigh_algorithm (:: Type{T} ; kwargs... ) where {T<: YALAPACK.BlasMat }
9694 return LAPACK_MultipleRelativelyRobustRepresentations (; kwargs... )
9795end
9896
97+ for f in (:eigh_full! , :eigh_vals! )
98+ @eval function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
99+ return default_eigh_algorithm (A; kwargs... )
100+ end
101+ end
102+
99103function select_algorithm (:: typeof (eigh_trunc!), :: Type{A} , alg; trunc= nothing ,
100104 kwargs... ) where {A<: YALAPACK.BlasMat }
101105 alg_eigh = select_algorithm (eigh_full!, A, alg; kwargs... )
Original file line number Diff line number Diff line change @@ -68,11 +68,18 @@ See also [`qr_full(!)`](@ref lq_full) and [`qr_compact(!)`](@ref lq_compact).
6868
6969# Algorithm selection
7070# -------------------
71+ default_lq_algorithm (A; kwargs... ) = default_lq_algorithm (typeof (A); kwargs... )
72+ function default_lq_algorithm (T:: Type ; kwargs... )
73+ throw (MethodError (default_lq_algorithm, (T,)))
74+ end
75+ function default_lq_algorithm (:: Type{T} ; kwargs... ) where {T<: YALAPACK.BlasMat }
76+ return LAPACK_HouseholderLQ (; kwargs... )
77+ end
78+
7179for f in (:lq_full! , :lq_compact! , :lq_null! )
7280 @eval begin
73- function default_algorithm (:: typeof ($ f), :: Type{A} ;
74- kwargs... ) where {A<: YALAPACK.BlasMat }
75- return LAPACK_HouseholderLQ (; kwargs... )
81+ function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
82+ return default_lq_algorithm (A; kwargs... )
7683 end
7784 end
7885end
Original file line number Diff line number Diff line change 6060
6161# Algorithm selection
6262# -------------------
63- function default_algorithm (:: typeof (left_polar!), :: Type{A} ;
64- kwargs... ) where {A<: YALAPACK.BlasMat }
65- return PolarViaSVD (default_algorithm (svd_compact!, A; kwargs... ))
66- end
67- function default_algorithm (:: typeof (right_polar!), :: Type{A} ;
68- kwargs... ) where {A<: YALAPACK.BlasMat }
69- return PolarViaSVD (default_algorithm (svd_compact!, A; kwargs... ))
63+ default_polar_algorithm (A; kwargs... ) = default_polar_algorithm (typeof (A); kwargs... )
64+ function default_polar_algorithm (T:: Type ; kwargs... )
65+ throw (MethodError (default_polar_algorithm, (T,)))
66+ end
67+ function default_polar_algorithm (:: Type{T} ; kwargs... ) where {T<: YALAPACK.BlasMat }
68+ return PolarViaSVD (default_algorithm (svd_compact!, T; kwargs... ))
69+ end
70+
71+ for f in (:left_polar! , :right_polar! )
72+ @eval function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
73+ return default_polar_algorithm (A; kwargs... )
74+ end
7075end
Original file line number Diff line number Diff line change @@ -68,11 +68,19 @@ See also [`lq_full(!)`](@ref lq_full) and [`lq_compact(!)`](@ref lq_compact).
6868
6969# Algorithm selection
7070# -------------------
71+ default_qr_algorithm (A; kwargs... ) = default_qr_algorithm (typeof (A); kwargs... )
72+ function default_qr_algorithm (T:: Type ; kwargs... )
73+ throw (MethodError (default_qr_algorithm, (T,)))
74+ end
75+ function default_qr_algorithm (:: Type{T} ; kwargs... ) where {T<: YALAPACK.BlasMat }
76+ return LAPACK_HouseholderQR (; kwargs... )
77+ end
78+
7179for f in (:qr_full! , :qr_compact! , :qr_null! )
7280 @eval begin
7381 function default_algorithm (:: typeof ($ f), :: Type{A} ;
7482 kwargs... ) where {A<: YALAPACK.BlasMat }
75- return LAPACK_HouseholderQR ( ; kwargs... )
83+ return default_qr_algorithm (A ; kwargs... )
7684 end
7785 end
7886end
Original file line number Diff line number Diff line change @@ -51,11 +51,8 @@ See also [`eig_full(!)`](@ref eig_full) and [`eig_trunc(!)`](@ref eig_trunc).
5151
5252# Algorithm selection
5353# -------------------
54- function default_algorithm (:: typeof (schur_full!), :: Type{A} ;
55- kwargs... ) where {A<: YALAPACK.BlasMat }
56- return default_algorithm (eig_full!, A; kwargs... )
57- end
58- function default_algorithm (:: typeof (schur_vals!), :: Type{A} ;
59- kwargs... ) where {A<: YALAPACK.BlasMat }
60- return default_algorithm (eig_vals!, A; kwargs... )
54+ for f in (:schur_full! , :schur_vals! )
55+ @eval function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
56+ return default_eig_algorithm (A; kwargs... )
57+ end
6158end
Original file line number Diff line number Diff line change @@ -90,11 +90,17 @@ See also [`svd_full(!)`](@ref svd_full), [`svd_compact(!)`](@ref svd_compact) an
9090
9191# Algorithm selection
9292# -------------------
93+ default_svd_algorithm (A; kwargs... ) = default_svd_algorithm (typeof (A); kwargs... )
94+ function default_svd_algorithm (T:: Type ; kwargs... )
95+ throw (MethodError (default_svd_algorithm, (T,)))
96+ end
97+ function default_svd_algorithm (:: Type{T} ; kwargs... ) where {T<: YALAPACK.BlasMat }
98+ return LAPACK_DivideAndConquer (; kwargs... )
99+ end
100+
93101for f in (:svd_full! , :svd_compact! , :svd_vals! )
94- # Default to LAPACK SDD for `YALAPACK.BlasMat`
95- @eval function default_algorithm (:: typeof ($ f), :: Type{A} ;
96- kwargs... ) where {A<: YALAPACK.BlasMat }
97- return LAPACK_DivideAndConquer (; kwargs... )
102+ @eval function default_algorithm (:: typeof ($ f), :: Type{A} ; kwargs... ) where {A}
103+ return default_svd_algorithm (A; kwargs... )
98104 end
99105end
100106
You can’t perform that action at this time.
0 commit comments