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
eb0ecd4c
Commit
eb0ecd4c
authored
14 years ago
by
Michel Juillard
Committed by
Sébastien Villemot
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Preprocessor: corrected bug on HISTVAL with lags > 1
(manually cherry-picked from
a5b5f399
)
parent
2f250708
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
preprocessor/NumericalInitialization.cc
+19
-3
19 additions, 3 deletions
preprocessor/NumericalInitialization.cc
preprocessor/SymbolTable.cc
+10
-1
10 additions, 1 deletion
preprocessor/SymbolTable.cc
preprocessor/SymbolTable.hh
+8
-1
8 additions, 1 deletion
preprocessor/SymbolTable.hh
with
37 additions
and
5 deletions
preprocessor/NumericalInitialization.cc
+
19
−
3
View file @
eb0ecd4c
...
@@ -175,16 +175,32 @@ HistValStatement::writeOutput(ostream &output, const string &basename) const
...
@@ -175,16 +175,32 @@ HistValStatement::writeOutput(ostream &output, const string &basename) const
{
{
output
<<
"%"
<<
endl
output
<<
"%"
<<
endl
<<
"% HISTVAL instructions"
<<
endl
<<
"% HISTVAL instructions"
<<
endl
<<
"%"
<<
endl
;
<<
"%"
<<
endl
<<
"oo_.endo_simul = zeros(M_.endo_nbr,M_.maximum_lag);"
<<
endl
;
for
(
hist_values_type
::
const_iterator
it
=
hist_values
.
begin
();
for
(
hist_values_type
::
const_iterator
it
=
hist_values
.
begin
();
it
!=
hist_values
.
end
();
it
++
)
it
!=
hist_values
.
end
();
it
++
)
{
{
const
int
&
symb_id
=
it
->
first
.
first
;
int
symb_id
=
it
->
first
.
first
;
const
int
&
lag
=
it
->
first
.
second
;
int
lag
=
it
->
first
.
second
;
const
NodeID
expression
=
it
->
second
;
const
NodeID
expression
=
it
->
second
;
SymbolType
type
=
symbol_table
.
getType
(
symb_id
);
SymbolType
type
=
symbol_table
.
getType
(
symb_id
);
if
(
type
==
eEndogenous
&&
lag
<
0
)
{
const
int
new_symb_id
=
symbol_table
.
searchAuxiliaryVars
(
symb_id
,
lag
);
if
(
new_symb_id
!=
-
1
)
{
symb_id
=
new_symb_id
;
lag
=
0
;
}
else
if
(
symbol_table
.
AuxVarsSize
()
>
0
)
{
cerr
<<
"Histval: this variable doesn't exist with such a lag in the model"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
}
int
tsid
=
symbol_table
.
getTypeSpecificID
(
symb_id
)
+
1
;
int
tsid
=
symbol_table
.
getTypeSpecificID
(
symb_id
)
+
1
;
if
(
type
==
eEndogenous
)
if
(
type
==
eEndogenous
)
...
...
This diff is collapsed.
Click to expand it.
preprocessor/SymbolTable.cc
+
10
−
1
View file @
eb0ecd4c
/*
/*
* Copyright (C) 2003-200
9
Dynare Team
* Copyright (C) 2003-20
1
0 Dynare Team
*
*
* This file is part of Dynare.
* This file is part of Dynare.
*
*
...
@@ -343,6 +343,15 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index) throw (F
...
@@ -343,6 +343,15 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index) throw (F
return
symb_id
;
return
symb_id
;
}
}
int
SymbolTable
::
searchAuxiliaryVars
(
int
orig_symb_id
,
int
orig_lead_lag
)
const
{
for
(
int
i
=
0
;
i
<
aux_vars
.
size
();
++
i
)
if
((
aux_vars
[
i
].
orig_symb_id
==
orig_symb_id
)
&&
(
aux_vars
[
i
].
orig_lead_lag
==
orig_lead_lag
))
return
aux_vars
[
i
].
symb_id
;
return
-
1
;
}
void
void
SymbolTable
::
markPredetermined
(
int
symb_id
)
throw
(
UnknownSymbolIDException
,
FrozenException
)
SymbolTable
::
markPredetermined
(
int
symb_id
)
throw
(
UnknownSymbolIDException
,
FrozenException
)
{
{
...
...
This diff is collapsed.
Click to expand it.
preprocessor/SymbolTable.hh
+
8
−
1
View file @
eb0ecd4c
/*
/*
* Copyright (C) 2003-200
9
Dynare Team
* Copyright (C) 2003-20
1
0 Dynare Team
*
*
* This file is part of Dynare.
* This file is part of Dynare.
*
*
...
@@ -191,6 +191,13 @@ public:
...
@@ -191,6 +191,13 @@ public:
\return the symbol ID of the new symbol
\return the symbol ID of the new symbol
*/
*/
int
addExpectationAuxiliaryVar
(
int
information_set
,
int
index
)
throw
(
FrozenException
);
int
addExpectationAuxiliaryVar
(
int
information_set
,
int
index
)
throw
(
FrozenException
);
//! Searches auxiliary variables by symbol_id and lead_lag
/*!
\return the symbol ID of the auxiliary variable and -1 if not found
*/
int
searchAuxiliaryVars
(
int
orig_symb_id
,
int
orig_lead_lag
)
const
;
//! Returns the number of auxiliary variables
int
AuxVarsSize
()
const
{
return
aux_vars
.
size
();};
//! Tests if symbol already exists
//! Tests if symbol already exists
inline
bool
exists
(
const
string
&
name
)
const
;
inline
bool
exists
(
const
string
&
name
)
const
;
//! Get symbol name (by ID)
//! Get symbol name (by ID)
...
...
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