From e3624c4a7b6e2dfe0f40d03e94feb7c173a49ab4 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Thu, 31 Oct 2024 14:36:35 -0500 Subject: [PATCH] Use the infix operator to compute the timer --- src/bicgstab.jl | 10 +++++----- src/bilq.jl | 10 +++++----- src/bilqr.jl | 12 ++++++------ src/block_gmres.jl | 6 +++--- src/car.jl | 10 +++++----- src/cg.jl | 6 +++--- src/cg_lanczos.jl | 8 ++++---- src/cg_lanczos_shift.jl | 8 ++++---- src/cgls.jl | 8 ++++---- src/cgls_lanczos_shift.jl | 8 ++++---- src/cgne.jl | 8 ++++---- src/cgs.jl | 10 +++++----- src/cr.jl | 12 ++++++------ src/craig.jl | 8 ++++---- src/craigmr.jl | 10 +++++----- src/crls.jl | 8 ++++---- src/crmr.jl | 8 ++++---- src/diom.jl | 8 ++++---- src/dqgmres.jl | 8 ++++---- src/fgmres.jl | 8 ++++---- src/fom.jl | 8 ++++---- src/gmres.jl | 8 ++++---- src/gpmr.jl | 6 +++--- src/krylov_solve.jl | 22 +++++++++++----------- src/lnlq.jl | 8 ++++---- src/lslq.jl | 10 +++++----- src/lsmr.jl | 10 +++++----- src/lsqr.jl | 10 +++++----- src/minares.jl | 8 ++++---- src/minres.jl | 10 +++++----- src/minres_qlp.jl | 8 ++++---- src/qmr.jl | 10 +++++----- src/symmlq.jl | 8 ++++---- src/tricg.jl | 6 +++--- src/trilqr.jl | 10 +++++----- src/trimr.jl | 6 +++--- src/usymlq.jl | 8 ++++---- src/usymqr.jl | 8 ++++---- 38 files changed, 169 insertions(+), 169 deletions(-) diff --git a/src/bicgstab.jl b/src/bicgstab.jl index b4438edfe..bf07c5174 100644 --- a/src/bicgstab.jl +++ b/src/bicgstab.jl @@ -170,7 +170,7 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -181,13 +181,13 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %8s %8s %5s\n", "k", "‖rₖ‖", "|αₖ|", "|ωₖ|", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %8.1e %.2fs\n", iter, rNorm, abs(α), abs(ω), ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %8.1e %.2fs\n", iter, rNorm, abs(α), abs(ω), start_time |> ktimer) next_ρ = kdot(n, c, r) # ρ₁ = ⟨r̅₀,r₀⟩ if next_ρ == 0 stats.niter = 0 stats.solved, stats.inconsistent = false, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "Breakdown bᴴc = 0" solver.warm_start = false return solver @@ -241,7 +241,7 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, breakdown = (α == 0 || isnan(α)) timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %8.1e %.2fs\n", iter, rNorm, abs(α), abs(ω), ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %8.1e %.2fs\n", iter, rNorm, abs(α), abs(ω), start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -260,7 +260,7 @@ kwargs_bicgstab = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/bilq.jl b/src/bilq.jl index c359bddf5..5fb8f1a04 100644 --- a/src/bilq.jl +++ b/src/bilq.jl @@ -164,7 +164,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time stats.niter = 0 stats.solved = true stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -179,7 +179,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time stats.niter = 0 stats.solved = false stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "Breakdown bᴴc = 0" solver.warm_start = false return solver @@ -187,7 +187,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time ε = atol + rtol * bNorm (verbose > 0) && @printf(iostream, "%5s %8s %7s %5s\n", "k", "αₖ", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, cᴴb, bNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, cᴴb, bNorm, start_time |> ktimer) βₖ = √(abs(cᴴb)) # β₁γ₁ = cᴴ(b - Ax₀) γₖ = cᴴb / βₖ # β₁γ₁ = cᴴ(b - Ax₀) @@ -363,7 +363,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time breakdown = !solved_lq && !solved_cg && (pᴴq == 0) timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, αₖ, rNorm_lq, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, αₖ, rNorm_lq, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -393,7 +393,7 @@ kwargs_bilq = (:c, :transfer_to_bicg, :M, :N, :ldiv, :atol, :rtol, :itmax, :time stats.niter = iter stats.solved = solved_lq || solved_cg stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/bilqr.jl b/src/bilqr.jl index c4384aae4..29b27934c 100644 --- a/src/bilqr.jl +++ b/src/bilqr.jl @@ -158,7 +158,7 @@ kwargs_bilqr = (:transfer_to_bicg, :atol, :rtol, :itmax, :timemax, :verbose, :hi εL = atol + rtol * bNorm εQ = atol + rtol * cNorm (verbose > 0) && @printf(iostream, "%5s %7s %7s %5s\n", "k", "‖rₖ‖", "‖sₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, bNorm, cNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, bNorm, cNorm, start_time |> ktimer) # Initialize the Lanczos biorthogonalization process. cᴴb = kdot(n, s₀, r₀) # ⟨s₀,r₀⟩ = ⟨c - Aᴴy₀,b - Ax₀⟩ @@ -166,7 +166,7 @@ kwargs_bilqr = (:transfer_to_bicg, :atol, :rtol, :itmax, :timemax, :verbose, :hi stats.niter = 0 stats.solved_primal = false stats.solved_dual = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "Breakdown bᴴc = 0" solver.warm_start = false return solver @@ -427,9 +427,9 @@ kwargs_bilqr = (:transfer_to_bicg, :atol, :rtol, :itmax, :timemax, :verbose, :hi timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && solved_primal && !solved_dual && @printf(iostream, "%5d %7s %7.1e %.2fs\n", iter, "✗ ✗ ✗ ✗", sNorm, ktimer(start_time)) - kdisplay(iter, verbose) && !solved_primal && solved_dual && @printf(iostream, "%5d %7.1e %7s %.2fs\n", iter, rNorm_lq, "✗ ✗ ✗ ✗", ktimer(start_time)) - kdisplay(iter, verbose) && !solved_primal && !solved_dual && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, rNorm_lq, sNorm, ktimer(start_time)) + kdisplay(iter, verbose) && solved_primal && !solved_dual && @printf(iostream, "%5d %7s %7.1e %.2fs\n", iter, "✗ ✗ ✗ ✗", sNorm, start_time |> ktimer) + kdisplay(iter, verbose) && !solved_primal && solved_dual && @printf(iostream, "%5d %7.1e %7s %.2fs\n", iter, rNorm_lq, "✗ ✗ ✗ ✗", start_time |> ktimer) + kdisplay(iter, verbose) && !solved_primal && !solved_dual && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, rNorm_lq, sNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -468,7 +468,7 @@ kwargs_bilqr = (:transfer_to_bicg, :atol, :rtol, :itmax, :timemax, :verbose, :hi stats.niter = iter stats.solved_primal = solved_primal stats.solved_dual = solved_dual - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/block_gmres.jl b/src/block_gmres.jl index 997311954..376193114 100644 --- a/src/block_gmres.jl +++ b/src/block_gmres.jl @@ -162,7 +162,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto inner_itmax = itmax (verbose > 0) && @printf(iostream, "%5s %5s %7s %5s\n", "pass", "k", "‖Rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %.2fs\n", npass, iter, RNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %.2fs\n", npass, iter, RNorm, start_time |> ktimer) # Stopping criterion solved = RNorm ≤ ε @@ -287,7 +287,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto inner_tired = restart ? inner_iter ≥ min(mem, inner_itmax) : inner_iter ≥ inner_itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %.2fs\n", npass, iter+inner_iter, RNorm, ktimer(start_time)) + kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %.2fs\n", npass, iter+inner_iter, RNorm, start_time |> ktimer) # Compute Vₖ₊₁. if !(solved || inner_tired || user_requested_exit || overtimed) @@ -343,7 +343,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto # Update stats stats.niter = iter stats.solved = solved - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/car.jl b/src/car.jl index 790d4f61a..ee6f9a695 100644 --- a/src/car.jl +++ b/src/car.jl @@ -164,7 +164,7 @@ kwargs_car = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :history, :ca if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -175,7 +175,7 @@ kwargs_car = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :history, :ca ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %5s\n", "k", "‖rₖ‖", "‖Arₖ‖", "α", "β", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7s %7s %.2fs\n", iter, rNorm, ArNorm, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7s %7s %.2fs\n", iter, rNorm, ArNorm, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", start_time |> ktimer) solved = rNorm ≤ ε tired = iter ≥ itmax @@ -220,8 +220,8 @@ kwargs_car = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :history, :ca user_requested_exit = callback(solver) :: Bool timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && !solved && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, α, β, ktimer(start_time)) - kdisplay(iter, verbose) && solved && @printf(iostream, "%5d %7.1e %7s %7.1e %7s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", α, "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && !solved && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, α, β, start_time |> ktimer) + kdisplay(iter, verbose) && solved && @printf(iostream, "%5d %7.1e %7s %7.1e %7s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", α, "✗ ✗ ✗ ✗", start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -239,7 +239,7 @@ kwargs_car = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :history, :ca stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cg.jl b/src/cg.jl index 401d36e79..3cb8a60d9 100644 --- a/src/cg.jl +++ b/src/cg.jl @@ -148,7 +148,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v if γ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -199,7 +199,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v σ = maximum(to_boundary(n, x, p, z, radius, M=M, ldiv=!ldiv)) end - kdisplay(iter, verbose) && @printf(iostream, " %8.1e %8.1e %8.1e %.2fs\n", pAp, α, σ, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, " %8.1e %8.1e %8.1e %.2fs\n", pAp, α, σ, start_time |> ktimer) # Move along p from x to the boundary if either # the next step leads outside the trust region or @@ -257,7 +257,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cg_lanczos.jl b/src/cg_lanczos.jl index 47247274c..466d06f0a 100644 --- a/src/cg_lanczos.jl +++ b/src/cg_lanczos.jl @@ -147,7 +147,7 @@ kwargs_cg_lanczos = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax stats.solved = true stats.Anorm = zero(T) stats.indefinite = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -172,7 +172,7 @@ kwargs_cg_lanczos = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax # Define stopping tolerance. ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) indefinite = false solved = rNorm ≤ ε @@ -216,7 +216,7 @@ kwargs_cg_lanczos = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax rNorm = abs(σ) # ‖rₖ₊₁‖_M = |σₖ₊₁| because rₖ₊₁ = σₖ₊₁ * vₖ₊₁ and ‖vₖ₊₁‖_M = 1 history && push!(rNorms, rNorm) iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) # Stopping conditions that do not depend on user input. # This is to guard against tolerances that are unreasonably small. @@ -247,7 +247,7 @@ kwargs_cg_lanczos = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax stats.solved = solved stats.Anorm = sqrt(Anorm2) stats.indefinite = indefinite - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cg_lanczos_shift.jl b/src/cg_lanczos_shift.jl index 02997f9b4..ba48ef30f 100644 --- a/src/cg_lanczos_shift.jl +++ b/src/cg_lanczos_shift.jl @@ -148,7 +148,7 @@ kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :t if β == 0 stats.niter = 0 stats.solved = true - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -184,7 +184,7 @@ kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :t # Build format strings for printing. (verbose > 0) && (fmt = Printf.Format("%5d" * repeat(" %8.1e", nshifts) * " %.2fs\n")) - kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., ktimer(start_time)) + kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., start_time |> ktimer) solved = !reduce(|, not_cv) tired = iter ≥ itmax @@ -248,7 +248,7 @@ kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :t not_cv[i] = check_curvature ? !(converged[i] || indefinite[i]) : !converged[i] end iter = iter + 1 - kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., ktimer(start_time)) + kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., start_time |> ktimer) user_requested_exit = callback(solver) :: Bool solved = !reduce(|, not_cv) @@ -267,7 +267,7 @@ kwargs_cg_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :t # Update stats. TODO: Estimate Anorm and Acond. stats.niter = iter stats.solved = solved - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cgls.jl b/src/cgls.jl index 2ee53064b..3bf862c77 100644 --- a/src/cgls.jl +++ b/src/cgls.jl @@ -152,7 +152,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose if bNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(rNorms, zero(T)) history && push!(ArNorms, zero(T)) @@ -171,7 +171,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose history && push!(ArNorms, ArNorm) ε = atol + rtol * ArNorm (verbose > 0) && @printf(iostream, "%5s %8s %8s %5s\n", "k", "‖Aᴴr‖", "‖r‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) status = "unknown" on_boundary = false @@ -208,7 +208,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose history && push!(rNorms, rNorm) history && push!(ArNorms, ArNorm) iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) user_requested_exit = callback(solver) :: Bool solved = (ArNorm ≤ ε) || on_boundary tired = iter ≥ itmax @@ -228,7 +228,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cgls_lanczos_shift.jl b/src/cgls_lanczos_shift.jl index eb07b811f..b772fde01 100644 --- a/src/cgls_lanczos_shift.jl +++ b/src/cgls_lanczos_shift.jl @@ -151,7 +151,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose if β == 0 stats.niter = 0 stats.solved = true - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -186,7 +186,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose # Build format strings for printing. (verbose > 0) && (fmt = Printf.Format("%5d" * repeat(" %8.1e", nshifts) * " %.2fs\n")) - kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., ktimer(start_time)) + kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., start_time |> ktimer) solved = !reduce(|, not_cv) # ArNorm ≤ ε tired = iter ≥ itmax @@ -242,7 +242,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose not_cv[i] = !converged[i] end iter = iter + 1 - kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., ktimer(start_time)) + kdisplay(iter, verbose) && Printf.format(iostream, fmt, iter, rNorms..., start_time |> ktimer) user_requested_exit = callback(solver) :: Bool solved = !reduce(|, not_cv) @@ -261,7 +261,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose # Update stats stats.niter = iter stats.solved = solved - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cgne.jl b/src/cgne.jl index 4b5ee8221..e37dc2c6d 100644 --- a/src/cgne.jl +++ b/src/cgne.jl @@ -159,7 +159,7 @@ kwargs_cgne = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -180,7 +180,7 @@ kwargs_cgne = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor ɛ_c = atol + rtol * rNorm # Stopping tolerance for consistent systems. ɛ_i = atol + rtol * pNorm # Stopping tolerance for inconsistent systems. (verbose > 0) && @printf(iostream, "%5s %8s %5s\n", "k", "‖r‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %.2fs\n", iter, rNorm, start_time |> ktimer) status = "unknown" solved = rNorm ≤ ɛ_c @@ -210,7 +210,7 @@ kwargs_cgne = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor rNorm = sqrt(γ_next) history && push!(rNorms, rNorm) iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %.2fs\n", iter, rNorm, start_time |> ktimer) # Stopping conditions that do not depend on user input. # This is to guard against tolerances that are unreasonably small. @@ -237,7 +237,7 @@ kwargs_cgne = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cgs.jl b/src/cgs.jl index b7ce8db86..ce9ca118d 100644 --- a/src/cgs.jl +++ b/src/cgs.jl @@ -165,7 +165,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -176,7 +176,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist if ρ == 0 stats.niter = 0 stats.solved, stats.inconsistent = false, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "Breakdown bᴴc = 0" solver.warm_start =false return solver @@ -187,7 +187,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) kcopy!(n, u, r) # u₀ kcopy!(n, p, r) # p₀ @@ -245,7 +245,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist breakdown = (α == 0 || isnan(α)) timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -264,7 +264,7 @@ kwargs_cgs = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/cr.jl b/src/cr.jl index d382635c8..0be5ca4f1 100644 --- a/src/cr.jl +++ b/src/cr.jl @@ -159,7 +159,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema if ρ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(ArNorms, zero(T)) solver.warm_start = false @@ -184,7 +184,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema history && push!(ArNorms, ArNorm) ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %8s %8s %8s %5s\n", "k", "‖x‖", "‖r‖", "quad", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %8.1e %8.1e %.2fs\n", iter, xNorm, rNorm, m, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %8.1e %8.1e %.2fs\n", iter, xNorm, rNorm, m, start_time |> ktimer) descent = pr > 0 # pᴴr > 0 means p is a descent direction solved = rNorm ≤ ε @@ -202,7 +202,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema (verbose > 0) && @printf(iostream, "nonpositive curvature detected: pᴴAp = %8.1e and rᴴAr = %8.1e\n", pAp, ρ) stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "nonpositive curvature" return solver end @@ -336,7 +336,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema iter = iter + 1 if kdisplay(iter, verbose) m = m - α * pr + α^2 * pAp / 2 - @printf(iostream, "%5d %8.1e %8.1e %8.1e %.2fs\n", iter, xNorm, rNorm, m, ktimer(start_time)) + @printf(iostream, "%5d %8.1e %8.1e %8.1e %.2fs\n", iter, xNorm, rNorm, m, start_time |> ktimer) end # Stopping conditions that do not depend on user input. @@ -367,7 +367,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "solver encountered numerical issues" solver.warm_start = false return solver @@ -397,7 +397,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/craig.jl b/src/craig.jl index 021efea92..c99bad81f 100644 --- a/src/craig.jl +++ b/src/craig.jl @@ -210,7 +210,7 @@ kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :btol, :conlim, :at if β₁ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -245,7 +245,7 @@ kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :btol, :conlim, :at ɛ_i = atol # Stopping tolerance for inconsistent systems. ctol = conlim > 0 ? 1/conlim : zero(T) # Stopping tolerance for ill-conditioned operators. (verbose > 0) && @printf(iostream, "%5s %8s %8s %8s %8s %8s %7s %5s\n", "k", "‖r‖", "‖x‖", "‖A‖", "κ(A)", "α", "β", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %8.2e %8.2e %8s %7s %.2fs\n", iter, rNorm, xNorm, Anorm, Acond, " ✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %8.2e %8.2e %8s %7s %.2fs\n", iter, rNorm, xNorm, Anorm, Acond, " ✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", start_time |> ktimer) bkwerr = one(T) # initial value of the backward error ‖r‖ / √(‖b‖² + ‖A‖² ‖x‖²) @@ -350,7 +350,7 @@ kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :btol, :conlim, :at ρ_prev = ρ # Only differs from α if λ > 0. - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %8.2e %8.2e %8.1e %7.1e %.2fs\n", iter, rNorm, xNorm, Anorm, Acond, α, β, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %8.2e %8.2e %8.1e %7.1e %.2fs\n", iter, rNorm, xNorm, Anorm, Acond, α, β, start_time |> ktimer) solved_lim = bkwerr ≤ btol solved_mach = one(T) + bkwerr ≤ one(T) @@ -390,7 +390,7 @@ kwargs_craig = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :btol, :conlim, :at stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/craigmr.jl b/src/craigmr.jl index 933ec861f..7fc5a42d0 100644 --- a/src/craigmr.jl +++ b/src/craigmr.jl @@ -197,7 +197,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver stats.solved, stats.inconsistent = true, false history && push!(rNorms, β) history && push!(ArNorms, zero(T)) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -217,7 +217,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver itmax == 0 && (itmax = m + n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %8s %8s %7s %5s\n", "k", "‖r‖", "‖Aᴴr‖", "β", "α", "cos", "sin", "‖A‖²", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, β, α, β, α, 0, 1, Anorm², ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, β, α, β, α, 0, 1, Anorm², start_time |> ktimer) # Aᴴb = 0 so x = 0 is a minimum least-squares solution if α == 0 @@ -225,7 +225,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver stats.solved, stats.inconsistent = true, false history && push!(rNorms, β) history && push!(ArNorms, zero(T)) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a minimum least-squares solution" return solver end @@ -344,7 +344,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver ArNorm = α * β * abs(ζ/ρ) history && push!(ArNorms, ArNorm) - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², start_time |> ktimer) if λ > 0 (cdₖ, sdₖ, λₖ₊₁) = sym_givens(λ, λₐᵤₓ) @@ -382,7 +382,7 @@ kwargs_craigmr = (:M, :N, :ldiv, :sqd, :λ, :atol, :rtol, :itmax, :timemax, :ver stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/crls.jl b/src/crls.jl index 89cd749f6..5239a5cf6 100644 --- a/src/crls.jl +++ b/src/crls.jl @@ -147,7 +147,7 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose if bNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(ArNorms, zero(T)) return solver @@ -171,7 +171,7 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose history && push!(ArNorms, ArNorm) ε = atol + rtol * ArNorm (verbose > 0) && @printf(iostream, "%5s %8s %8s %5s\n", "k", "‖Aᴴr‖", "‖r‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) status = "unknown" on_boundary = false @@ -232,7 +232,7 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose history && push!(rNorms, rNorm) history && push!(ArNorms, ArNorm) iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) user_requested_exit = callback(solver) :: Bool solved = (ArNorm ≤ ε) || on_boundary tired = iter ≥ itmax @@ -253,7 +253,7 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/crmr.jl b/src/crmr.jl index b0aac785b..f4b797d20 100644 --- a/src/crmr.jl +++ b/src/crmr.jl @@ -158,7 +158,7 @@ kwargs_crmr = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor if bNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(ArNorms, zero(T)) return solver @@ -176,7 +176,7 @@ kwargs_crmr = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor ɛ_c = atol + rtol * rNorm # Stopping tolerance for consistent systems. ɛ_i = atol + rtol * ArNorm # Stopping tolerance for inconsistent systems. (verbose > 0) && @printf(iostream, "%5s %8s %8s %5s\n", "k", "‖Aᴴr‖", "‖r‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) status = "unknown" solved = rNorm ≤ ɛ_c @@ -208,7 +208,7 @@ kwargs_crmr = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor history && push!(rNorms, rNorm) history && push!(ArNorms, ArNorm) iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.2e %8.2e %.2fs\n", iter, ArNorm, rNorm, start_time |> ktimer) user_requested_exit = callback(solver) :: Bool solved = rNorm ≤ ɛ_c inconsistent = (rNorm > 100 * ɛ_c) && (ArNorm ≤ ɛ_i) @@ -229,7 +229,7 @@ kwargs_crmr = (:N, :ldiv, :λ, :atol, :rtol, :itmax, :timemax, :verbose, :histor stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/diom.jl b/src/diom.jl index 05df11a88..0c201b0aa 100644 --- a/src/diom.jl +++ b/src/diom.jl @@ -154,7 +154,7 @@ kwargs_diom = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :timem if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -165,7 +165,7 @@ kwargs_diom = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :timem ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) mem = length(V) # Memory for i = 1 : mem @@ -293,7 +293,7 @@ kwargs_diom = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :timem tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -311,7 +311,7 @@ kwargs_diom = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :timem stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/dqgmres.jl b/src/dqgmres.jl index f6fa1d6e8..82ef8e135 100644 --- a/src/dqgmres.jl +++ b/src/dqgmres.jl @@ -154,7 +154,7 @@ kwargs_dqgmres = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :ti if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -165,7 +165,7 @@ kwargs_dqgmres = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :ti ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) # Set up workspace. mem = length(V) # Memory. @@ -295,7 +295,7 @@ kwargs_dqgmres = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :ti tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -313,7 +313,7 @@ kwargs_dqgmres = (:M, :N, :ldiv, :reorthogonalization, :atol, :rtol, :itmax, :ti stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/fgmres.jl b/src/fgmres.jl index 39749fc07..6227909d4 100644 --- a/src/fgmres.jl +++ b/src/fgmres.jl @@ -164,7 +164,7 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i if β == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -180,7 +180,7 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i inner_itmax = itmax (verbose > 0) && @printf(iostream, "%5s %5s %7s %7s %5s\n", "pass", "k", "‖rₖ‖", "hₖ₊₁.ₖ", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", start_time |> ktimer) # Tolerance for breakdown detection. btol = eps(T)^(3/4) @@ -303,7 +303,7 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i inner_tired = restart ? inner_iter ≥ min(mem, inner_itmax) : inner_iter ≥ inner_itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, ktimer(start_time)) + kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, start_time |> ktimer) # Compute vₖ₊₁ if !(solved || inner_tired || breakdown || user_requested_exit || overtimed) @@ -363,7 +363,7 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/fom.jl b/src/fom.jl index 9462f3e13..27512499d 100644 --- a/src/fom.jl +++ b/src/fom.jl @@ -159,7 +159,7 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma if β == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -175,7 +175,7 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma inner_itmax = itmax (verbose > 0) && @printf(iostream, "%5s %5s %7s %7s %5s\n", "pass", "k", "‖rₖ‖", "hₖ₊₁.ₖ", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", start_time |> ktimer) # Tolerance for breakdown detection. btol = eps(T)^(3/4) @@ -286,7 +286,7 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma inner_tired = restart ? inner_iter ≥ min(mem, inner_itmax) : inner_iter ≥ inner_itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, ktimer(start_time)) + kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, start_time |> ktimer) # Compute vₖ₊₁. if !(solved || inner_tired || breakdown || user_requested_exit || overtimed) @@ -343,7 +343,7 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma stats.niter = iter stats.solved = solved stats.inconsistent = !solved && breakdown - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/gmres.jl b/src/gmres.jl index da636b08b..2162ff8da 100644 --- a/src/gmres.jl +++ b/src/gmres.jl @@ -159,7 +159,7 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it if β == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -175,7 +175,7 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it inner_itmax = itmax (verbose > 0) && @printf(iostream, "%5s %5s %7s %7s %5s\n", "pass", "k", "‖rₖ‖", "hₖ₊₁.ₖ", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7s %.2fs\n", npass, iter, rNorm, "✗ ✗ ✗ ✗", start_time |> ktimer) # Tolerance for breakdown detection. btol = eps(T)^(3/4) @@ -296,7 +296,7 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it inner_tired = restart ? inner_iter ≥ min(mem, inner_itmax) : inner_iter ≥ inner_itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, ktimer(start_time)) + kdisplay(iter+inner_iter, verbose) && @printf(iostream, "%5d %5d %7.1e %7.1e %.2fs\n", npass, iter+inner_iter, rNorm, Hbis, start_time |> ktimer) # Compute vₖ₊₁. if !(solved || inner_tired || breakdown || user_requested_exit || overtimed) @@ -360,7 +360,7 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/gpmr.jl b/src/gpmr.jl index 770d6be6e..a362becea 100644 --- a/src/gpmr.jl +++ b/src/gpmr.jl @@ -257,7 +257,7 @@ kwargs_gpmr = (:C, :D, :E, :F, :ldiv, :gsp, :λ, :μ, :reorthogonalization, :ato zt[2] = γ (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %5s\n", "k", "‖rₖ‖", "hₖ₊₁.ₖ", "fₖ₊₁.ₖ", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7s %7s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7s %7s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", start_time |> ktimer) # Tolerance for breakdown detection. btol = eps(T)^(3/4) @@ -446,7 +446,7 @@ kwargs_gpmr = (:C, :D, :E, :F, :ldiv, :gsp, :λ, :μ, :reorthogonalization, :ato tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, Haux, Faux, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, Haux, Faux, start_time |> ktimer) # Compute vₖ₊₁ and uₖ₊₁ if !(solved || tired || breakdown || user_requested_exit || overtimed) @@ -522,7 +522,7 @@ kwargs_gpmr = (:C, :D, :E, :F, :ldiv, :gsp, :λ, :μ, :reorthogonalization, :ato stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/krylov_solve.jl b/src/krylov_solve.jl index 69f3d40ae..400bb6ebf 100644 --- a/src/krylov_solve.jl +++ b/src/krylov_solve.jl @@ -70,7 +70,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs start_time = time_ns() nshifts = length(shifts) solver = $workspace(A, b, nshifts) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -82,7 +82,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov)($(def_args...); memory::Int=20, $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}} start_time = time_ns() solver = $workspace(A, b, memory) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -94,7 +94,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs start_time = time_ns() solver = $workspace(A, b, memory) warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -107,7 +107,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov)($(def_args...); window::Int=5, $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}} start_time = time_ns() solver = $workspace(A, b; window) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -119,7 +119,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs start_time = time_ns() solver = $workspace(A, b; window) warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -132,7 +132,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov)($(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}} start_time = time_ns() solver = $workspace(A, b) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -144,7 +144,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs start_time = time_ns() solver = $workspace(A, b) warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -162,7 +162,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov!)(solver :: $workspace{T,FC,S}, $(def_args...), $(def_optargs...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}} start_time = time_ns() warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -186,7 +186,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov)($(def_args...); memory :: Int=20, $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}} start_time = time_ns() solver = $workspace(A, B, memory) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -198,7 +198,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs start_time = time_ns() solver = $workspace(A, B, memory) warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time @@ -213,7 +213,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs function $(krylov!)(solver :: $workspace{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() warm_start!(solver, $(optargs...)) - elapsed_time = ktimer(start_time) + elapsed_time = start_time |> ktimer timemax -= elapsed_time $(krylov!)(solver, $(args...); $(kwargs...)) solver.stats.timer += elapsed_time diff --git a/src/lnlq.jl b/src/lnlq.jl index 8e9f50c15..d74396097 100644 --- a/src/lnlq.jl +++ b/src/lnlq.jl @@ -207,7 +207,7 @@ kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, :λ, :σ, :utolx, :utoly stats.solved = true stats.error_with_bnd = false history && push!(rNorms, bNorm) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -219,7 +219,7 @@ kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, :λ, :σ, :utolx, :utoly itmax == 0 && (itmax = m + n) (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, bNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, bNorm, start_time |> ktimer) # Update iteration index iter = iter + 1 @@ -499,7 +499,7 @@ kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, :λ, :σ, :utolx, :utoly end timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm_lq, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm_lq, start_time |> ktimer) # Update iteration index. iter = iter + 1 @@ -543,7 +543,7 @@ kwargs_lnlq = (:M, :N, :ldiv, :transfer_to_craig, :sqd, :λ, :σ, :utolx, :utoly stats.niter = iter stats.solved = solved_lq || solved_cg stats.error_with_bnd = complex_error_bnd - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/lslq.jl b/src/lslq.jl index 3888870f7..535dc6f2c 100644 --- a/src/lslq.jl +++ b/src/lslq.jl @@ -235,7 +235,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, : stats.error_with_bnd = false history && push!(rNorms, zero(T)) history && push!(ArNorms, zero(T)) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" return solver end @@ -255,7 +255,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, : stats.error_with_bnd = false history && push!(rNorms, β₁) history && push!(ArNorms, zero(T)) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a minimum least-squares solution" return solver end @@ -306,7 +306,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, : itmax == 0 && (itmax = m + n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %8s %8s %7s %7s %7s %5s\n", "k", "‖r‖", "‖Aᴴr‖", "β", "α", "cos", "sin", "‖A‖²", "κ(A)", "‖xL‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², Acond, xlqNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², Acond, xlqNorm, start_time |> ktimer) status = "unknown" ε = atol + rtol * β₁ @@ -474,7 +474,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, : overtimed = timer > timemax_ns iter = iter + 1 - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm, Acond, xlqNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm, Acond, xlqNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -498,7 +498,7 @@ kwargs_lslq = (:M, :N, :ldiv, :transfer_to_lsqr, :sqd, :λ, :σ, :etol, :utol, : stats.solved = solved stats.inconsistent = !zero_resid stats.error_with_bnd = complex_error_bnd - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/lsmr.jl b/src/lsmr.jl index 1699f9b1e..eb9be839f 100644 --- a/src/lsmr.jl +++ b/src/lsmr.jl @@ -206,7 +206,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, if β₁ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(rNorms, zero(T)) history && push!(ArNorms, zero(T)) @@ -261,13 +261,13 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, itmax == 0 && (itmax = m + n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %8s %8s %7s %5s\n", "k", "‖r‖", "‖Aᴴr‖", "β", "α", "cos", "sin", "‖A‖²", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, β₁, α, β₁, α, 0, 1, Anorm², ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, β₁, α, β₁, α, 0, 1, Anorm², start_time |> ktimer) # Aᴴb = 0 so x = 0 is a minimum least-squares solution if α == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a minimum least-squares solution" return solver end @@ -388,7 +388,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, t1 = test1 / (one(T) + Anorm * xNorm / β₁) rNormtol = btol + axtol * Anorm * xNorm / β₁ - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, α, c, s, Anorm², start_time |> ktimer) # Stopping conditions that do not depend on user input. # This is to guard against tolerances that are unreasonably small. @@ -433,7 +433,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, stats.niter = iter stats.solved = solved stats.inconsistent = !zero_resid - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/lsqr.jl b/src/lsqr.jl index 5ef3e69e0..03e6539f8 100644 --- a/src/lsqr.jl +++ b/src/lsqr.jl @@ -203,7 +203,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, if β₁ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(rNorms, zero(T)) history && push!(ArNorms, zero(T)) @@ -236,7 +236,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, itmax == 0 && (itmax = m + n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %7s %7s %7s %7s %5s\n", "k", "α", "β", "‖r‖", "‖Aᴴr‖", "compat", "backwrd", "‖A‖", "κ(A)", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, β₁, α, β₁, α, 0, 1, Anorm, Acond, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, β₁, α, β₁, α, 0, 1, Anorm, Acond, start_time |> ktimer) rNorm = β₁ r1Norm = rNorm @@ -249,7 +249,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, if α == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a minimum least-squares solution" return solver end @@ -378,7 +378,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, t1 = test1 / (one(T) + Anorm * xNorm / β₁) rNormtol = btol + axtol * Anorm * xNorm / β₁ - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, α, β, rNorm, ArNorm, test1, test2, Anorm, Acond, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, α, β, rNorm, ArNorm, test1, test2, Anorm, Acond, start_time |> ktimer) # Stopping conditions that do not depend on user input. # This is to guard against tolerances that are unreasonably small. @@ -418,7 +418,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim, stats.niter = iter stats.solved = solved stats.inconsistent = !zero_resid - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/minares.jl b/src/minares.jl index 863489125..9a32ebef0 100644 --- a/src/minares.jl +++ b/src/minares.jl @@ -194,14 +194,14 @@ kwargs_minares = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :verbo if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver end (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %8s %5s\n", "k", "‖rₖ‖", "‖Arₖ‖", "βₖ₊₁", "ζₖ", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8s %.2fs\n", iter, rNorm, ArNorm, β₁, " ✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8s %.2fs\n", iter, rNorm, ArNorm, β₁, " ✗ ✗ ✗ ✗", start_time |> ktimer) # Tolerance for breakdown detection. btol = eps(T)^(3/4) @@ -562,7 +562,7 @@ kwargs_minares = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :verbo ζbarₖ₊₁ = ζbarₖ₊₂ end - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %.2fs\n", iter, rNorm, ArNorm, βₖ, ζₖ, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %.2fs\n", iter, rNorm, ArNorm, βₖ, ζₖ, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -580,7 +580,7 @@ kwargs_minares = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :verbo stats.niter = iter stats.solved = solved # stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/minres.jl b/src/minres.jl index 9c2ef5c37..27f7a6f2e 100644 --- a/src/minres.jl +++ b/src/minres.jl @@ -178,7 +178,7 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax, if β₁ == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" history && push!(rNorms, β₁) history && push!(ArNorms, zero(T)) @@ -221,7 +221,7 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax, itmax == 0 && (itmax = 2*n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %8s %8s %7s %7s %7s %7s %5s\n", "k", "‖r‖", "‖Aᴴr‖", "β", "cos", "sin", "‖A‖", "κ(A)", "test1", "test2", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7s %7s %.2fs\n", iter, rNorm, ArNorm, β, cs, sn, ANorm, Acond, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7s %7s %.2fs\n", iter, rNorm, ArNorm, β, cs, sn, ANorm, Acond, "✗ ✗ ✗ ✗", "✗ ✗ ✗ ✗", start_time |> ktimer) ε = atol + rtol * β₁ solved = solved_mach = solved_lim = (rNorm ≤ rtol) @@ -322,13 +322,13 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax, Acond = γmax / γmin history && push!(Aconds, Acond) - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, cs, sn, ANorm, Acond, test1, test2, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, ArNorm, β, cs, sn, ANorm, Acond, test1, test2, start_time |> ktimer) if iter == 1 && β / β₁ ≤ 10 * ϵM # Aᴴb = 0 so x = 0 is a minimum least-squares solution stats.niter = 1 stats.solved, stats.inconsistent = true, true - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x is a minimum least-squares solution" solver.warm_start = false return solver @@ -378,7 +378,7 @@ kwargs_minres = (:M, :ldiv, :λ, :atol, :rtol, :etol, :conlim, :itmax, :timemax, stats.niter = iter stats.solved = solved stats.inconsistent = !zero_resid - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/minres_qlp.jl b/src/minres_qlp.jl index 1ac47a50e..2538a1802 100644 --- a/src/minres_qlp.jl +++ b/src/minres_qlp.jl @@ -168,7 +168,7 @@ kwargs_minres_qlp = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :ve if rNorm == 0 stats.niter = 0 stats.solved, stats.inconsistent = true, false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -180,7 +180,7 @@ kwargs_minres_qlp = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :ve ε = atol + rtol * rNorm κ = zero(T) (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %7s %8s %7s %7s %8s %5s\n", "k", "‖rₖ‖", "‖Arₖ₋₁‖", "βₖ₊₁", "Rₖ.ₖ", "Lₖ.ₖ", "‖A‖", "κ(A)", "backward", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7s %7.1e %7s %8s %7.1e %7.1e %8s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", βₖ, "✗ ✗ ✗ ✗", " ✗ ✗ ✗ ✗", ANorm, Acond, " ✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7s %7.1e %7s %8s %7.1e %7.1e %8s %.2fs\n", iter, rNorm, "✗ ✗ ✗ ✗", βₖ, "✗ ✗ ✗ ✗", " ✗ ✗ ✗ ✗", ANorm, Acond, " ✗ ✗ ✗ ✗", start_time |> ktimer) # Set up workspace. kfill!(M⁻¹vₖ₋₁, zero(FC)) @@ -440,7 +440,7 @@ kwargs_minres_qlp = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :ve μbarₖ₋₁ = μbarₖ ζbarₖ = ζbarₖ₊₁ βₖ = βₖ₊₁ - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %7.1e %7.1e %8.1e %.2fs\n", iter, rNorm, ArNorm, βₖ₊₁, λₖ, μbarₖ, ANorm, Acond, backward, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %7.1e %8.1e %7.1e %7.1e %8.1e %.2fs\n", iter, rNorm, ArNorm, βₖ₊₁, λₖ, μbarₖ, ANorm, Acond, backward, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -469,7 +469,7 @@ kwargs_minres_qlp = (:M, :ldiv, :λ, :atol, :rtol, :Artol, :itmax, :timemax, :ve stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/qmr.jl b/src/qmr.jl index 892ddd14a..1f6afe290 100644 --- a/src/qmr.jl +++ b/src/qmr.jl @@ -170,7 +170,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist stats.niter = 0 stats.solved = true stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -185,7 +185,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist stats.niter = 0 stats.solved = false stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "Breakdown bᴴc = 0" solver.warm_start = false return solver @@ -193,7 +193,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %8s %7s %5s\n", "k", "αₖ", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, cᴴb, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, cᴴb, rNorm, start_time |> ktimer) βₖ = √(abs(cᴴb)) # β₁γ₁ = cᴴ(b - Ax₀) γₖ = cᴴb / βₖ # β₁γ₁ = cᴴ(b - Ax₀) @@ -366,7 +366,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist breakdown = !solved && (pᴴq == 0) timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, αₖ, rNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %8.1e %7.1e %.2fs\n", iter, αₖ, rNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -389,7 +389,7 @@ kwargs_qmr = (:c, :M, :N, :ldiv, :atol, :rtol, :itmax, :timemax, :verbose, :hist stats.niter = iter stats.solved = solved stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/symmlq.jl b/src/symmlq.jl index fc28bf667..2cacbc572 100644 --- a/src/symmlq.jl +++ b/src/symmlq.jl @@ -168,7 +168,7 @@ kwargs_symmlq = (:M, :ldiv, :transfer_to_cg, :λ, :λest, :atol, :rtol, :etol, : stats.Acond = T(NaN) history && push!(rNorms, zero(T)) history && push!(rcgNorms, zero(T)) - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -250,7 +250,7 @@ kwargs_symmlq = (:M, :ldiv, :transfer_to_cg, :λ, :λest, :atol, :rtol, :etol, : itmax == 0 && (itmax = 2 * n) (verbose > 0) && @printf(iostream, "%5s %7s %7s %8s %8s %7s %7s %7s %5s\n", "k", "‖r‖", "β", "cos", "sin", "‖A‖", "κ(A)", "test1", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7s %.2fs\n", iter, rNorm, β, cold, sold, ANorm, Acond, "✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7s %.2fs\n", iter, rNorm, β, cold, sold, ANorm, Acond, "✗ ✗ ✗ ✗", start_time |> ktimer) tol = atol + rtol * β₁ status = "unknown" @@ -385,7 +385,7 @@ kwargs_symmlq = (:M, :ldiv, :transfer_to_cg, :λ, :λest, :atol, :rtol, :etol, : ANorm = sqrt(ANorm²) test1 = rNorm / (ANorm * xNorm) - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, β, c, s, ANorm, Acond, test1, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %8.1e %8.1e %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, β, c, s, ANorm, Acond, test1, start_time |> ktimer) # Reset variables ϵold = ϵ @@ -441,7 +441,7 @@ kwargs_symmlq = (:M, :ldiv, :transfer_to_cg, :λ, :λest, :atol, :rtol, :etol, : stats.solved = solved stats.Anorm = ANorm stats.Acond = Acond - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/tricg.jl b/src/tricg.jl index d5385fadc..9348467a9 100644 --- a/src/tricg.jl +++ b/src/tricg.jl @@ -245,7 +245,7 @@ kwargs_tricg = (:M, :N, :ldiv, :spd, :snd, :flip, :τ, :ν, :atol, :rtol, :itmax ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %5s\n", "k", "‖rₖ‖", "βₖ₊₁", "γₖ₊₁", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ, γₖ, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ, γₖ, start_time |> ktimer) # Set up workspace. d₂ₖ₋₃ = d₂ₖ₋₂ = zero(T) @@ -428,7 +428,7 @@ kwargs_tricg = (:M, :N, :ldiv, :spd, :snd, :flip, :τ, :ν, :atol, :rtol, :itmax tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ₊₁, γₖ₊₁, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ₊₁, γₖ₊₁, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -448,7 +448,7 @@ kwargs_tricg = (:M, :N, :ldiv, :spd, :snd, :flip, :τ, :ν, :atol, :rtol, :itmax stats.niter = iter stats.solved = solved stats.inconsistent = !solved && breakdown - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/trilqr.jl b/src/trilqr.jl index 307fc0b67..03b7ff482 100644 --- a/src/trilqr.jl +++ b/src/trilqr.jl @@ -157,7 +157,7 @@ kwargs_trilqr = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, εQ = atol + rtol * cNorm ξ = zero(T) (verbose > 0) && @printf(iostream, "%5s %7s %7s %5s\n", "k", "‖rₖ‖", "‖sₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, bNorm, cNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, bNorm, cNorm, start_time |> ktimer) # Set up workspace. βₖ = knorm(m, r₀) # β₁ = ‖r₀‖ = ‖v₁‖ @@ -406,9 +406,9 @@ kwargs_trilqr = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && solved_primal && !solved_dual && @printf(iostream, "%5d %7s %7.1e %.2fs\n", iter, "✗ ✗ ✗ ✗", sNorm, ktimer(start_time)) - kdisplay(iter, verbose) && !solved_primal && solved_dual && @printf(iostream, "%5d %7.1e %7s %.2fs\n", iter, rNorm_lq, "✗ ✗ ✗ ✗", ktimer(start_time)) - kdisplay(iter, verbose) && !solved_primal && !solved_dual && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, rNorm_lq, sNorm, ktimer(start_time)) + kdisplay(iter, verbose) && solved_primal && !solved_dual && @printf(iostream, "%5d %7s %7.1e %.2fs\n", iter, "✗ ✗ ✗ ✗", sNorm, start_time |> ktimer) + kdisplay(iter, verbose) && !solved_primal && solved_dual && @printf(iostream, "%5d %7.1e %7s %.2fs\n", iter, rNorm_lq, "✗ ✗ ✗ ✗", start_time |> ktimer) + kdisplay(iter, verbose) && !solved_primal && !solved_dual && @printf(iostream, "%5d %7.1e %7.1e %.2fs\n", iter, rNorm_lq, sNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -446,7 +446,7 @@ kwargs_trilqr = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, stats.niter = iter stats.solved_primal = solved_primal stats.solved_dual = solved_dual - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/trimr.jl b/src/trimr.jl index 6a7d9da06..da7d0aa05 100644 --- a/src/trimr.jl +++ b/src/trimr.jl @@ -255,7 +255,7 @@ kwargs_trimr = (:M, :N, :ldiv, :spd, :snd, :flip, :sp, :τ, :ν, :atol, :rtol, : ε = atol + rtol * rNorm (verbose > 0) && @printf(iostream, "%5s %7s %7s %7s %5s\n", "k", "‖rₖ‖", "βₖ₊₁", "γₖ₊₁", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ, γₖ, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ, γₖ, start_time |> ktimer) # Set up workspace. old_c₁ₖ = old_c₂ₖ = old_c₃ₖ = old_c₄ₖ = zero(T) @@ -531,7 +531,7 @@ kwargs_trimr = (:M, :N, :ldiv, :spd, :snd, :flip, :sp, :τ, :ν, :atol, :rtol, : tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ₊₁, γₖ₊₁, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %7.1e %7.1e %.2fs\n", iter, rNorm, βₖ₊₁, γₖ₊₁, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -551,7 +551,7 @@ kwargs_trimr = (:M, :N, :ldiv, :spd, :snd, :flip, :sp, :τ, :ν, :atol, :rtol, : stats.niter = iter stats.solved = solved stats.inconsistent = !solved && breakdown - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/usymlq.jl b/src/usymlq.jl index 18b859fa1..7a8172500 100644 --- a/src/usymlq.jl +++ b/src/usymlq.jl @@ -153,7 +153,7 @@ kwargs_usymlq = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, stats.niter = 0 stats.solved = true stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -164,7 +164,7 @@ kwargs_usymlq = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, ε = atol + rtol * bNorm (verbose > 0) && @printf(iostream, "%5s %7s %5s\n", "k", "‖rₖ‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, bNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, bNorm, start_time |> ktimer) βₖ = knorm(m, r₀) # β₁ = ‖v₁‖ = ‖r₀‖ γₖ = knorm(n, c) # γ₁ = ‖u₁‖ = ‖c‖ @@ -325,7 +325,7 @@ kwargs_usymlq = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm_lq, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %.2fs\n", iter, rNorm_lq, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -350,7 +350,7 @@ kwargs_usymlq = (:transfer_to_usymcg, :atol, :rtol, :itmax, :timemax, :verbose, stats.niter = iter stats.solved = solved_lq || solved_cg stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end diff --git a/src/usymqr.jl b/src/usymqr.jl index fbb75760c..fa86d4524 100644 --- a/src/usymqr.jl +++ b/src/usymqr.jl @@ -156,7 +156,7 @@ kwargs_usymqr = (:atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, stats.niter = 0 stats.solved = true stats.inconsistent = false - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = "x = 0 is a zero-residual solution" solver.warm_start = false return solver @@ -168,7 +168,7 @@ kwargs_usymqr = (:atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, ε = atol + rtol * rNorm κ = zero(T) (verbose > 0) && @printf(iostream, "%5s %7s %8s %5s\n", "k", "‖rₖ‖", "‖Aᴴrₖ₋₁‖", "timer") - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8s %.2fs\n", iter, rNorm, " ✗ ✗ ✗ ✗", ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8s %.2fs\n", iter, rNorm, " ✗ ✗ ✗ ✗", start_time |> ktimer) βₖ = knorm(m, r₀) # β₁ = ‖v₁‖ = ‖r₀‖ γₖ = knorm(n, c) # γ₁ = ‖u₁‖ = ‖c‖ @@ -328,7 +328,7 @@ kwargs_usymqr = (:atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, tired = iter ≥ itmax timer = time_ns() - start_time overtimed = timer > timemax_ns - kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %.2fs\n", iter, rNorm, AᴴrNorm, ktimer(start_time)) + kdisplay(iter, verbose) && @printf(iostream, "%5d %7.1e %8.1e %.2fs\n", iter, rNorm, AᴴrNorm, start_time |> ktimer) end (verbose > 0) && @printf(iostream, "\n") @@ -346,7 +346,7 @@ kwargs_usymqr = (:atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, stats.niter = iter stats.solved = solved stats.inconsistent = inconsistent - stats.timer = ktimer(start_time) + stats.timer = start_time |> ktimer stats.status = status return solver end