Skip to content

Commit

Permalink
correct infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed May 3, 2023
1 parent a1a1837 commit 12d4819
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/robustlinearmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1090,11 +1090,12 @@ function pirls_Sestimate!(
)
# Skip test for convergence
continue
else
installbeta!(p, f)
r.σ = sig
end

# Update coefficients
installbeta!(p, f)
r.σ = sig

# Test for convergence
Δsig = (sigold - sig)
verbose && println("Iteration: $i, scale: $sig, Δsig: $(Δsig)")
Expand Down Expand Up @@ -1205,10 +1206,11 @@ function pirls_τestimate!(
)
# Skip test for convergence
continue
else
installbeta!(p, f)
end

# Update coefficients
installbeta!(p, f)

# Test for convergence
Δtau = (tauold - tau)
verbose && println("Iteration: $i, scale: $tau, Δsig: $(Δtau)")
Expand Down
2 changes: 1 addition & 1 deletion test/linearfit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ end

@testset "Infinite loop: issue #32" begin
# Infinite loop: issue #32
Xs = [0.001481; 0.0017; 0.00133; 0.001853; 0.002086; 0.003189; 0.001161; 0.002441; 0.001133; 0.001308; 0.001; 0.009309; 0.1456; 0.3127; 0.2627; 0.1704; 0.101; 0.06855; 0.02578]
Xs = reshape([0.001481, 0.0017, 0.00133, 0.001853, 0.002086, 0.003189, 0.001161, 0.002441, 0.001133, 0.001308, 0.001, 0.009309, 0.1456, 0.3127, 0.2627, 0.1704, 0.101, 0.06855, 0.02578], :, 1)
ys = [1.222, 1.599, 2.238, 2.233, 2.668, 2.637, 3.177, 2.539, 2.339, 1.481, 1.733, 0.04986, 0.0812, 0.1057, 0.1197, 0.1348, 0.1006, 0.1021, 0.08278]
@test_throws Exception rlm(Xs, ys, SEstimator{TukeyLoss}(), initial_scale=:mad)
end
Expand Down

0 comments on commit 12d4819

Please sign in to comment.