Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
4bee919c
Verified
Commit
4bee919c
authored
1 year ago
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
sim1_lbj.m: misc cosmetic changes
parent
158b7462
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/perfect-foresight-models/sim1_lbj.m
+14
-28
14 additions, 28 deletions
matlab/perfect-foresight-models/sim1_lbj.m
with
14 additions
and
28 deletions
matlab/perfect-foresight-models/sim1_lbj.m
+
14
−
28
View file @
4bee919c
...
@@ -41,12 +41,12 @@ nrs = ny+nyp+nyf+1;
...
@@ -41,12 +41,12 @@ nrs = ny+nyp+nyf+1;
nrc
=
nyf
+
1
;
nrc
=
nyf
+
1
;
iyf
=
find
(
lead_lag_incidence
(
3
,:)
>
0
);
iyf
=
find
(
lead_lag_incidence
(
3
,:)
>
0
);
iyp
=
find
(
lead_lag_incidence
(
1
,:)
>
0
);
iyp
=
find
(
lead_lag_incidence
(
1
,:)
>
0
);
isp
=
[
1
:
nyp
]
;
isp
=
1
:
nyp
;
is
=
[
nyp
+
1
:
ny
+
nyp
]
;
is
=
nyp
+
1
:
ny
+
nyp
;
isf
=
iyf
+
nyp
;
isf
=
iyf
+
nyp
;
isf1
=
[
nyp
+
ny
+
1
:
nyf
+
nyp
+
ny
+
1
]
;
isf1
=
nyp
+
ny
+
1
:
nyf
+
nyp
+
ny
+
1
;
s
top
=
false
;
s
uccess
=
false
;
iz
=
[
1
:
ny
+
nyp
+
nyf
]
;
iz
=
1
:
ny
+
nyp
+
nyf
;
function
[
r
,
g1
]
=
bytecode_wrapper
(
y
,
xpath
,
params
,
ys
,
it_
)
function
[
r
,
g1
]
=
bytecode_wrapper
(
y
,
xpath
,
params
,
ys
,
it_
)
ypath
=
NaN
(
ny
,
3
);
ypath
=
NaN
(
ny
,
3
);
...
@@ -65,24 +65,22 @@ verbose = options_.verbosity;
...
@@ -65,24 +65,22 @@ verbose = options_.verbosity;
if
verbose
if
verbose
printline
(
56
)
printline
(
56
)
disp
([
'MODEL SIMULATION :'
])
fprintf
(
'MODEL SIMULATION :\n'
)
skipline
()
end
end
it_init
=
M_
.
maximum_lag
+
1
;
h1
=
clock
;
h1
=
clock
;
for
iter
=
1
:
options_
.
simul
.
maxit
for
iter
=
1
:
options_
.
simul
.
maxit
h2
=
clock
;
h2
=
clock
;
c
=
zeros
(
ny
*
options_
.
periods
,
nrc
);
c
=
zeros
(
ny
*
options_
.
periods
,
nrc
);
it_
=
it_init
;
it_
=
M_
.
maximum_lag
+
1
;
z
=
[
endogenousvariables
(
iyp
,
it_
-
1
)
;
endogenousvariables
(:,
it_
)
;
endogenousvariables
(
iyf
,
it_
+
1
)];
z
=
[
endogenousvariables
(
iyp
,
it_
-
1
)
;
endogenousvariables
(:,
it_
)
;
endogenousvariables
(
iyf
,
it_
+
1
)];
[
d1
,
jacobian
]
=
dynamicmodel
(
z
,
exogenousvariables
,
M_
.
params
,
steadystate
,
it_
);
[
d1
,
jacobian
]
=
dynamicmodel
(
z
,
exogenousvariables
,
M_
.
params
,
steadystate
,
it_
);
jacobian
=
[
jacobian
(:,
iz
),
-
d1
];
jacobian
=
[
jacobian
(:,
iz
),
-
d1
];
ic
=
[
1
:
ny
]
;
ic
=
1
:
ny
;
icp
=
iyp
;
icp
=
iyp
;
c
(
ic
,:)
=
jacobian
(:,
is
)\
jacobian
(:,
isf1
);
c
(
ic
,:)
=
jacobian
(:,
is
)\
jacobian
(:,
isf1
);
for
it_
=
it_init
+
(
1
:
options_
.
periods
-
1
)
for
it_
=
M_
.
maximum_lag
+
(
2
:
options_
.
periods
)
z
=
[
endogenousvariables
(
iyp
,
it_
-
1
)
;
endogenousvariables
(:,
it_
)
;
endogenousvariables
(
iyf
,
it_
+
1
)];
z
=
[
endogenousvariables
(
iyp
,
it_
-
1
)
;
endogenousvariables
(:,
it_
)
;
endogenousvariables
(
iyf
,
it_
+
1
)];
[
d1
,
jacobian
]
=
dynamicmodel
(
z
,
exogenousvariables
,
M_
.
params
,
steadystate
,
it_
);
[
d1
,
jacobian
]
=
dynamicmodel
(
z
,
exogenousvariables
,
M_
.
params
,
steadystate
,
it_
);
jacobian
=
[
jacobian
(:,
iz
),
-
d1
];
jacobian
=
[
jacobian
(:,
iz
),
-
d1
];
...
@@ -93,35 +91,23 @@ for iter = 1:options_.simul.maxit
...
@@ -93,35 +91,23 @@ for iter = 1:options_.simul.maxit
end
end
c
=
bksup1
(
c
,
ny
,
nrc
,
iyf
,
options_
.
periods
);
c
=
bksup1
(
c
,
ny
,
nrc
,
iyf
,
options_
.
periods
);
c
=
reshape
(
c
,
ny
,
options_
.
periods
);
c
=
reshape
(
c
,
ny
,
options_
.
periods
);
endogenousvariables
(:,
it_init
+
(
0
:
options_
.
periods
-
1
))
=
endogenousvariables
(:,
it_init
+
(
0
:
options_
.
periods
-
1
))
+
c
;
endogenousvariables
(:,
M_
.
maximum_lag
+
(
1
:
options_
.
periods
))
=
endogenousvariables
(:,
M_
.
maximum_lag
+
(
1
:
options_
.
periods
))
+
c
;
err
=
max
(
max
(
abs
(
c
)));
err
=
max
(
max
(
abs
(
c
)));
if
verbose
if
verbose
str
=
sprintf
(
'Iter: %s,\t err. = %s, \t time = %s'
,
num2str
(
iter
),
num2str
(
err
),
num2str
(
etime
(
clock
,
h2
)));
fprintf
(
'Iter: %s,\t err. = %s, \t time = %s\n'
,
num2str
(
iter
),
num2str
(
err
),
num2str
(
etime
(
clock
,
h2
)));
disp
(
str
);
end
end
if
err
<
options_
.
dynatol
.
f
if
err
<
options_
.
dynatol
.
f
stop
=
true
;
if
verbose
skipline
()
disp
(
sprintf
(
'Total time of simulation: %s'
,
num2str
(
etime
(
clock
,
h1
))))
end
success
=
true
;
% Convergency obtained.
success
=
true
;
% Convergency obtained.
break
break
end
end
end
end
if
~
stop
if
verbose
disp
(
sprintf
(
'Total time of simulation: %s.'
,
num2str
(
etime
(
clock
,
h1
))))
disp
(
'Maximum number of iterations is reached (modify option maxit).'
)
end
success
=
false
;
% More iterations are needed.
end
if
verbose
if
verbose
if
stop
fprintf
(
'\nTotal time of simulation: %s\n'
,
num2str
(
etime
(
clock
,
h1
)))
if
success
printline
(
56
)
printline
(
56
)
else
else
disp
(
'Maximum number of iterations is reached (modify option maxit).'
)
printline
(
62
)
printline
(
62
)
end
end
skipline
()
skipline
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment