Skip to content

Commit

Permalink
lower tol for find shocks (hopefully fixes tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Nov 5, 2024
1 parent e363642 commit 234d485
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/filter/find_shocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function find_shocks(::Val{:LagrangeNewton},
𝐒ⁱ²ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 1000,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
x = copy(initial_guess)

λ = zeros(size(𝐒ⁱ, 1))
Expand Down Expand Up @@ -142,7 +142,7 @@ function rrule(::typeof(find_shocks),
𝐒ⁱ²ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 1000,
tol::Float64 = 1e-14)
tol::Float64 = 1e-13)

x, matched = find_shocks(Val(:LagrangeNewton),
initial_guess,
Expand Down Expand Up @@ -208,7 +208,7 @@ function find_shocks(::Val{:LagrangeNewton},
𝐒ⁱ³ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 1000,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
x = copy(initial_guess)

λ = zeros(size(𝐒ⁱ, 1))
Expand Down Expand Up @@ -368,7 +368,7 @@ function rrule(::typeof(find_shocks),
𝐒ⁱ³ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 1000,
tol::Float64 = 1e-14)
tol::Float64 = 1e-13)

x, matched = find_shocks(Val(:LagrangeNewton),
initial_guess,
Expand Down Expand Up @@ -431,7 +431,7 @@ function find_shocks(::Val{:SLSQP},
𝐒ⁱ²ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 500,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
function objective_optim_fun(X::Vector{S}, grad::Vector{S}) where S
if length(grad) > 0
copy!(grad, X)
Expand Down Expand Up @@ -516,7 +516,7 @@ function find_shocks(::Val{:SLSQP},
𝐒ⁱ³ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 500,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
function objective_optim_fun(X::Vector{S}, grad::Vector{S}) where S
if length(grad) > 0
copy!(grad, X)
Expand Down Expand Up @@ -614,7 +614,7 @@ function find_shocks(::Val{:COBYLA},
𝐒ⁱ²ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 10000,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
function objective_optim_fun(X::Vector{S}, grad::Vector{S}) where S
sum(abs2, X)
end
Expand Down Expand Up @@ -682,7 +682,7 @@ function find_shocks(::Val{:COBYLA},
𝐒ⁱ³ᵉ::AbstractMatrix{Float64},
shock_independent::Vector{Float64};
max_iter::Int = 10000,
tol::Float64 = 1e-14) # will fail for higher or lower precision
tol::Float64 = 1e-13) # will fail for higher or lower precision
function objective_optim_fun(X::Vector{S}, grad::Vector{S}) where S
sum(abs2, X)
end
Expand Down

0 comments on commit 234d485

Please sign in to comment.