Skip to content

Commit

Permalink
Update krylov_solve.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 7, 2023
1 parent c67cf69 commit 510a66b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/krylov_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ for (KS, fun, args, def_args, optargs, def_optargs, kwargs, def_kwargs) in [
(:GpmrSolver , :gpmr! , args_gpmr , def_args_gpmr , optargs_gpmr , def_optargs_gpmr , kwargs_gpmr , def_kwargs_gpmr )
]
@eval begin
solve!(solver :: $KS{T,FC,S}, $(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}} = $(fun)(solver, $(args...); $(kwargs...))

if !isempty($optargs)
function $(fun)(solver :: $KS{T,FC,S}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}}
start_time = time_ns()
Expand All @@ -54,7 +56,6 @@ for (KS, fun, args, def_args, optargs, def_optargs, kwargs, def_kwargs) in [
return solver
end

solve!(solver :: $KS{T,FC,S}, $(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}} = $(fun)(solver, $(args...); $(kwargs...))
solve!(solver :: $KS{T,FC,S}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}} = $(fun)(solver, $(args...), $(optargs...); $(kwargs...))
end
end
Expand All @@ -64,6 +65,8 @@ for (KS, fun, args, def_args, optargs, def_optargs, kwargs, def_kwargs) in [
(:BlockGmresSolver, :block_gmres!, args_block_gmres, def_args_block_gmres, optargs_block_gmres, def_optargs_block_gmres, kwargs_block_gmres, def_kwargs_block_gmres),
]
@eval begin
solve!(solver :: $KS{T,FC,SV,SM}, $(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, SV <: AbstractVector{FC}, SM <: AbstractMatrix{FC}} = $(fun)(solver, $(args...); $(kwargs...))

if !isempty($optargs)
function $(fun)(solver :: $KS{T,FC,SV,SM}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, SV <: AbstractVector{FC}, SM <: AbstractMatrix{FC}}
start_time = time_ns()
Expand All @@ -74,9 +77,8 @@ for (KS, fun, args, def_args, optargs, def_optargs, kwargs, def_kwargs) in [
solver.stats.timer += elapsed_time
return solver
end
end

solve!(solver :: $KS{T,FC,SV,SM}, $(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, SV <: AbstractVector{FC}, SM <: AbstractMatrix{FC}} = $(fun)(solver, $(args...); $(kwargs...))
solve!(solver :: $KS{T,FC,SV,SM}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, SV <: AbstractVector{FC}, SM <: AbstractMatrix{FC}} = $(fun)(solver, $(args...), $(optargs...); $(kwargs...))
solve!(solver :: $KS{T,FC,SV,SM}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, SV <: AbstractVector{FC}, SM <: AbstractMatrix{FC}} = $(fun)(solver, $(args...), $(optargs...); $(kwargs...))
end
end
end

0 comments on commit 510a66b

Please sign in to comment.