@@ -8,6 +8,9 @@ copy_input(::Union{typeof(eigh_trunc), typeof(eigh_trunc_no_error)}, A) = copy_i
88
99copy_input (:: typeof (eigh_full), A:: Diagonal ) = copy (A)
1010
11+ check_hermiticity (:: AbstractAlgorithm ) = true
12+ check_hermiticity (alg:: Algorithm ) = get (alg. kwargs, :check_hermiticity , true )
13+
1114check_hermitian (A, :: AbstractAlgorithm ) = check_hermitian (A)
1215check_hermitian (A, alg:: Algorithm ) = check_hermitian (A; atol = get (alg. kwargs, :hermitian_tol , default_hermitian_tol (A)))
1316function check_hermitian (A; atol:: Real = default_hermitian_tol (A), rtol:: Real = 0 )
@@ -17,8 +20,11 @@ function check_hermitian(A; atol::Real = default_hermitian_tol(A), rtol::Real =
1720 return nothing
1821end
1922
23+ # keyword arguments consumed by `check_input` that should not be forwarded to the drivers
24+ _driver_kwargs (alg:: Algorithm ) = Base. structdiff (alg. kwargs, NamedTuple{(:check_hermiticity , :hermitian_tol )})
25+
2026function check_input (:: typeof (eigh_full!), A:: AbstractMatrix , DV, alg:: AbstractAlgorithm )
21- check_hermitian (A, alg)
27+ check_hermiticity (alg) && check_hermitian (A, alg)
2228 D, V = DV
2329 m = size (A, 1 )
2430 @assert D isa Diagonal && V isa AbstractMatrix
@@ -29,7 +35,7 @@ function check_input(::typeof(eigh_full!), A::AbstractMatrix, DV, alg::AbstractA
2935 return nothing
3036end
3137function check_input (:: typeof (eigh_vals!), A:: AbstractMatrix , D, alg:: AbstractAlgorithm )
32- check_hermitian (A, alg)
38+ check_hermiticity (alg) && check_hermitian (A, alg)
3339 m = size (A, 1 )
3440 @assert D isa AbstractVector
3541 @check_size (D, (m,))
@@ -38,7 +44,7 @@ function check_input(::typeof(eigh_vals!), A::AbstractMatrix, D, alg::AbstractAl
3844end
3945
4046function check_input (:: typeof (eigh_full!), A:: AbstractMatrix , DV, alg:: DiagonalAlgorithm )
41- check_hermitian (A, alg)
47+ check_hermiticity (alg) && check_hermitian (A, alg)
4248 @assert isdiag (A)
4349 m = size (A, 1 )
4450 D, V = DV
@@ -51,7 +57,7 @@ function check_input(::typeof(eigh_full!), A::AbstractMatrix, DV, alg::DiagonalA
5157end
5258
5359function check_input (:: typeof (eigh_vals!), A:: AbstractMatrix , D, alg:: DiagonalAlgorithm )
54- check_hermitian (A, alg)
60+ check_hermiticity (alg) && check_hermitian (A, alg)
5561 @assert isdiag (A)
5662 m = size (A, 1 )
5763 @assert D isa AbstractVector
@@ -122,12 +128,12 @@ for (f, f_lapack!, Alg) in (
122128 @eval begin
123129 function eigh_full! (A:: AbstractMatrix , DV, alg:: $Alg )
124130 check_input (eigh_full!, A, DV, alg)
125- $ eigh_full_f! (A, DV; alg. kwargs ... )
131+ $ eigh_full_f! (A, DV; _driver_kwargs ( alg) ... )
126132 return DV
127133 end
128134 function eigh_vals! (A:: AbstractMatrix , D, alg:: $Alg )
129135 check_input (eigh_vals!, A, D, alg)
130- $ eigh_vals_f! (A, D; alg. kwargs ... )
136+ $ eigh_vals_f! (A, D; _driver_kwargs ( alg) ... )
131137 return D
132138 end
133139 end
0 commit comments