Skip to content

Commit

Permalink
suppress speedmapping warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Dec 25, 2023
1 parent 960c6e5 commit a7f1277
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412"
Subscripts = "2b7f82d5-8785-4f63-971e-f18ddbeb808e"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
SymPyPythonCall = "bc8888f7-b21e-4b7c-a06a-5d9c9496438c"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
Expand Down Expand Up @@ -80,6 +81,7 @@ SpecialFunctions = "^2"
SpeedMapping = "^0.3"
StatsPlots = "^0.15"
Subscripts = "^0.1"
Suppressor = "^0.2"
SymPyPythonCall = "^0.2"
Symbolics = "^5"
Test = "^1"
Expand Down
48 changes: 28 additions & 20 deletions src/MacroModelling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import LinearOperators
import DataStructures: CircularBuffer
import ImplicitDifferentiation as ℐ
import SpeedMapping: speedmapping
import Suppressor: @suppress
import REPL
import Unicode
import MatrixEquations # good overview: https://cscproxy.mpi-magdeburg.mpg.de/mpcsc/benner/talks/Benner-Melbourne2019.pdf
Expand Down Expand Up @@ -2973,16 +2974,18 @@ function second_order_stochastic_steady_state_iterative_solution_forward(𝐒₁
1
shock]

sol = speedmapping(state;
m! = (SSS, sss) -> begin
aug_state .= [sss[𝓂.timings.past_not_future_and_mixed_idx]
1
shock]
@suppress begin
sol = speedmapping(state;
m! = (SSS, sss) -> begin
aug_state .= [sss[𝓂.timings.past_not_future_and_mixed_idx]
1
shock]

SSS .= 𝐒₁ * aug_state + 𝐒₂ * β„’.kron(aug_state, aug_state) / 2
end,
tol = tol, maps_limit = 10000)
end

SSS .= 𝐒₁ * aug_state + 𝐒₂ * β„’.kron(aug_state, aug_state) / 2
end,
tol = tol, maps_limit = 10000)

return sol.minimizer, sol.converged
end

Expand Down Expand Up @@ -3096,15 +3099,17 @@ function third_order_stochastic_steady_state_iterative_solution_forward(𝐒₁
1
shock]

sol = speedmapping(state;
m! = (SSS, sss) -> begin
aug_state .= [sss[𝓂.timings.past_not_future_and_mixed_idx]
1
shock]
@suppress begin
sol = speedmapping(state;
m! = (SSS, sss) -> begin
aug_state .= [sss[𝓂.timings.past_not_future_and_mixed_idx]
1
shock]

SSS .= 𝐒₁ * aug_state + 𝐒₂ * β„’.kron(aug_state, aug_state) / 2 + 𝐒₃ * β„’.kron(β„’.kron(aug_state,aug_state),aug_state) / 6
end,
tol = tol, maps_limit = 10000)
SSS .= 𝐒₁ * aug_state + 𝐒₂ * β„’.kron(aug_state, aug_state) / 2 + 𝐒₃ * β„’.kron(β„’.kron(aug_state,aug_state),aug_state) / 6
end,
tol = tol, maps_limit = 10000)
end

return sol.minimizer, sol.converged
end
Expand Down Expand Up @@ -4413,7 +4418,9 @@ function calculate_quadratic_iteration_solution(βˆ‡β‚::AbstractMatrix{Float64};
C = similar(A)
CΜ„ = similar(A)

sol = speedmapping(zero(A); m! = (CΜ„, C) -> CΜ„ .= A + B * C^2, tol = tol, maps_limit = 10000)
@suppress begin
sol = speedmapping(zero(A); m! = (CΜ„, C) -> CΜ„ .= A + B * C^2, tol = tol, maps_limit = 10000)
end

C = -sol.minimizer

Expand Down Expand Up @@ -5500,8 +5507,9 @@ function solve_matrix_equation_forward(ABC::Vector{Float64};
𝐂 = MatrixEquations.lyapd(collect(A),-C)
solved = isapprox(𝐂, A * 𝐂 * A' - C, rtol = eps(Float32))
elseif solver == :speedmapping
soll = speedmapping(collect(-C); m! = (X, x) -> X .= A * x * B - C, stabilize = true)

@suppress begin
soll = speedmapping(collect(-C); m! = (X, x) -> X .= A * x * B - C, stabilize = true)
end
𝐂 = soll.minimizer

solved = soll.converged
Expand Down

0 comments on commit a7f1277

Please sign in to comment.