Skip to content

Commit 1330a66

Browse files
committed
intercepts for DefaultAlgorithm
1 parent 4139bd9 commit 1330a66

10 files changed

Lines changed: 110 additions & 0 deletions

File tree

src/implementations/eig.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ function initialize_output(::typeof(eig_vals!), A::Diagonal, ::DiagonalAlgorithm
7676
return T <: Complex ? diagview(A) : similar(A, complex(T), size(A, 1))
7777
end
7878

79+
# DefaultAlgorithm intercepts
80+
# ---------------------------
81+
for f! in (:eig_full!, :eig_vals!, :eig_trunc!, :eig_trunc_no_error!)
82+
@eval function $f!(A, alg::DefaultAlgorithm)
83+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
84+
end
85+
@eval function $f!(A, out, alg::DefaultAlgorithm)
86+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
87+
end
88+
end
89+
7990
# Implementation
8091
# --------------
8192
function eig_full!(A::AbstractMatrix, DV, alg::LAPACK_EigAlgorithm)

src/implementations/eigh.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ function initialize_output(::typeof(eigh_vals!), A::Diagonal, ::DiagonalAlgorith
8484
return eltype(A) <: Real ? diagview(A) : similar(A, real(eltype(A)), size(A, 1))
8585
end
8686

87+
# DefaultAlgorithm intercepts
88+
# ---------------------------
89+
for f! in (:eigh_full!, :eigh_vals!, :eigh_trunc!, :eigh_trunc_no_error!)
90+
@eval function $f!(A, alg::DefaultAlgorithm)
91+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
92+
end
93+
@eval function $f!(A, out, alg::DefaultAlgorithm)
94+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
95+
end
96+
end
97+
8798
# Implementation
8899
# --------------
89100
function eigh_full!(A::AbstractMatrix, DV, alg::LAPACK_EighAlgorithm)

src/implementations/gen_eig.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ function initialize_output(::typeof(gen_eig_vals!), A::AbstractMatrix, B::Abstra
4646
return D
4747
end
4848

49+
# DefaultAlgorithm intercepts
50+
# ---------------------------
51+
for f! in (:gen_eig_full!, :gen_eig_vals!)
52+
@eval function $f!(A, B, alg::DefaultAlgorithm)
53+
return $f!(A, B, select_algorithm($f!, (A, B), nothing; alg.kwargs...))
54+
end
55+
@eval function $f!(A, B, out, alg::DefaultAlgorithm)
56+
return $f!(A, B, out, select_algorithm($f!, (A, B), nothing; alg.kwargs...))
57+
end
58+
end
59+
4960
# Implementation
5061
# --------------
5162
# actual implementation

src/implementations/lq.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ for f! in (:lq_full!, :lq_compact!)
8686
end
8787
end
8888

89+
# DefaultAlgorithm intercepts
90+
# ---------------------------
91+
for f! in (:lq_full!, :lq_compact!, :lq_null!)
92+
@eval function $f!(A, alg::DefaultAlgorithm)
93+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
94+
end
95+
@eval function $f!(A, out, alg::DefaultAlgorithm)
96+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
97+
end
98+
end
99+
89100
# ==========================
90101
# IMPLEMENTATIONS
91102
# ==========================

src/implementations/orthnull.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ initialize_output(::typeof(right_null!), A, alg::RightNullViaLQ) =
6363
initialize_output(lq_null!, A, alg.alg)
6464
initialize_output(::typeof(right_null!), A, alg::RightNullViaSVD) = nothing
6565

66+
# DefaultAlgorithm intercepts
67+
# ---------------------------
68+
for f! in (:left_orth!, :right_orth!, :left_null!, :right_null!)
69+
@eval function $f!(A, alg::DefaultAlgorithm)
70+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
71+
end
72+
@eval function $f!(A, out, alg::DefaultAlgorithm)
73+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
74+
end
75+
end
76+
6677
# Implementation of orth functions
6778
# --------------------------------
6879
left_orth!(A, VC, alg::AbstractAlgorithm) = left_orth!(A, VC, left_orth_alg(alg))

src/implementations/polar.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ function initialize_output(::typeof(right_polar!), A::AbstractMatrix, ::Abstract
4343
return (P, Wᴴ)
4444
end
4545

46+
# DefaultAlgorithm intercepts
47+
# ---------------------------
48+
for f! in (:left_polar!, :right_polar!)
49+
@eval function $f!(A, alg::DefaultAlgorithm)
50+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
51+
end
52+
@eval function $f!(A, out, alg::DefaultAlgorithm)
53+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
54+
end
55+
end
56+
4657
# Implementation via SVD
4758
# -----------------------
4859
function left_polar!(A::AbstractMatrix, WP, alg::PolarViaSVD)

src/implementations/projections.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ function initialize_output(::typeof(project_isometric!), A::AbstractMatrix, ::Ab
4545
return similar(A)
4646
end
4747

48+
# DefaultAlgorithm intercepts
49+
# ---------------------------
50+
for f! in (:project_hermitian!, :project_antihermitian!, :project_isometric!)
51+
@eval function $f!(A::AbstractMatrix, alg::DefaultAlgorithm)
52+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
53+
end
54+
@eval function $f!(A::AbstractMatrix, out, alg::DefaultAlgorithm)
55+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
56+
end
57+
end
58+
4859
# Implementation
4960
# --------------
5061
function project_hermitian!(A::AbstractMatrix, Aₕ, alg::NativeBlocked)

src/implementations/qr.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ for f! in (:qr_full!, :qr_compact!)
8686
end
8787
end
8888

89+
# DefaultAlgorithm intercepts
90+
# ---------------------------
91+
for f! in (:qr_full!, :qr_compact!, :qr_null!)
92+
@eval function $f!(A, alg::DefaultAlgorithm)
93+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
94+
end
95+
@eval function $f!(A, out, alg::DefaultAlgorithm)
96+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
97+
end
98+
end
99+
89100
# ==========================
90101
# IMPLEMENTATIONS
91102
# ==========================

src/implementations/schur.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ function initialize_output(::typeof(schur_vals!), A::AbstractMatrix, ::AbstractA
3838
return vals
3939
end
4040

41+
# DefaultAlgorithm intercepts
42+
# ---------------------------
43+
for f! in (:schur_full!, :schur_vals!)
44+
@eval function $f!(A, alg::DefaultAlgorithm)
45+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
46+
end
47+
@eval function $f!(A, out, alg::DefaultAlgorithm)
48+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
49+
end
50+
end
51+
4152
# Implementation
4253
# --------------
4354
function schur_full!(A::AbstractMatrix, TZv, alg::LAPACK_EigAlgorithm)

src/implementations/svd.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ function initialize_output(::typeof(svd_vals!), A::Diagonal, ::DiagonalAlgorithm
105105
return eltype(A) <: Real ? diagview(A) : similar(A, real(eltype(A)), size(A, 1))
106106
end
107107

108+
# DefaultAlgorithm intercepts
109+
# ---------------------------
110+
for f! in (:svd_full!, :svd_compact!, :svd_vals!, :svd_trunc!, :svd_trunc_no_error!)
111+
@eval function $f!(A, alg::DefaultAlgorithm)
112+
return $f!(A, select_algorithm($f!, A, nothing; alg.kwargs...))
113+
end
114+
@eval function $f!(A, out, alg::DefaultAlgorithm)
115+
return $f!(A, out, select_algorithm($f!, A, nothing; alg.kwargs...))
116+
end
117+
end
118+
108119
# ==========================
109120
# IMPLEMENTATIONS
110121
# ==========================

0 commit comments

Comments
 (0)