Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
DynareJulia
Dynare.jl
Commits
6ad9c9ed
Commit
6ad9c9ed
authored
Dec 10, 2020
by
MichelJuillard
Browse files
move srs/parser/* to src/
parent
01b18328
Changes
8
Hide whitespace changes
Inline
Side-by-side
Manifest.toml
View file @
6ad9c9ed
...
...
@@ -12,6 +12,9 @@ git-tree-sha1 = "42c42f2221906892ceb765dbcb1a51deeffd86d7"
uuid
=
"79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version
=
"2.3.0"
[[ArgTools]]
uuid
=
"0dad84c5-d112-42e6-8d28-ef12dabb789f"
[[ArrayInterface]]
deps
=
[
"LinearAlgebra"
,
"Requires"
,
"SparseArrays"
]
git-tree-sha1
=
"bd09109dffaa3926a20178cb8432edd729be0db0"
...
...
@@ -19,10 +22,7 @@ uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version
=
"2.13.7"
[[Artifacts]]
deps
=
["Pkg"]
git-tree-sha1
=
"c30985d8821e0cd73870b17b0ed0ce6dc44cb744"
uuid
=
"56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version
=
"1.3.0"
[[AxisAlgorithms]]
deps
=
[
"LinearAlgebra"
,
"Random"
,
"SparseArrays"
,
"WoodburyMatrices"
]
...
...
@@ -101,9 +101,9 @@ version = "3.23.0"
[[CompilerSupportLibraries_jll]]
deps
=
[
"Artifacts"
,
"JLLWrappers"
,
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"
8e695f735fca77e9708e795eda62afdb869cbb70
"
git-tree-sha1
=
"
22174176d4fc25a4372061a33f3a1f3e37909b23
"
uuid
=
"e66e0078-7015-5450-92f7-15fbd957f2ae"
version
=
"0.3.
4
+0"
version
=
"0.3.
6
+0"
[[Compose]]
deps
=
[
"Base64"
,
"Colors"
,
"DataStructures"
,
"Dates"
,
"IterTools"
,
"JSON"
,
"LinearAlgebra"
,
"Measures"
,
"Printf"
,
"Random"
,
"Requires"
,
"UUIDs"
]
...
...
@@ -204,6 +204,10 @@ git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
uuid
=
"ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version
=
"0.8.3"
[[Downloads]]
deps
=
[
"ArgTools"
,
"LibCURL"
,
"NetworkOptions"
]
uuid
=
"f43a241f-c20a-4ad4-852c-f6b1247861c6"
[[Dynare_preprocessor_jll]]
deps
=
[
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"3c9228a0b7ec0248f4cd8e47a3de0fa191b1518f"
...
...
@@ -434,6 +438,14 @@ git-tree-sha1 = "c7aebfecb1a60d59c0fe023a68ec947a208b1e6b"
uuid
=
"b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version
=
"1.2.0"
[[LibCURL]]
deps
=
[
"LibCURL_jll"
,
"MozillaCACerts_jll"
]
uuid
=
"b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
[[LibCURL_jll]]
deps
=
["Libdl"]
uuid
=
"deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
[[LibGit2]]
deps
=
["Printf"]
uuid
=
"76f85450-5226-5b5a-8eaa-529ad045b433"
...
...
@@ -504,9 +516,9 @@ version = "1.0.3"
[[MbedTLS_jll]]
deps
=
[
"Artifacts"
,
"JLLWrappers"
,
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"
0eef589dd1c26a3ac9d753fe1a8bcad63f956fa6
"
git-tree-sha1
=
"
c7166979cd9193dbaf32392b83f166ebf6154033
"
uuid
=
"c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version
=
"2.
16.8+1
"
version
=
"2.
24.0+0
"
[[Measures]]
git-tree-sha1
=
"e498ddeee6f9fdb4551ce855a46f54dbd900245f"
...
...
@@ -528,6 +540,9 @@ version = "0.4.4"
[[Mmap]]
uuid
=
"a63ad114-7e13-5084-954f-fe012c677804"
[[MozillaCACerts_jll]]
uuid
=
"14a3606d-f60d-562e-9121-12d972cd8159"
[[NLSolversBase]]
deps
=
[
"Calculus"
,
"DiffEqDiffTools"
,
"DiffResults"
,
"Distributed"
,
"ForwardDiff"
]
git-tree-sha1
=
"f1b8ed89fa332f410cfc7c937682eb4d0b361521"
...
...
@@ -539,6 +554,9 @@ git-tree-sha1 = "c84c576296d0e2fbb3fc134d3e09086b3ea617cd"
uuid
=
"77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version
=
"0.3.4"
[[NetworkOptions]]
uuid
=
"ca575930-c2e3-43a9-ace4-1e988b2c1908"
[[OffsetArrays]]
deps
=
["Adapt"]
git-tree-sha1
=
"9db93b990af57b3a56dca38476832f60d58f777b"
...
...
@@ -594,9 +612,9 @@ version = "0.12.1"
[[Parsers]]
deps
=
["Dates"]
git-tree-sha1
=
"
6fa4202675c05ba0f8268a6ddf07606350eda3ce
"
git-tree-sha1
=
"
b417be52e8be24e916e34b3d70ec2da7bdf56a68
"
uuid
=
"69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version
=
"1.0.1
1
"
version
=
"1.0.1
2
"
[[Periods]]
deps
=
["Dates"]
...
...
@@ -607,7 +625,7 @@ uuid = "0c1d1a06-9168-427d-90e3-b4d73349562f"
version
=
"0.1.0"
[[Pkg]]
deps
=
[
"
Date
s"
,
"LibGit2"
,
"Libdl"
,
"Logging"
,
"Markdown"
,
"Printf"
,
"REPL"
,
"Random"
,
"SHA"
,
"UUIDs"
]
deps
=
[
"
Artifacts"
,
"Dates"
,
"Download
s"
,
"LibGit2"
,
"Libdl"
,
"Logging"
,
"Markdown"
,
"Printf"
,
"REPL"
,
"Random"
,
"SHA"
,
"Serialization"
,
"TOML"
,
"Tar"
,
"UUIDs"
]
uuid
=
"44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[PlotThemes]]
...
...
@@ -681,7 +699,7 @@ uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
version
=
"2.4.1"
[[REPL]]
deps
=
[
"InteractiveUtils"
,
"Markdown"
,
"Sockets"
]
deps
=
[
"InteractiveUtils"
,
"Markdown"
,
"Sockets"
,
"Unicode"
]
uuid
=
"3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[Random]]
...
...
@@ -694,9 +712,9 @@ uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439"
version
=
"0.4.0"
[[RecipesBase]]
git-tree-sha1
=
"
6ee6c35fe69e79e17c455a386c1ccdc66d9f7da4
"
git-tree-sha1
=
"
b3fb709f3c97bfc6e948be68beeecb55a0b340ae
"
uuid
=
"3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version
=
"1.1.
0
"
version
=
"1.1.
1
"
[[RecipesPipeline]]
deps
=
[
"Dates"
,
"NaNMath"
,
"PlotUtils"
,
"RecipesBase"
]
...
...
@@ -807,6 +825,10 @@ version = "1.1.0"
deps
=
[
"Libdl"
,
"LinearAlgebra"
,
"Serialization"
,
"SparseArrays"
]
uuid
=
"4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
[[TOML]]
deps
=
["Dates"]
uuid
=
"fa267f1f-6049-4f14-aa54-33bafae1ed76"
[[TableTraits]]
deps
=
["IteratorInterfaceExtensions"]
git-tree-sha1
=
"b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
...
...
@@ -815,12 +837,16 @@ version = "1.0.0"
[[Tables]]
deps
=
[
"DataAPI"
,
"DataValueInterfaces"
,
"IteratorInterfaceExtensions"
,
"LinearAlgebra"
,
"TableTraits"
,
"Test"
]
git-tree-sha1
=
"
24a584cf65e2cfabdadc21694fb69d2e74c82b44
"
git-tree-sha1
=
"
5131a624173d532299d1c7eb05341c18112b21b8
"
uuid
=
"bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version
=
"1.1.0"
version
=
"1.2.1"
[[Tar]]
deps
=
[
"ArgTools"
,
"SHA"
]
uuid
=
"a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
[[Test]]
deps
=
[
"Distributed"
,
"InteractiveUtils"
,
"Logging"
,
"Random"
]
deps
=
[
"InteractiveUtils"
,
"Logging"
,
"Random"
,
"Serialization"
]
uuid
=
"8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TimeDataFrames]]
...
...
@@ -856,9 +882,9 @@ version = "0.5.3"
[[Zlib_jll]]
deps
=
[
"Artifacts"
,
"JLLWrappers"
,
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"320
228915c8debb12cb434c59057290f0834dbf6
"
git-tree-sha1
=
"320
85929ad61a5ed99abea288ec7242be392bb8b
"
uuid
=
"83775a58-1f1d-513f-b197-d71354ab007a"
version
=
"1.2.1
1+18
"
version
=
"1.2.1
2+0
"
[[Zstd_jll]]
deps
=
[
"Artifacts"
,
"JLLWrappers"
,
"Libdl"
,
"Pkg"
]
...
...
Project.toml
View file @
6ad9c9ed
...
...
@@ -3,9 +3,6 @@ uuid = "5203de40-99df-439e-afbc-014de65cb9ef"
authors
=
[
"michel "
]
version
=
"0.1.2"
[compat]
PrettyTables
=
"0.9.1"
[deps]
CSV
=
"336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames
=
"a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
...
...
@@ -25,3 +22,6 @@ PolynomialMatrixEquations = "4f9d485d-518f-41ed-81c8-372cd804c93b"
PrettyTables
=
"08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
PyPlot
=
"d330b81b-6aea-500a-939a-2ce795aea3ee"
TimeDataFrames
=
"ff13af16-2f41-468a-a2e1-aff5c43aabf7"
[compat]
PrettyTables
=
"0.9.1"
src/Dynare.jl
View file @
6ad9c9ed
...
...
@@ -8,11 +8,11 @@ include("dynare_containers.jl")
include
(
"model.jl"
)
export
get_abc
,
get_de
include
(
"symboltable.jl"
)
include
(
"
parser/
deterministic_trends.jl"
)
include
(
"deterministic_trends.jl"
)
include
(
"first_order/simul_first_order.jl"
)
include
(
"
parser/
DynareParser.jl"
)
include
(
"DynareParser.jl"
)
export
parser
,
get_jacobian_at_steadystate!
include
(
"
parser/
DynarePreprocessor.jl"
)
include
(
"DynarePreprocessor.jl"
)
export
dynare_preprocess
include
(
"steady_state/SteadyState.jl"
)
export
steady_state!
...
...
src/
parser/
DynareParser.jl
→
src/DynareParser.jl
View file @
6ad9c9ed
File moved
src/
parser/
DynarePreprocessor.jl
→
src/DynarePreprocessor.jl
View file @
6ad9c9ed
File moved
src/balanced_growth_path.jl
0 → 100644
View file @
6ad9c9ed
using
FastLapackInterface
using
FastLapackInterface
.
QrAlgo
using
LinearAlgebra
struct
BalancedGrowthWs
A1
::
Matrix
{
Float64
}
A2
::
Matrix
{
Float64
}
dd
::
Vector
{
Float64
}
ws
::
QrpWs
ws1
::
QrpWs
function
BalancedGrowthWs
(
n
)
A1
=
Matrix
{
Float64
}(
undef
,
n
,
n
)
A2
=
Matrix
{
Float64
}(
undef
,
n
,
n
)
dd
=
Vector
{
Float64
}(
undef
,
2
*
n
)
qrws
=
QrpWs
(
n
)
qrws1
=
QrpWs
(
2
*
n
)
end
end
function
balanced_growth_path
(
A
,
B
,
C
,
d
,
ws
:
BalancedGrowthWs
)
vJ
=
view
(
jacobian
,
:
,
ws
.
backward_nbr
.+
ws
.
current_nbr
.+
(
1
:
ws
.
forward_nbr
))
ws
.
A1
.+=
vj
vJ
=
view
(
jacobian
,
:
,
ws
.
backward_nbr
.+
ws
.
current_dynamic_indices
)
ws
.
A1
.+=
vj
ws
.
B
.+=
vj
vJ
=
view
(
jacobian
,
:
,
1
:
ws
.
backward_nbr
)
ws
.
A1
.+=
vj
balanced_growth_compute
(
ws
.
A1
,
ws
.
B
,
d
,
ws
)
end
function
balanced_growth_path
(
A
,
B
,
d
,
ws
:
BalancedGrowthWs
)
ws
.
A1
.=
A
.+
B
balanced_growth_compute
(
ws
.
A1
,
B
,
d
,
ws
)
end
function
balanced_growth_compute
(
A1
,
A2
,
d
,
ws
)
n
=
length
(
d
)
println
(
"m
$
n"
)
ws
=
QrpWs
(
A1
)
geqp3!
(
A1
,
ws
)
M1
=
zeros
(
2
*
n
,
2
*
n
)
view
(
M1
,
1
:
n
,
1
:
n
)
.=
A1
view
(
M1
,
n
.+
(
1
:
n
),
1
:
n
)
.=
A1
view
(
M1
,
n
.+
(
1
:
n
),
n
.+
(
1
:
n
))
.=
A2
ws1
=
QrpWs
(
M1
)
geqp3!
(
M1
,
ws1
)
println
(
"triu(M1)"
)
display
(
triu
(
M1
))
println
(
ws1
.
jpvt
)
d1
=
zeros
(
2
*
n
)
view
(
d1
,
1
:
n
)
.=
d
view
(
d1
,
n
.+
(
1
:
n
))
.=
d
dd1
=
Matrix
{
Float64
}(
undef
,
2
*
n
,
1
)
dd1
.=
d1
ormqr_core!
(
'L'
,
transpose
(
M1
),
dd1
,
ws1
)
for
i
=
1
:
n
ws
.
dd
[
i
]
=
d1
[
ws1
.
pivot
[
i
]]
end
for
i
=
n
+
1
:
2
*
n
ws
.
dd
[
i
]
=
d1
[
ws1
.
pivot
[
i
]
-
n
]
end
println
(
dd1
)
end
function
get_abc!
(
ws
::
LinearRationalExpectationsWs
,
jacobian
::
AbstractMatrix
{
Float64
})
i_rows
=
(
ws
.
static_nbr
+
1
)
:
ws
.
endogenous_nbr
fill!
(
ws
.
a
,
0.0
)
fill!
(
ws
.
b
,
0.0
)
fill!
(
ws
.
c
,
0.0
)
ws
.
a
[
:
,
ws
.
forward_indices_d
]
.=
view
(
jacobian
,
i_rows
,
ws
.
backward_nbr
.+
ws
.
current_nbr
.+
(
1
:
ws
.
forward_nbr
))
ws
.
b
[
:
,
ws
.
current_dynamic_indices_d
]
.=
view
(
jacobian
,
i_rows
,
ws
.
backward_nbr
.+
ws
.
current_dynamic_indices
)
ws
.
c
[
:
,
ws
.
backward_indices_d
]
.=
view
(
jacobian
,
i_rows
,
1
:
ws
.
backward_nbr
)
end
function
balance_growth_path_general!
(
m
,
work
)
get_jacobian!
(
work
,
zeros
(
m
.
endogenous_nbr
),
zeros
(
m
.
exogenous_nbr
),
m
,
2
)
end
function
balance_growth_path_purely_backward!
()
end
function
balance_growth_path_purely_forward!
()
end
A
=
[
1.0
-
1
-
1
0
;
0
0
1
0
;
0
1
0
0
;
0
0
2
-
1
]
B
=
[
0
0
0
0
;
0
0
-
0.9
0
;
0
-
1
0
0
;
0
0
0
0
]
d
=
[
0
,
0
,
2.0
,
-
3.0
]
#=
A = [ 1.0 -1 -1 ; 0 0 1 ; 0 1 0 ]
B = [0 0 0 ; 0 0 -0.9 ; 0 -1 0]
d = [0, 0, 2.0]
=#
n
=
length
(
d
)
AB
=
A
+
B
C0
=
AB
q0
=
qr
(
C0
,
Val
(
true
))
println
(
"q0.R"
)
display
(
q0
.
R
)
Zn
=
zeros
(
n
,
n
)
C1
=
vcat
(
hcat
(
AB
,
Zn
),
hcat
(
AB
,
A
))
display
(
C1
)
d1
=
vcat
(
d
,
d
)
q1
=
qr
(
C1
,
Val
(
true
))
qd1
=
q1
.
Q
'
*
d1
k
=
findall
(
abs
.
(
diag
(
q1
.
R
))
.>
1e-12
)
Q
=
q1
.
Q
[
k
,
k
]
R
=
q1
.
R
[
k
,
k
]
P
=
q1
.
P
[
:
,
k
]
@show
P
*
(
R
\
qd1
[
k
])
balanced_growth_path
(
A
+
B
,
A
,
d
)
src/checks.jl
0 → 100644
View file @
6ad9c9ed
function
is_jacobian_full_rank
(
jacobian
)
return
rank
(
jacobian
)
==
size
(
jacobian
,
1
)
end
src/
parser/
deterministic_trends.jl
→
src/deterministic_trends.jl
View file @
6ad9c9ed
File moved
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment