Skip to content

Commit

Permalink
Add more tests for the option warm-start
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Feb 15, 2025
1 parent 52c1619 commit 9b849f1
Show file tree
Hide file tree
Showing 64 changed files with 531 additions and 317 deletions.
4 changes: 3 additions & 1 deletion src/bicgstab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand All @@ -189,6 +190,7 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose,
stats.solved, stats.inconsistent = false, false
stats.timer = start_time |> ktimer
stats.status = "Breakdown bᴴc = 0"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
4 changes: 3 additions & 1 deletion src/bilq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time
stats.solved = true
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand All @@ -181,6 +182,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "Breakdown bᴴc = 0"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
2 changes: 2 additions & 0 deletions src/bilqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ kwargs_bilqr = (:transfer_to_bicg, :atol, :rtol, :itmax, :timemax, :verbose, :hi
stats.solved_dual = false
stats.timer = start_time |> ktimer
stats.status = "Breakdown bᴴc = 0"
warm_start && kaxpy!(n, one(FC), Δx, x)
warm_start && kaxpy!(n, one(FC), Δy, t)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/car.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ kwargs_car = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :history, :ca
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/cg_lanczos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ kwargs_cg_lanczos = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax
stats.Anorm = zero(T)
stats.indefinite = false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
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 @@ -149,7 +149,7 @@ kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :t
stats.niter = 0
stats.solved = true
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end

Expand Down
2 changes: 1 addition & 1 deletion src/cgls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(rNorms, zero(T))
history && push!(ArNorms, zero(T))
return solver
Expand Down
2 changes: 1 addition & 1 deletion src/cgls_lanczos_shift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose
stats.niter = 0
stats.solved = true
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end

Expand Down
2 changes: 1 addition & 1 deletion src/cgne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ kwargs_cgne = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end
λ > 0 && kcopy!(m, s, r) # s ← r
Expand Down
4 changes: 3 additions & 1 deletion src/cgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand All @@ -178,6 +179,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist
stats.solved, stats.inconsistent = false, false
stats.timer = start_time |> ktimer
stats.status = "Breakdown bᴴc = 0"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start =false
return solver
end
Expand Down
3 changes: 3 additions & 0 deletions src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema
stats.timer = start_time |> ktimer
stats.status = "x is a zero-residual solution"
history && push!(ArNorms, zero(T))
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down Expand Up @@ -219,6 +220,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema
stats.timer = start_time |> ktimer
stats.status = "nonpositive curvature"
iter == 0 && kcopy!(n, x, b) # x ← b
solver.warm_start = false
return solver
end
elseif pAp 0 && radius == 0
Expand Down Expand Up @@ -384,6 +386,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "solver encountered numerical issues"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
2 changes: 1 addition & 1 deletion src/craig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :btol, :conlim, :at
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end
β₁² = β₁^2
Expand Down
4 changes: 2 additions & 2 deletions src/craigmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver
history && push!(rNorms, β)
history && push!(ArNorms, zero(T))
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end

Expand Down Expand Up @@ -226,7 +226,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver
history && push!(rNorms, β)
history && push!(ArNorms, zero(T))
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a minimum least-squares solution"
stats.status = "x is a minimum least-squares solution"
return solver
end
kscal!(n, one(FC)/α, v)
Expand Down
2 changes: 1 addition & 1 deletion src/crls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(ArNorms, zero(T))
return solver
end
Expand Down
2 changes: 1 addition & 1 deletion src/crmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ kwargs_crmr = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(ArNorms, zero(T))
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/diom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ kwargs_diom = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :timem
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/dqgmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ kwargs_dqgmres = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :ti
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/fgmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/fom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
2 changes: 1 addition & 1 deletion src/lnlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, :λ, :σ, :utolx, :utoly
stats.error_with_bnd = false
history && push!(rNorms, bNorm)
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end

Expand Down
4 changes: 2 additions & 2 deletions src/lslq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, :
history && push!(rNorms, zero(T))
history && push!(ArNorms, zero(T))
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
return solver
end
β = β₁
Expand All @@ -256,7 +256,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, :
history && push!(rNorms, β₁)
history && push!(ArNorms, zero(T))
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a minimum least-squares solution"
stats.status = "x is a minimum least-squares solution"
return solver
end
kscal!(n, one(FC)/α, v)
Expand Down
4 changes: 2 additions & 2 deletions src/lsmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(rNorms, zero(T))
history && push!(ArNorms, zero(T))
return solver
Expand Down Expand Up @@ -268,7 +268,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a minimum least-squares solution"
stats.status = "x is a minimum least-squares solution"
return solver
end
kscal!(n, one(FC)/α, v)
Expand Down
4 changes: 2 additions & 2 deletions src/lsqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(rNorms, zero(T))
history && push!(ArNorms, zero(T))
return solver
Expand Down Expand Up @@ -250,7 +250,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a minimum least-squares solution"
stats.status = "x is a minimum least-squares solution"
return solver
end
kscal!(n, one(FC)/α, v)
Expand Down
3 changes: 2 additions & 1 deletion src/minares.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ kwargs_minares = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :verbo
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
4 changes: 3 additions & 1 deletion src/minres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax,
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
history && push!(rNorms, β₁)
history && push!(ArNorms, zero(T))
history && push!(Aconds, zero(T))
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down Expand Up @@ -330,6 +331,7 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax,
stats.solved, stats.inconsistent = true, true
stats.timer = start_time |> ktimer
stats.status = "x is a minimum least-squares solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/minres_qlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ kwargs_minres_qlp = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :ve
stats.niter = 0
stats.solved, stats.inconsistent = true, false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
4 changes: 3 additions & 1 deletion src/qmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist
stats.solved = true
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand All @@ -187,6 +188,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "Breakdown bᴴc = 0"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/symmlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ kwargs_symmlq = (:M, :ldiv, :transfer_to_cg, :λ, :λest, :atol, :rtol, :etol, :
history && push!(rNorms, zero(T))
history && push!(rcgNorms, zero(T))
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/usymlq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ kwargs_usymlq = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose,
stats.solved = true
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
3 changes: 2 additions & 1 deletion src/usymqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ kwargs_usymqr = (:atol, :rtol, :itmax, :timemax, :verbose, :history, :callback,
stats.solved = true
stats.inconsistent = false
stats.timer = start_time |> ktimer
stats.status = "x = 0 is a zero-residual solution"
stats.status = "x is a zero-residual solution"
warm_start && kaxpy!(n, one(FC), Δx, x)
solver.warm_start = false
return solver
end
Expand Down
Loading

0 comments on commit 9b849f1

Please sign in to comment.