Skip to content

Commit 0ef5d7b

Browse files
committed
got get_NSSS_and_parameters to work. get_solution doesnt work, as he seems to not respeect ignore_derivatives
1 parent d4db56b commit 0ef5d7b

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

ext/MooncakeExt.jl

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,33 @@ Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, AbstractFloat, typeof(MacroM
1414

1515
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, AbstractFloat, typeof(MacroModelling.calculate_third_order_stochastic_steady_state), Val{:newton}, Matrix{Float64}, SparseArrays.AbstractSparseMatrix{Float64}, SparseArrays.AbstractSparseMatrix{Float64}, Vector{Float64}, MacroModelling.ℳ} true
1616

17-
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, MacroModelling.CalculationOptions, typeof(MacroModelling.get_NSSS_and_parameters), MacroModelling.ℳ, Vector{S}} where S <: AbstractFloat true
17+
# Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, MacroModelling.CalculationOptions, typeof(MacroModelling.get_NSSS_and_parameters), MacroModelling.ℳ, Vector{S}} where S <: AbstractFloat true
18+
19+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{T¹, typeof(MacroModelling.get_NSSS_and_parameters), T², T³} where {T¹,T²,T³} true
20+
21+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{typeof(MacroModelling.get_NSSS_and_parameters), T¹,T²} where {T¹,T²} true
22+
23+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{T¹, typeof(MacroModelling.calculate_jacobian), T², T³, T⁴} where {T¹,T²,T³,T⁴} true
24+
25+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{typeof(MacroModelling.calculate_jacobian), T², T³, T⁴} where {T²,T³,T⁴} true
26+
27+
# Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, typeof(MacroModelling.calculate_jacobian), Vector{M}, Vector{N}, MacroModelling.ℳ} where {M <: AbstractFloat, N <: AbstractFloat}
28+
29+
30+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{typeof(MacroModelling.run_kalman_iterations), T³, T⁴, T⁵, T⁶,T⁷} where {T³,T⁴,T⁵,T⁶,T⁷} true
31+
32+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{T¹,T²,typeof(MacroModelling.run_kalman_iterations), T³, T⁴, T⁵, T⁶,T⁷} where {T¹,T²,T³,T⁴,T⁵,T⁶,T⁷} true
1833

19-
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, typeof(MacroModelling.calculate_jacobian), Vector{M}, Vector{N}, MacroModelling.ℳ} where {M <: AbstractFloat, N <: AbstractFloat}
2034

2135
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, typeof(MacroModelling.calculate_hessian), Vector{M}, Vector{N}, MacroModelling.ℳ} where {M <: AbstractFloat, N <: AbstractFloat}
2236

2337
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, typeof(MacroModelling.calculate_third_order_derivatives), Vector{M}, Vector{N}, MacroModelling.ℳ} where {M <: AbstractFloat, N <: AbstractFloat}
2438

25-
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, MacroModelling.timings, MacroModelling.CalculationOptions, AbstractMatrix{R}, typeof(MacroModelling.calculate_first_order_solution), Matrix{R}} where R <: AbstractFloat true
39+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{T¹, T², T³, T⁴, typeof(MacroModelling.calculate_first_order_solution), T⁵} where {T¹,T²,T³,T⁴,T⁵} true
40+
41+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{typeof(MacroModelling.calculate_first_order_solution), T⁵} where {T⁵} true
42+
43+
# Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, MacroModelling.timings, MacroModelling.CalculationOptions, AbstractMatrix{R}, typeof(MacroModelling.calculate_first_order_solution), Matrix{R}} where R <: AbstractFloat true
2644

2745
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, MacroModelling.timings, AbstractMatrix{R}, MacroModelling.CalculationOptions, typeof(MacroModelling.calculate_second_order_solution), AbstractMatrix{R}, SparseArrays.SparseMatrixCSC{R}, AbstractMatrix{R}, MacroModelling.second_order_auxiliary_matrices, MacroModelling.caches} where R <: AbstractFloat true
2846

@@ -42,7 +60,13 @@ Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, Int, Int, MacroModelling.Cal
4260

4361
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, Int, Int, MacroModelling.CalculationOptions, Symbol, typeof(MacroModelling.calculate_inversion_filter_loglikelihood), Val{:third_order}, Vector{Float64}, Vector{AbstractMatrix{Float64}}, Matrix{Float64}, Union{Vector{String}, Vector{Symbol}}, MacroModelling.timings} true
4462

45-
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, Symbol, AbstractFloat, AbstractFloat, Bool, typeof(MacroModelling.solve_lyapunov_equation), AbstractMatrix{R}, AbstractMatrix{R}} where R <: AbstractFloat true
63+
# Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, Symbol, AbstractFloat, AbstractFloat, Bool, typeof(MacroModelling.solve_lyapunov_equation), AbstractMatrix{R}, AbstractMatrix{R}} where R <: AbstractFloat true
64+
65+
66+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{T¹, T², T³, T⁴, typeof(MacroModelling.solve_lyapunov_equation), T⁵, T⁶} where {T¹,T²,T³,T⁴,T⁵,T⁶} true
67+
68+
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{typeof(MacroModelling.solve_lyapunov_equation), T⁵, T⁶} where {T⁵,T⁶} true
69+
4670

4771
Mooncake.@from_rrule Mooncake.DefaultCtx Tuple{Any, AbstractMatrix{<:AbstractFloat}, Symbol, AbstractFloat, AbstractFloat, MacroModelling.sylvester_caches, Bool, typeof(MacroModelling.solve_sylvester_equation), AbstractMatrix{R}, AbstractMatrix{R}, AbstractMatrix{R}} where R <: AbstractFloat true
4872

@@ -111,13 +135,13 @@ function ChainRulesCore.rrule(func_ir::Any,
111135
Val(:newton), S1, S2, S3, x, m; tol=tol)
112136
end
113137

114-
function ChainRulesCore.rrule(func_ir::Any,
115-
opts::MacroModelling.CalculationOptions,
116-
::typeof(MacroModelling.get_NSSS_and_parameters),
117-
m::MacroModelling.ℳ,
118-
x::Vector{S}) where {S<:AbstractFloat}
119-
ChainRulesCore.rrule(MacroModelling.get_NSSS_and_parameters, m, x; opts=opts)
120-
end
138+
# function ChainRulesCore.rrule(func_ir::Any,
139+
# opts::MacroModelling.CalculationOptions,
140+
# ::typeof(MacroModelling.get_NSSS_and_parameters),
141+
# m::MacroModelling.ℳ,
142+
# x::Vector{S}) where {S<:AbstractFloat}
143+
# ChainRulesCore.rrule(MacroModelling.get_NSSS_and_parameters, m, x; opts=opts)
144+
# end
121145

122146
function ChainRulesCore.rrule(func_ir::Any,
123147
T::MacroModelling.timings,

0 commit comments

Comments
 (0)