Skip to content

Commit

Permalink
Update the arguments of to_boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 5, 2024
1 parent 3719f78 commit 3e915b7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cgls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ kwargs_cgls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose
α = γ / δ

# if a trust-region constraint is give, compute step to the boundary
σ = radius > 0 ? maximum(to_boundary(n, x, p, radius)) : α
σ = radius > 0 ? maximum(to_boundary(n, x, p, Mr, radius)) : α
if (radius > 0) &> σ)
α = σ
on_boundary = true
Expand Down
4 changes: 2 additions & 2 deletions src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema
(verbose > 0) && @printf(iostream, "radius = %8.1e > 0 and ‖x‖ = %8.1e\n", radius, xNorm)
# find t1 > 0 and t2 < 0 such that ‖x + ti * p‖² = radius² (i = 1, 2)
xNorm² = xNorm * xNorm
t = to_boundary(n, x, p, radius; flip = false, xNorm2 = xNorm², dNorm2 = pNorm²)
t = to_boundary(n, x, p, Mq, radius; flip = false, xNorm2 = xNorm², dNorm2 = pNorm²)
t1 = maximum(t) # > 0
t2 = minimum(t) # < 0
tr = maximum(to_boundary(n, x, r, radius; flip = false, xNorm2 = xNorm², dNorm2 = rNorm²))
tr = maximum(to_boundary(n, x, r, Mq, radius; flip = false, xNorm2 = xNorm², dNorm2 = rNorm²))
(verbose > 0) && @printf(iostream, "t1 = %8.1e, t2 = %8.1e and tr = %8.1e\n", t1, t2, tr)

if abspAp γ * pNorm * @knrm2(n, q) # pᴴAp ≃ 0
Expand Down
4 changes: 2 additions & 2 deletions src/crls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ kwargs_crls = (:M, :ldiv, :radius, :λ, :atol, :rtol, :itmax, :timemax, :verbose
p = Ar # p = Aᴴr
pNorm² = ArNorm * ArNorm
mul!(q, Aᴴ, s)
α = min(ArNorm^2 / γ, maximum(to_boundary(n, x, p, radius, flip = false, dNorm2 = pNorm²))) # the quadratic is minimal in the direction Aᴴr for α = ‖Ar‖²/γ
α = min(ArNorm^2 / γ, maximum(to_boundary(n, x, p, Ms, radius, flip = false, dNorm2 = pNorm²))) # the quadratic is minimal in the direction Aᴴr for α = ‖Ar‖²/γ
else
pNorm² = pNorm * pNorm
σ = maximum(to_boundary(n, x, p, radius, flip = false, dNorm2 = pNorm²))
σ = maximum(to_boundary(n, x, p, Ms, radius, flip = false, dNorm2 = pNorm²))
if α σ
α = σ
on_boundary = true
Expand Down
2 changes: 1 addition & 1 deletion src/lsmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ kwargs_lsmr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
# the step ϕ/ρ is not necessarily positive
σ = ζ /* ρbar)
if radius > 0
t1, t2 = to_boundary(n, x, hbar, radius)
t1, t2 = to_boundary(n, x, hbar, v, radius)
tmax, tmin = max(t1, t2), min(t1, t2)
on_boundary = σ > tmax || σ < tmin
σ = σ > 0 ? min(σ, tmax) : max(σ, tmin)
Expand Down
2 changes: 1 addition & 1 deletion src/lsqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ kwargs_lsqr = (:M, :N, :ldiv, :sqd, :λ, :radius, :etol, :axtol, :btol, :conlim,
# the step ϕ/ρ is not necessarily positive
σ = ϕ / ρ
if radius > 0
t1, t2 = to_boundary(n, x, w, radius)
t1, t2 = to_boundary(n, x, w, v, radius)
tmax, tmin = max(t1, t2), min(t1, t2)
on_boundary = σ > tmax || σ < tmin
σ = σ > 0 ? min(σ, tmax) : max(σ, tmin)
Expand Down

0 comments on commit 3e915b7

Please sign in to comment.