Skip to content

Commit

Permalink
Merge pull request #55 from ctkelley/main
Browse files Browse the repository at this point in the history
code cleanup part 1
  • Loading branch information
ctkelley authored Sep 24, 2024
2 parents f5a8bfc + 1fa2ac7 commit 876db45
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
- '~1.11.0-0'
- 'nightly'
os:
- ubuntu-latest
# - ubuntu-latest
- macOS-latest
- windows-latest
# - windows-latest
arch:
- x64
steps:
Expand Down
3 changes: 0 additions & 3 deletions src/Solvers/IRTriangle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ function IRTriangle!(AF::Union{MPLFact,MPHFact}, r, rs, verbose)
if on_the_fly
ldiv!(AFS, r)
else
# TFact = eltype(AFS)
# TW = eltype(r)
# rs .= TFact.(r)
rs .= r
ldiv!(AFS, rs)
r .= rs
Expand Down
18 changes: 5 additions & 13 deletions src/Solvers/mpgeslir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,10 @@ function mpgeslir(AF::MPFact, b; reporting = false, verbose = true)
term_data = termination_settings(TR, residterm)
tolf = term_data.tolf
AD = AF.AH
#
# I'm using the L1 norm because it's much faster.
#
residterm ? anrm = 0.0 : anrm = opnorm(AD, 1)
# residterm ? tf=10.0 : tf=.5
# tolf = eps(TR)*tf
# tolf = eps(TR)*TR.(.9)
# tolf = eps(TR)*10.0
#
# Keep the records and accumulate the statistics.
#
Expand All @@ -181,27 +180,20 @@ function mpgeslir(AF::MPFact, b; reporting = false, verbose = true)
#
AD = AF.AH
bnrm = norm(b, normtype)
#
# I'm using the L1 norm because it's much faster.
#
# residterm=AF.residterm
# residterm ? anrm = 0.0 : anrm = opnorm(AD, 1)
bsc = b
AFS = AF.AF
#
# Initialize the iteration. I initialize to zero. That makes the
# iteration count the same as the high precision matvec and the
# triangular sovles
#
# x = zeros(TR, size(b))
xnrm = norm(x, normtype)
#
# Initial residual
#
r .= b
tol = tolf
onthefly ? (rs = ones(TF, 1)) : (rs = zeros(TF, size(b)))

#
# Keep the books. Test for excessive residual precision.
#
Expand Down Expand Up @@ -258,8 +250,8 @@ function mpgeslir(AF::MPFact, b; reporting = false, verbose = true)
#
# If the residual norm increased, complain.
#
# complain_resid = (rnrm >= rnrmx) && (rnrm > 1.e3 * tol)
# complain_resid && println("IR Norm increased: $rnrm, $rnrmx, $tol")
complain_resid = mpdebug && (rnrm >= rnrmx) && (rnrm > 1.e3 * tol)
complain_resid && println("IR Norm increased: $rnrm, $rnrmx, $tol")
end
x = xloop
verbose && println("Residual history = $rhist")
Expand Down
5 changes: 2 additions & 3 deletions src/Solvers/mpkrir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ function mpkrir(AF::MPKFact, b; reporting = false, verbose = false, mpdebug = fa
#
itc = 0
VF = AF.VStore
normdec = true
kl_store = AF.KStore
atvd = copy(r)
MP_Data = (MPF = AF, atv = atvd)
Expand Down Expand Up @@ -234,8 +233,8 @@ function mpkrir(AF::MPKFact, b; reporting = false, verbose = false, mpdebug = fa
#
# If the residual norm increased, complain.
#
(rnrm >= rnrmx) && (normdec = false)
~normdec && mpdebug && (rnrm >= rnrmx) && println("Residual norm increased")
complain_resid = mpdebug && (rnrm >= rnrmx) && (rnrm > 1.e3 * tol)
complain_resid && println("IR Norm increased: $rnrm, $rnrmx, $tol")
xnorm = norm(x, normtype)
tol = tolf * (bnorm + anrm * xnorm)
end
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

0 comments on commit 876db45

Please sign in to comment.