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
Dynare
preprocessor
Commits
680fb72d
Commit
680fb72d
authored
Sep 27, 2018
by
MichelJuillard
Browse files
allowing for different number of periods in conditional_forecast_path
parent
63a334cf
Pipeline
#69
passed with stage
in 1 minute and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Shocks.cc
View file @
680fb72d
...
...
@@ -450,13 +450,12 @@ ConditionalForecastPathsStatement::checkPass(ModFileStructure &mod_file_struct,
for
(
auto
elem
:
elems
)
// Period1 < Period2, as enforced in ParsingDriver::add_period()
this_path_length
=
max
(
this_path_length
,
elem
.
period2
);
if
(
path_length
==
-
1
)
path_length
=
this_path_length
;
else
if
(
path_length
!=
this_path_length
)
{
cerr
<<
"conditional_forecast_paths: all constrained paths must have the same length!"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
path_length
=
max
(
this_path_length
,
path_length
);
// else if (path_length != this_path_length)
// {
// cerr << "conditional_forecast_paths: all constrained paths must have the same length!" << endl;
// exit(EXIT_FAILURE);
// }
}
}
...
...
@@ -465,7 +464,7 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
{
assert
(
path_length
>
0
);
output
<<
"constrained_vars_ = [];"
<<
endl
<<
"constrained_paths_ =
zeros
("
<<
paths
.
size
()
<<
", "
<<
path_length
<<
");"
<<
endl
;
<<
"constrained_paths_ =
NaN
("
<<
paths
.
size
()
<<
", "
<<
path_length
<<
");"
<<
endl
;
int
k
=
1
;
for
(
auto
it
=
paths
.
begin
();
...
...
@@ -475,7 +474,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
output
<<
"constrained_vars_ = "
<<
symbol_table
.
getTypeSpecificID
(
it
->
first
)
+
1
<<
";"
<<
endl
;
else
output
<<
"constrained_vars_ = [constrained_vars_; "
<<
symbol_table
.
getTypeSpecificID
(
it
->
first
)
+
1
<<
"];"
<<
endl
;
const
vector
<
AbstractShocksStatement
::
DetShockElement
>
&
elems
=
it
->
second
;
for
(
auto
elem
:
elems
)
for
(
int
j
=
elem
.
period1
;
j
<=
elem
.
period2
;
j
++
)
...
...
Sébastien Villemot
@sebastien
mentioned in issue
dynare#699 (closed)
·
Sep 20, 2019
mentioned in issue
dynare#699 (closed)
mentioned in issue dynare#699
Toggle commit list
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