Skip to content

Commit

Permalink
Improve type inference of extract_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Oct 13, 2024
1 parent 5b1e4ff commit cb0d23f
Show file tree
Hide file tree
Showing 37 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/bicgstab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def_kwargs_bicgstab = (:(; c::AbstractVector{FC} = b ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_bicgstab = mapreduce(extract_parameters, vcat, def_kwargs_bicgstab)
def_kwargs_bicgstab = extract_parameters.(def_kwargs_bicgstab)

args_bicgstab = (:A, :b)
optargs_bicgstab = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/bilq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def_kwargs_bilq = (:(; c::AbstractVector{FC} = b ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_bilq = mapreduce(extract_parameters, vcat, def_kwargs_bilq)
def_kwargs_bilq = extract_parameters.(def_kwargs_bilq)

args_bilq = (:A, :b)
optargs_bilq = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/bilqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def_kwargs_bilqr = (:(; transfer_to_bicg::Bool = true),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_bilqr = mapreduce(extract_parameters, vcat, def_kwargs_bilqr)
def_kwargs_bilqr = extract_parameters.(def_kwargs_bilqr)

args_bilqr = (:A, :b, :c)
optargs_bilqr = (:x0, :y0)
Expand Down
2 changes: 1 addition & 1 deletion src/block_gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def_kwargs_block_gmres = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_block_gmres = mapreduce(extract_parameters, vcat, def_kwargs_block_gmres)
def_kwargs_block_gmres = extract_parameters.(def_kwargs_block_gmres)

args_block_gmres = (:A, :B)
optargs_block_gmres = (:X0,)
Expand Down
2 changes: 1 addition & 1 deletion src/car.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def_kwargs_car = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_car = mapreduce(extract_parameters, vcat, def_kwargs_car)
def_kwargs_car = extract_parameters.(def_kwargs_car)

args_car = (:A, :b)
optargs_car = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def_kwargs_cg = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_cg = mapreduce(extract_parameters, vcat, def_kwargs_cg)
def_kwargs_cg = extract_parameters.(def_kwargs_cg)

args_cg = (:A, :b)
optargs_cg = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/cg_lanczos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def_kwargs_cg_lanczos = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_cg_lanczos = mapreduce(extract_parameters, vcat, def_kwargs_cg_lanczos)
def_kwargs_cg_lanczos = extract_parameters.(def_kwargs_cg_lanczos)

args_cg_lanczos = (:A, :b)
optargs_cg_lanczos = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/cg_lanczos_shift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def_kwargs_cg_lanczos_shift = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_cg_lanczos_shift = mapreduce(extract_parameters, vcat, def_kwargs_cg_lanczos_shift)
def_kwargs_cg_lanczos_shift = extract_parameters.(def_kwargs_cg_lanczos_shift)

args_cg_lanczos_shift = (:A, :b, :shifts)
kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/cgls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def_kwargs_cgls = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_cgls = mapreduce(extract_parameters, vcat, def_kwargs_cgls)
def_kwargs_cgls = extract_parameters.(def_kwargs_cgls)

args_cgls = (:A, :b)
kwargs_cgls = (:M, :ldiv, :radius, , :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/cgne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def_kwargs_cgne = (:(; N = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_cgne = mapreduce(extract_parameters, vcat, def_kwargs_cgne)
def_kwargs_cgne = extract_parameters.(def_kwargs_cgne)

args_cgne = (:A, :b)
kwargs_cgne = (:N, :ldiv, , :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/cgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def_kwargs_cgs = (:(; c::AbstractVector{FC} = b ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_cgs = mapreduce(extract_parameters, vcat, def_kwargs_cgs)
def_kwargs_cgs = extract_parameters.(def_kwargs_cgs)

args_cgs = (:A, :b)
optargs_cgs = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def_kwargs_cr = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_cr = mapreduce(extract_parameters, vcat, def_kwargs_cr)
def_kwargs_cr = extract_parameters.(def_kwargs_cr)

args_cr = (:A, :b)
optargs_cr = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/craig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def_kwargs_craig = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_craig = mapreduce(extract_parameters, vcat, def_kwargs_craig)
def_kwargs_craig = extract_parameters.(def_kwargs_craig)

args_craig = (:A, :b)
kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, , :btol, :conlim, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/craigmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def_kwargs_craigmr = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_craigmr = mapreduce(extract_parameters, vcat, def_kwargs_craigmr)
def_kwargs_craigmr = extract_parameters.(def_kwargs_craigmr)

args_craigmr = (:A, :b)
kwargs_craigmr = (:M, :N, :ldiv, :sqd, , :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/crls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def_kwargs_crls = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_crls = mapreduce(extract_parameters, vcat, def_kwargs_crls)
def_kwargs_crls = extract_parameters.(def_kwargs_crls)

args_crls = (:A, :b)
kwargs_crls = (:M, :ldiv, :radius, , :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/crmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def_kwargs_crmr = (:(; N = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_crmr = mapreduce(extract_parameters, vcat, def_kwargs_crmr)
def_kwargs_crmr = extract_parameters.(def_kwargs_crmr)

args_crmr = (:A, :b)
kwargs_crmr = (:N, :ldiv, , :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/diom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def_kwargs_diom = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_diom = mapreduce(extract_parameters, vcat, def_kwargs_diom)
def_kwargs_diom = extract_parameters.(def_kwargs_diom)

args_diom = (:A, :b)
optargs_diom = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/dqgmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def_kwargs_dqgmres = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_dqgmres = mapreduce(extract_parameters, vcat, def_kwargs_dqgmres)
def_kwargs_dqgmres = extract_parameters.(def_kwargs_dqgmres)

args_dqgmres = (:A, :b)
optargs_dqgmres = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/fgmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def_kwargs_fgmres = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_fgmres = mapreduce(extract_parameters, vcat, def_kwargs_fgmres)
def_kwargs_fgmres = extract_parameters.(def_kwargs_fgmres)

args_fgmres = (:A, :b)
optargs_fgmres = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/fom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def_kwargs_fom = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_fom = mapreduce(extract_parameters, vcat, def_kwargs_fom)
def_kwargs_fom = extract_parameters.(def_kwargs_fom)

args_fom = (:A, :b)
optargs_fom = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def_kwargs_gmres = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_gmres = mapreduce(extract_parameters, vcat, def_kwargs_gmres)
def_kwargs_gmres = extract_parameters.(def_kwargs_gmres)

args_gmres = (:A, :b)
optargs_gmres = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/gpmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def_kwargs_gpmr = (:(; C = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_gpmr = mapreduce(extract_parameters, vcat, def_kwargs_gpmr)
def_kwargs_gpmr = extract_parameters.(def_kwargs_gpmr)

args_gpmr = (:A, :B, :b, :c)
optargs_gpmr = (:x0, :y0)
Expand Down
4 changes: 2 additions & 2 deletions src/krylov_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,6 @@ Implementation suggested by Mitchell J. O'Sullivan (@mosullivan93).
function extract_parameters(ex::Expr)
Meta.isexpr(ex, :tuple, 1) &&
Meta.isexpr((@inbounds p = ex.args[1]), :parameters) &&
all(Base.Docs.validcall, p.args) || throw(ArgumentError("Given expression is not a kw parameter tuple [e.g. :(; x)]: $ex"))
return p.args
Base.Docs.validcall(p.args[]) || throw(ArgumentError("Given expression is not a kw parameter tuple [e.g. :(; x)]: $ex"))
return p.args[]
end
2 changes: 1 addition & 1 deletion src/lnlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def_kwargs_lnlq = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_lnlq = mapreduce(extract_parameters, vcat, def_kwargs_lnlq)
def_kwargs_lnlq = extract_parameters.(def_kwargs_lnlq)

args_lnlq = (:A, :b)
kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, , , :utolx, :utoly, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/lslq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def_kwargs_lslq = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_lslq = mapreduce(extract_parameters, vcat, def_kwargs_lslq)
def_kwargs_lslq = extract_parameters.(def_kwargs_lslq)

args_lslq = (:A, :b)
kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, , , :etol, :utol, :btol, :conlim, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/lsmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def_kwargs_lsmr = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_lsmr = mapreduce(extract_parameters, vcat, def_kwargs_lsmr)
def_kwargs_lsmr = extract_parameters.(def_kwargs_lsmr)

args_lsmr = (:A, :b)
kwargs_lsmr = (:M, :N, :ldiv, :sqd, , :radius, :etol, :axtol, :btol, :conlim, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/lsqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def_kwargs_lsqr = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_lsqr = mapreduce(extract_parameters, vcat, def_kwargs_lsqr)
def_kwargs_lsqr = extract_parameters.(def_kwargs_lsqr)

args_lsqr = (:A, :b)
kwargs_lsqr = (:M, :N, :ldiv, :sqd, , :radius, :etol, :axtol, :btol, :conlim, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand Down
2 changes: 1 addition & 1 deletion src/minares.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def_kwargs_minares = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_minares = mapreduce(extract_parameters, vcat, def_kwargs_minares)
def_kwargs_minares = extract_parameters.(def_kwargs_minares)

args_minares = (:A, :b)
optargs_minares = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/minres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def_kwargs_minres = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_minres = mapreduce(extract_parameters, vcat, def_kwargs_minres)
def_kwargs_minres = extract_parameters.(def_kwargs_minres)

args_minres = (:A, :b)
optargs_minres = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/minres_qlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def_kwargs_minres_qlp = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_minres_qlp = mapreduce(extract_parameters, vcat, def_kwargs_minres_qlp)
def_kwargs_minres_qlp = extract_parameters.(def_kwargs_minres_qlp)

args_minres_qlp = (:A, :b)
optargs_minres_qlp = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/qmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def_kwargs_qmr = (:(; c::AbstractVector{FC} = b ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_qmr = mapreduce(extract_parameters, vcat, def_kwargs_qmr)
def_kwargs_qmr = extract_parameters.(def_kwargs_qmr)

args_qmr = (:A, :b)
optargs_qmr = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/symmlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def_kwargs_symmlq = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_symmlq = mapreduce(extract_parameters, vcat, def_kwargs_symmlq)
def_kwargs_symmlq = extract_parameters.(def_kwargs_symmlq)

args_symmlq = (:A, :b)
optargs_symmlq = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/tricg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def_kwargs_tricg = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_tricg = mapreduce(extract_parameters, vcat, def_kwargs_tricg)
def_kwargs_tricg = extract_parameters.(def_kwargs_tricg)

args_tricg = (:A, :b, :c)
optargs_tricg = (:x0, :y0)
Expand Down
2 changes: 1 addition & 1 deletion src/trilqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def_kwargs_trilqr = (:(; transfer_to_usymcg::Bool = true),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_trilqr = mapreduce(extract_parameters, vcat, def_kwargs_trilqr)
def_kwargs_trilqr = extract_parameters.(def_kwargs_trilqr)

args_trilqr = (:A, :b, :c)
optargs_trilqr = (:x0, :y0)
Expand Down
2 changes: 1 addition & 1 deletion src/trimr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def_kwargs_trimr = (:(; M = I ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_trimr = mapreduce(extract_parameters, vcat, def_kwargs_trimr)
def_kwargs_trimr = extract_parameters.(def_kwargs_trimr)

args_trimr = (:A, :b, :c)
optargs_trimr = (:x0, :y0)
Expand Down
2 changes: 1 addition & 1 deletion src/usymlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def_kwargs_usymlq = (:(; transfer_to_usymcg::Bool = true),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_usymlq = mapreduce(extract_parameters, vcat, def_kwargs_usymlq)
def_kwargs_usymlq = extract_parameters.(def_kwargs_usymlq)

args_usymlq = (:A, :b, :c)
optargs_usymlq = (:x0,)
Expand Down
2 changes: 1 addition & 1 deletion src/usymqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def_kwargs_usymqr = (:(; atol::T = √eps(T) ),
:(; callback = solver -> false),
:(; iostream::IO = kstdout ))

def_kwargs_usymqr = mapreduce(extract_parameters, vcat, def_kwargs_usymqr)
def_kwargs_usymqr = extract_parameters.(def_kwargs_usymqr)

args_usymqr = (:A, :b, :c)
optargs_usymqr = (:x0,)
Expand Down

0 comments on commit cb0d23f

Please sign in to comment.