Skip to content

Commit 9eaa4a2

Browse files
committed
disambiguate alg selection
1 parent f8c2139 commit 9eaa4a2

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

src/interface/orthnull.jl

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,14 @@ function select_algorithm(::typeof(left_orth!), A, alg::Symbol; trunc = nothing,
371371
throw(ArgumentError(lazy"Unknown alg symbol $alg"))
372372
end
373373

374-
default_algorithm(::typeof(left_orth!), A; trunc = nothing, kwargs...) =
374+
default_algorithm(::typeof(left_orth!), A::TA; trunc = nothing, kwargs...) where {TA} =
375375
isnothing(trunc) ? select_algorithm(left_orth_qr!, A; kwargs...) :
376376
select_algorithm(left_orth_svd!, A; trunc, kwargs...)
377+
# disambiguate
378+
default_algorithm(::typeof(left_orth!), ::Type{A}; trunc = nothing, kwargs...) where {A} =
379+
isnothing(trunc) ? select_algorithm(left_orth_qr!, A; kwargs...) :
380+
select_algorithm(left_orth_svd!, A; trunc, kwargs...)
381+
377382

378383
select_algorithm(::typeof(left_orth_qr!), A, alg = nothing; kwargs...) =
379384
select_algorithm(qr_compact!, A, alg; kwargs...)
@@ -397,10 +402,15 @@ function select_algorithm(::typeof(right_orth!), A, alg::Symbol; trunc = nothing
397402
throw(ArgumentError(lazy"Unknown alg symbol $alg"))
398403
end
399404

400-
default_algorithm(::typeof(right_orth!), A; trunc = nothing, kwargs...) =
405+
default_algorithm(::typeof(right_orth!), A::TA; trunc = nothing, kwargs...) where {TA} =
406+
isnothing(trunc) ? select_algorithm(right_orth_lq!, A; kwargs...) :
407+
select_algorithm(right_orth_svd!, A; trunc, kwargs...)
408+
# disambiguate:
409+
default_algorithm(::typeof(right_orth!), ::Type{A}; trunc = nothing, kwargs...) where {A} =
401410
isnothing(trunc) ? select_algorithm(right_orth_lq!, A; kwargs...) :
402411
select_algorithm(right_orth_svd!, A; trunc, kwargs...)
403412

413+
404414
select_algorithm(::typeof(right_orth_lq!), A, alg = nothing; kwargs...) =
405415
select_algorithm(lq_compact!, A, alg; kwargs...)
406416
select_algorithm(::typeof(right_orth_polar!), A, alg = nothing; kwargs...) =
@@ -421,7 +431,11 @@ function select_algorithm(::typeof(left_null!), A, alg::Symbol; trunc = nothing,
421431
throw(ArgumentError(lazy"unkown alg symbol $alg"))
422432
end
423433

424-
default_algorithm(::typeof(left_null!), A; trunc = nothing, kwargs...) =
434+
default_algorithm(::typeof(left_null!), A::TA; trunc = nothing, kwargs...) where {TA} =
435+
isnothing(trunc) ? select_algorithm(left_null_qr!, A; kwargs...) :
436+
select_algorithm(left_null_svd!, A; trunc, kwargs...)
437+
# disambiguate
438+
default_algorithm(::typeof(left_null!), ::Type{A}; trunc = nothing, kwargs...) where {A} =
425439
isnothing(trunc) ? select_algorithm(left_null_qr!, A; kwargs...) :
426440
select_algorithm(left_null_svd!, A; trunc, kwargs...)
427441

@@ -450,7 +464,10 @@ function select_algorithm(::typeof(right_null!), A, alg::Symbol; trunc = nothing
450464
throw(ArgumentError(lazy"unkown alg symbol $alg"))
451465
end
452466

453-
default_algorithm(::typeof(right_null!), A; trunc = nothing, kwargs...) =
467+
default_algorithm(::typeof(right_null!), A::TA; trunc = nothing, kwargs...) where {TA} =
468+
isnothing(trunc) ? select_algorithm(right_null_lq!, A; kwargs...) :
469+
select_algorithm(right_null_svd!, A; trunc, kwargs...)
470+
default_algorithm(::typeof(right_null!), ::Type{A}; trunc = nothing, kwargs...) where {A} =
454471
isnothing(trunc) ? select_algorithm(right_null_lq!, A; kwargs...) :
455472
select_algorithm(right_null_svd!, A; trunc, kwargs...)
456473

0 commit comments

Comments
 (0)