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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
3b64c37c
Commit
3b64c37c
authored
9 years ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
Update information in M_ if discretionary_policy_1.m changes lead_lag_incidence
parent
9d90a204
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/discretionary_policy_1.m
+33
-7
33 additions, 7 deletions
matlab/discretionary_policy_1.m
with
33 additions
and
7 deletions
matlab/discretionary_policy_1.m
+
33
−
7
View file @
3b64c37c
function
[
dr
,
ys
,
info
]
=
discretionary_policy_1
(
oo_
,
Instruments
)
function
[
dr
,
ys
,
info
]
=
discretionary_policy_1
(
oo_
,
Instruments
)
% Copyright (C) 2007-201
2
Dynare Team
% Copyright (C) 2007-201
5
Dynare Team
%
%
% This file is part of Dynare.
% This file is part of Dynare.
%
%
...
@@ -88,6 +88,7 @@ end
...
@@ -88,6 +88,7 @@ end
eq_nbr
=
size
(
jacobia_
,
1
);
eq_nbr
=
size
(
jacobia_
,
1
);
instr_nbr
=
endo_nbr
-
eq_nbr
;
instr_nbr
=
endo_nbr
-
eq_nbr
;
instr_id
=
nan
(
instr_nbr
,
1
);
instr_id
=
nan
(
instr_nbr
,
1
);
for
j
=
1
:
instr_nbr
for
j
=
1
:
instr_nbr
vj
=
deblank
(
Instruments
(
j
,:));
vj
=
deblank
(
Instruments
(
j
,:));
...
@@ -126,24 +127,49 @@ if info
...
@@ -126,24 +127,49 @@ if info
dr
=
[];
dr
=
[];
return
return
else
else
Hold
=
H
;
Hold
=
H
;
%save previous solution
% Hold=[]; use this line if persistent command is not used.
% Hold=[]; use this line if persistent command is not used.
end
end
% update the following elements
% update the following elements
LLI
=
lead_lag_incidence
;
LLI
=
lead_lag_incidence
;
LLI
(
MaxLag
,:)
=
any
(
H
);
LLI
(
MaxLag
,:)
=
any
(
H
);
%check if variable drops out in solution
LLI
=
LLI
'
;
LLI
=
LLI
'
;
tmp
=
find
(
LLI
);
tmp
=
find
(
LLI
);
LLI
(
tmp
)
=
1
:
numel
(
tmp
);
LLI
(
tmp
)
=
1
:
numel
(
tmp
);
%renumber
M_
.
lead_lag_incidence
=
LLI
'
;
%update lead_lag_incidence
M_
.
lead_lag_incidence
=
LLI
'
;
%update info in M_
max_lag
=
M_
.
maximum_endo_lag
;
endo_nbr
=
M_
.
endo_nbr
;
lead_lag_incidence
=
M_
.
lead_lag_incidence
;
fwrd_var
=
find
(
lead_lag_incidence
(
max_lag
+
2
:
end
,:))
'
;
if
max_lag
>
0
pred_var
=
find
(
lead_lag_incidence
(
1
,:))
'
;
both_var
=
intersect
(
pred_var
,
fwrd_var
);
pred_var
=
setdiff
(
pred_var
,
both_var
);
fwrd_var
=
setdiff
(
fwrd_var
,
both_var
);
stat_var
=
setdiff
([
1
:
endo_nbr
]
'
,
union
(
union
(
pred_var
,
both_var
),
fwrd_var
));
% static variables
else
pred_var
=
[];
both_var
=
[];
stat_var
=
setdiff
([
1
:
endo_nbr
]
'
,
fwrd_var
);
end
M_
.
nstatic
=
length
(
stat_var
);
M_
.
nfwrd
=
length
(
fwrd_var
);
M_
.
npred
=
length
(
pred_var
);
M_
.
nboth
=
length
(
both_var
);
M_
.
nspred
=
M_
.
npred
+
M_
.
nboth
;
M_
.
nsfwrd
=
M_
.
nfwrd
+
M_
.
nboth
;
M_
.
ndynamic
=
M_
.
endo_nbr
-
M_
.
nstatic
;
% set the state
% set the state
dr
=
oo_
.
dr
;
dr
=
oo_
.
dr
;
dr
.
ys
=
zeros
(
endo_nbr
,
1
);
dr
.
ys
=
zeros
(
endo_nbr
,
1
);
dr
=
set_state_space
(
dr
,
M_
,
options_
);
dr
=
set_state_space
(
dr
,
M_
,
options_
);
%relies on M_.lead_lag_incidence being updated
order_var
=
dr
.
order_var
;
order_var
=
dr
.
order_var
;
T
=
H
(
order_var
,
order_var
);
T
=
H
(
order_var
,
order_var
);
...
...
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