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
c8fdd5d9
Commit
c8fdd5d9
authored
Sep 16, 2010
by
Sébastien Villemot
Browse files
Preprocessor: uniformize typedef names (with a "_t" suffix)
parent
c3c8fa5c
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
CodeInterpreter.hh
View file @
c8fdd5d9
...
...
@@ -999,7 +999,7 @@ public:
};
#ifdef BYTE_CODE
typedef
vector
<
pair
<
Tags
,
void
*
>
>
tags_liste_t
ype
;
typedef
vector
<
pair
<
Tags
,
void
*
>
>
tags_liste_t
;
class
CodeLoad
{
private:
...
...
@@ -1017,10 +1017,10 @@ public:
{
return
code
;
};
inline
tags_liste_t
ype
inline
tags_liste_t
get_op_code
(
string
file_name
)
{
tags_liste_t
ype
tags_liste
;
tags_liste_t
tags_liste
;
ifstream
CompiledCode
;
streamoff
Code_Size
;
CompiledCode
.
open
((
file_name
+
".cod"
).
c_str
(),
std
::
ios
::
in
|
std
::
ios
::
binary
|
std
::
ios
::
ate
);
...
...
ComputingTasks.cc
View file @
c8fdd5d9
...
...
@@ -112,7 +112,7 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct)
mod_file_struct
.
stoch_simul_present
=
true
;
// Fill in option_order of mod_file_struct
OptionsList
::
num_options_t
ype
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
OptionsList
::
num_options_t
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
if
(
it
!=
options_list
.
num_options
.
end
())
mod_file_struct
.
order_option
=
max
(
mod_file_struct
.
order_option
,
atoi
(
it
->
second
.
c_str
()));
...
...
@@ -175,7 +175,7 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct)
/* Fill in option_order of mod_file_struct
Since ramsey policy needs one further order of derivation (for example, for 1st order
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
OptionsList
::
num_options_t
ype
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
OptionsList
::
num_options_t
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
if
(
it
!=
options_list
.
num_options
.
end
())
{
int
order
=
atoi
(
it
->
second
.
c_str
());
...
...
@@ -222,7 +222,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct)
mod_file_struct
.
estimation_present
=
true
;
// Fill in option_order of mod_file_struct
OptionsList
::
num_options_t
ype
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
OptionsList
::
num_options_t
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
if
(
it
!=
options_list
.
num_options
.
end
())
mod_file_struct
.
order_option
=
max
(
mod_file_struct
.
order_option
,
atoi
(
it
->
second
.
c_str
()));
...
...
@@ -237,7 +237,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct)
mod_file_struct
.
dsge_var_calibrated
=
it
->
second
;
// Fill in mod_file_struct.dsge_var_estimated
OptionsList
::
string_options_t
ype
::
const_iterator
it_str
=
options_list
.
string_options
.
find
(
"dsge_var"
);
OptionsList
::
string_options_t
::
const_iterator
it_str
=
options_list
.
string_options
.
find
(
"dsge_var"
);
if
(
it_str
!=
options_list
.
string_options
.
end
())
mod_file_struct
.
dsge_var_estimated
=
true
;
...
...
@@ -280,7 +280,7 @@ DynareSensitivityStatement::DynareSensitivityStatement(const OptionsList &option
void
DynareSensitivityStatement
::
checkPass
(
ModFileStructure
&
mod_file_struct
)
{
OptionsList
::
num_options_t
ype
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"identification"
);
OptionsList
::
num_options_t
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"identification"
);
if
(
it
!=
options_list
.
num_options
.
end
()
&&
it
->
second
==
"1"
)
mod_file_struct
.
identification_present
=
true
;
...
...
@@ -366,8 +366,8 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct)
if
(
it
->
prior
==
"1"
)
//BETA_PDF is associated with "1" in DynareBison.yy
try
{
if
(
it
->
mean
->
eval
(
eval_context_t
ype
())
==
0.5
&&
it
->
std
->
eval
(
eval_context_t
ype
())
==
0.5
)
if
(
it
->
mean
->
eval
(
eval_context_t
())
==
0.5
&&
it
->
std
->
eval
(
eval_context_t
())
==
0.5
)
{
cerr
<<
"ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5."
<<
endl
;
exit
(
EXIT_FAILURE
);
...
...
@@ -586,7 +586,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
}
}
ObservationTrendsStatement
::
ObservationTrendsStatement
(
const
trend_elements_t
ype
&
trend_elements_arg
,
ObservationTrendsStatement
::
ObservationTrendsStatement
(
const
trend_elements_t
&
trend_elements_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
trend_elements
(
trend_elements_arg
),
symbol_table
(
symbol_table_arg
)
...
...
@@ -598,7 +598,7 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename)
{
output
<<
"options_.trend_coeff_ = {};"
<<
endl
;
trend_elements_t
ype
::
const_iterator
it
;
trend_elements_t
::
const_iterator
it
;
for
(
it
=
trend_elements
.
begin
();
it
!=
trend_elements
.
end
();
it
++
)
{
...
...
@@ -615,9 +615,9 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename)
}
}
CalibVarStatement
::
CalibVarStatement
(
const
calib_var_t
ype
&
calib_var_arg
,
const
calib_covar_t
ype
&
calib_covar_arg
,
const
calib_ac_t
ype
&
calib_ac_arg
,
CalibVarStatement
::
CalibVarStatement
(
const
calib_var_t
&
calib_var_arg
,
const
calib_covar_t
&
calib_covar_arg
,
const
calib_ac_t
&
calib_ac_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
calib_var
(
calib_var_arg
),
calib_covar
(
calib_covar_arg
),
...
...
@@ -642,7 +642,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
}
// Print calibration variances
for
(
calib_var_t
ype
::
const_iterator
it
=
calib_var
.
begin
();
for
(
calib_var_t
::
const_iterator
it
=
calib_var
.
begin
();
it
!=
calib_var
.
end
();
it
++
)
{
const
string
&
name
=
it
->
first
;
...
...
@@ -669,7 +669,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
}
// Print calibration covariances
for
(
calib_covar_t
ype
::
const_iterator
it
=
calib_covar
.
begin
();
for
(
calib_covar_t
::
const_iterator
it
=
calib_covar
.
begin
();
it
!=
calib_covar
.
end
();
it
++
)
{
const
string
&
name1
=
it
->
first
.
first
;
...
...
@@ -700,7 +700,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
// Print calibration autocorrelations
int
max_iar
=
3
;
for
(
calib_ac_t
ype
::
const_iterator
it
=
calib_ac
.
begin
();
for
(
calib_ac_t
::
const_iterator
it
=
calib_ac
.
begin
();
it
!=
calib_ac
.
end
();
it
++
)
{
const
string
&
name
=
it
->
first
.
first
;
...
...
@@ -764,7 +764,7 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct)
mod_file_struct
.
osr_present
=
true
;
// Fill in option_order of mod_file_struct
OptionsList
::
num_options_t
ype
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
OptionsList
::
num_options_t
::
const_iterator
it
=
options_list
.
num_options
.
find
(
"order"
);
if
(
it
!=
options_list
.
num_options
.
end
())
mod_file_struct
.
order_option
=
max
(
mod_file_struct
.
order_option
,
atoi
(
it
->
second
.
c_str
()));
...
...
@@ -788,8 +788,8 @@ OsrStatement::writeOutput(ostream &output, const string &basename) const
output
<<
"osr(var_list_,osr_params_,obj_var_,optim_weights_);
\n
"
;
}
OptimWeightsStatement
::
OptimWeightsStatement
(
const
var_weights_t
ype
&
var_weights_arg
,
const
covar_weights_t
ype
&
covar_weights_arg
,
OptimWeightsStatement
::
OptimWeightsStatement
(
const
var_weights_t
&
var_weights_arg
,
const
covar_weights_t
&
covar_weights_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
var_weights
(
var_weights_arg
),
covar_weights
(
covar_weights_arg
),
...
...
@@ -806,7 +806,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
<<
"optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);"
<<
endl
<<
"obj_var_ = [];"
<<
endl
<<
endl
;
for
(
var_weights_t
ype
::
const_iterator
it
=
var_weights
.
begin
();
for
(
var_weights_t
::
const_iterator
it
=
var_weights
.
begin
();
it
!=
var_weights
.
end
();
it
++
)
{
const
string
&
name
=
it
->
first
;
...
...
@@ -818,7 +818,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
output
<<
"obj_var_ = [obj_var_; "
<<
id
<<
"];
\n
"
;
}
for
(
covar_weights_t
ype
::
const_iterator
it
=
covar_weights
.
begin
();
for
(
covar_weights_t
::
const_iterator
it
=
covar_weights
.
begin
();
it
!=
covar_weights
.
end
();
it
++
)
{
const
string
&
name1
=
it
->
first
.
first
;
...
...
@@ -863,7 +863,7 @@ DynaTypeStatement::writeOutput(ostream &output, const string &basename) const
<<
"',var_list_);"
<<
endl
;
}
ModelComparisonStatement
::
ModelComparisonStatement
(
const
filename_list_t
ype
&
filename_list_arg
,
ModelComparisonStatement
::
ModelComparisonStatement
(
const
filename_list_t
&
filename_list_arg
,
const
OptionsList
&
options_list_arg
)
:
filename_list
(
filename_list_arg
),
options_list
(
options_list_arg
)
...
...
@@ -878,7 +878,7 @@ ModelComparisonStatement::writeOutput(ostream &output, const string &basename) c
output
<<
"ModelNames_ = {};"
<<
endl
;
output
<<
"ModelPriors_ = [];"
<<
endl
;
for
(
filename_list_t
ype
::
const_iterator
it
=
filename_list
.
begin
();
for
(
filename_list_t
::
const_iterator
it
=
filename_list
.
begin
();
it
!=
filename_list
.
end
();
it
++
)
{
output
<<
"ModelNames_ = { ModelNames_{:} '"
<<
(
*
it
).
first
<<
"'};"
<<
endl
;
...
...
@@ -906,7 +906,7 @@ PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct)
void
PlannerObjectiveStatement
::
computingPass
()
{
model_tree
->
computingPass
(
eval_context_t
ype
(),
false
,
true
,
false
,
false
);
model_tree
->
computingPass
(
eval_context_t
(),
false
,
true
,
false
,
false
);
}
void
...
...
@@ -1072,7 +1072,7 @@ PlotConditionalForecastStatement::writeOutput(ostream &output, const string &bas
output
<<
"plot_icforecast(var_list_, "
<<
periods
<<
");"
<<
endl
;
}
SvarIdentificationStatement
::
SvarIdentificationStatement
(
const
svar_identification_exclusion_t
ype
&
exclusion_arg
,
SvarIdentificationStatement
::
SvarIdentificationStatement
(
const
svar_identification_exclusion_t
&
exclusion_arg
,
const
bool
&
upper_cholesky_present_arg
,
const
bool
&
lower_cholesky_present_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
...
...
@@ -1087,7 +1087,7 @@ int
SvarIdentificationStatement
::
getMaxLag
()
const
{
int
max_lag
=
0
;
for
(
svar_identification_exclusion_t
ype
::
const_iterator
it
=
exclusion
.
begin
();
it
!=
exclusion
.
end
();
it
++
)
for
(
svar_identification_exclusion_t
::
const_iterator
it
=
exclusion
.
begin
();
it
!=
exclusion
.
end
();
it
++
)
if
(
it
->
first
.
first
>
max_lag
)
max_lag
=
it
->
first
.
first
;
...
...
@@ -1151,7 +1151,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
output
<<
"options_.ms.Qi = zeros("
<<
n
<<
", "
<<
n
<<
", "
<<
n
<<
");"
<<
endl
;
output
<<
"options_.ms.Ri = zeros("
<<
k
<<
", "
<<
k
<<
", "
<<
n
<<
");"
<<
endl
;
for
(
svar_identification_exclusion_t
ype
::
const_iterator
it
=
exclusion
.
begin
();
it
!=
exclusion
.
end
();
it
++
)
for
(
svar_identification_exclusion_t
::
const_iterator
it
=
exclusion
.
begin
();
it
!=
exclusion
.
end
();
it
++
)
{
for
(
unsigned
int
h
=
0
;
h
<
it
->
second
.
size
();
h
++
)
{
...
...
@@ -1197,7 +1197,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li
void
MarkovSwitchingStatement
::
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
{
OptionsList
::
num_options_t
ype
::
const_iterator
itChain
,
itState
,
itNOS
,
itDuration
;
OptionsList
::
num_options_t
::
const_iterator
itChain
,
itState
,
itNOS
,
itDuration
;
itChain
=
options_list
.
num_options
.
find
(
"ms.chain"
);
if
(
itChain
==
options_list
.
num_options
.
end
())
...
...
@@ -1237,8 +1237,8 @@ SvarStatement::SvarStatement(const OptionsList &options_list_arg) :
void
SvarStatement
::
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
{
OptionsList
::
num_options_t
ype
::
const_iterator
it0
,
it1
,
it2
;
OptionsList
::
vec_int_options_t
ype
::
const_iterator
itv
;
OptionsList
::
num_options_t
::
const_iterator
it0
,
it1
,
it2
;
OptionsList
::
vec_int_options_t
::
const_iterator
itv
;
it0
=
options_list
.
num_options
.
find
(
"ms.chain"
);
if
(
it0
!=
options_list
.
num_options
.
end
())
...
...
ComputingTasks.hh
View file @
c8fdd5d9
...
...
@@ -169,12 +169,12 @@ public:
class
ObservationTrendsStatement
:
public
Statement
{
public:
typedef
map
<
string
,
NodeID
>
trend_elements_t
ype
;
typedef
map
<
string
,
NodeID
>
trend_elements_t
;
private:
const
trend_elements_t
ype
trend_elements
;
const
trend_elements_t
trend_elements
;
const
SymbolTable
&
symbol_table
;
public:
ObservationTrendsStatement
(
const
trend_elements_t
ype
&
trend_elements_arg
,
ObservationTrendsStatement
(
const
trend_elements_t
&
trend_elements_arg
,
const
SymbolTable
&
symbol_table_arg
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
;
};
...
...
@@ -225,12 +225,12 @@ public:
class
ModelComparisonStatement
:
public
Statement
{
public:
typedef
vector
<
pair
<
string
,
string
>
>
filename_list_t
ype
;
typedef
vector
<
pair
<
string
,
string
>
>
filename_list_t
;
private:
filename_list_t
ype
filename_list
;
filename_list_t
filename_list
;
OptionsList
options_list
;
public:
ModelComparisonStatement
(
const
filename_list_t
ype
&
filename_list_arg
,
ModelComparisonStatement
(
const
filename_list_t
&
filename_list_arg
,
const
OptionsList
&
options_list_arg
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
;
};
...
...
@@ -298,15 +298,15 @@ public:
class
OptimWeightsStatement
:
public
Statement
{
public:
typedef
map
<
string
,
NodeID
>
var_weights_t
ype
;
typedef
map
<
pair
<
string
,
string
>
,
NodeID
>
covar_weights_t
ype
;
typedef
map
<
string
,
NodeID
>
var_weights_t
;
typedef
map
<
pair
<
string
,
string
>
,
NodeID
>
covar_weights_t
;
private:
const
var_weights_t
ype
var_weights
;
const
covar_weights_t
ype
covar_weights
;
const
var_weights_t
var_weights
;
const
covar_weights_t
covar_weights
;
const
SymbolTable
&
symbol_table
;
public:
OptimWeightsStatement
(
const
var_weights_t
ype
&
var_weights_arg
,
const
covar_weights_t
ype
&
covar_weights_arg
,
OptimWeightsStatement
(
const
var_weights_t
&
var_weights_arg
,
const
covar_weights_t
&
covar_weights_arg
,
const
SymbolTable
&
symbol_table_arg
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
;
};
...
...
@@ -324,20 +324,20 @@ class CalibVarStatement : public Statement
{
public:
//! Maps a variable to a pair (weight, expression)
typedef
map
<
string
,
pair
<
string
,
NodeID
>
>
calib_var_t
ype
;
typedef
map
<
string
,
pair
<
string
,
NodeID
>
>
calib_var_t
;
//! Maps a pair of variables to a pair (weight, expression)
typedef
map
<
pair
<
string
,
string
>
,
pair
<
string
,
NodeID
>
>
calib_covar_t
ype
;
typedef
map
<
pair
<
string
,
string
>
,
pair
<
string
,
NodeID
>
>
calib_covar_t
;
//! Maps a pair (variable, autocorr) to a pair (weight, expression)
typedef
map
<
pair
<
string
,
int
>
,
pair
<
string
,
NodeID
>
>
calib_ac_t
ype
;
typedef
map
<
pair
<
string
,
int
>
,
pair
<
string
,
NodeID
>
>
calib_ac_t
;
private:
const
calib_var_t
ype
calib_var
;
const
calib_covar_t
ype
calib_covar
;
const
calib_ac_t
ype
calib_ac
;
const
calib_var_t
calib_var
;
const
calib_covar_t
calib_covar
;
const
calib_ac_t
calib_ac
;
const
SymbolTable
&
symbol_table
;
public:
CalibVarStatement
(
const
calib_var_t
ype
&
calib_var_arg
,
const
calib_covar_t
ype
&
calib_covar_arg
,
const
calib_ac_t
ype
&
calib_ac_arg
,
CalibVarStatement
(
const
calib_var_t
&
calib_var_arg
,
const
calib_covar_t
&
calib_covar_arg
,
const
calib_ac_t
&
calib_ac_arg
,
const
SymbolTable
&
symbol_table_arg
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
;
};
...
...
@@ -465,15 +465,15 @@ public:
class
SvarIdentificationStatement
:
public
Statement
{
public:
typedef
map
<
pair
<
int
,
int
>
,
vector
<
int
>
>
svar_identification_exclusion_t
ype
;
typedef
map
<
pair
<
int
,
int
>
,
vector
<
int
>
>
svar_identification_exclusion_t
;
private:
const
svar_identification_exclusion_t
ype
exclusion
;
const
svar_identification_exclusion_t
exclusion
;
const
bool
upper_cholesky_present
;
const
bool
lower_cholesky_present
;
const
SymbolTable
&
symbol_table
;
int
getMaxLag
()
const
;
public:
SvarIdentificationStatement
(
const
svar_identification_exclusion_t
ype
&
exclusion_arg
,
SvarIdentificationStatement
(
const
svar_identification_exclusion_t
&
exclusion_arg
,
const
bool
&
upper_cholesky_present_arg
,
const
bool
&
lower_cholesky_present_arg
,
const
SymbolTable
&
symbol_table_arg
);
...
...
DataTree.cc
View file @
c8fdd5d9
...
...
@@ -46,7 +46,7 @@ DataTree::DataTree(SymbolTable &symbol_table_arg,
DataTree
::~
DataTree
()
{
for
(
node_list_t
ype
::
iterator
it
=
node_list
.
begin
();
it
!=
node_list
.
end
();
it
++
)
for
(
node_list_t
::
iterator
it
=
node_list
.
begin
();
it
!=
node_list
.
end
();
it
++
)
delete
*
it
;
}
...
...
@@ -55,7 +55,7 @@ DataTree::AddNumConstant(const string &value)
{
int
id
=
num_constants
.
AddConstant
(
value
);
num_const_node_map_t
ype
::
iterator
it
=
num_const_node_map
.
find
(
id
);
num_const_node_map_t
::
iterator
it
=
num_const_node_map
.
find
(
id
);
if
(
it
!=
num_const_node_map
.
end
())
return
it
->
second
;
else
...
...
@@ -65,7 +65,7 @@ DataTree::AddNumConstant(const string &value)
VariableNode
*
DataTree
::
AddVariableInternal
(
int
symb_id
,
int
lag
)
{
variable_node_map_t
ype
::
iterator
it
=
variable_node_map
.
find
(
make_pair
(
symb_id
,
lag
));
variable_node_map_t
::
iterator
it
=
variable_node_map
.
find
(
make_pair
(
symb_id
,
lag
));
if
(
it
!=
variable_node_map
.
end
())
return
it
->
second
;
else
...
...
@@ -467,7 +467,7 @@ DataTree::AddExternalFunction(int symb_id, const vector<NodeID> &arguments)
{
assert
(
symbol_table
.
getType
(
symb_id
)
==
eExternalFunction
);
external_function_node_map_t
ype
::
iterator
it
=
external_function_node_map
.
find
(
make_pair
(
arguments
,
symb_id
));
external_function_node_map_t
::
iterator
it
=
external_function_node_map
.
find
(
make_pair
(
arguments
,
symb_id
));
if
(
it
!=
external_function_node_map
.
end
())
return
it
->
second
;
...
...
@@ -479,7 +479,7 @@ DataTree::AddFirstDerivExternalFunctionNode(int top_level_symb_id, const vector<
{
assert
(
symbol_table
.
getType
(
top_level_symb_id
)
==
eExternalFunction
);
first_deriv_external_function_node_map_t
ype
::
iterator
it
=
first_deriv_external_function_node_map_t
::
iterator
it
=
first_deriv_external_function_node_map
.
find
(
make_pair
(
make_pair
(
arguments
,
input_index
),
top_level_symb_id
));
if
(
it
!=
first_deriv_external_function_node_map
.
end
())
...
...
@@ -493,7 +493,7 @@ DataTree::AddSecondDerivExternalFunctionNode(int top_level_symb_id, const vector
{
assert
(
symbol_table
.
getType
(
top_level_symb_id
)
==
eExternalFunction
);
second_deriv_external_function_node_map_t
ype
::
iterator
it
=
second_deriv_external_function_node_map_t
::
iterator
it
=
second_deriv_external_function_node_map
.
find
(
make_pair
(
make_pair
(
arguments
,
make_pair
(
input_index1
,
input_index2
)),
top_level_symb_id
));
...
...
@@ -506,7 +506,7 @@ DataTree::AddSecondDerivExternalFunctionNode(int top_level_symb_id, const vector
bool
DataTree
::
isSymbolUsed
(
int
symb_id
)
const
{
for
(
variable_node_map_t
ype
::
const_iterator
it
=
variable_node_map
.
begin
();
for
(
variable_node_map_t
::
const_iterator
it
=
variable_node_map
.
begin
();
it
!=
variable_node_map
.
end
();
it
++
)
if
(
it
->
first
.
first
==
symb_id
)
return
true
;
...
...
@@ -532,7 +532,7 @@ DataTree::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException)
bool
DataTree
::
isUnaryOpUsed
(
UnaryOpcode
opcode
)
const
{
for
(
unary_op_node_map_t
ype
::
const_iterator
it
=
unary_op_node_map
.
begin
();
for
(
unary_op_node_map_t
::
const_iterator
it
=
unary_op_node_map
.
begin
();
it
!=
unary_op_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
opcode
)
return
true
;
...
...
@@ -543,7 +543,7 @@ DataTree::isUnaryOpUsed(UnaryOpcode opcode) const
bool
DataTree
::
isBinaryOpUsed
(
BinaryOpcode
opcode
)
const
{
for
(
binary_op_node_map_t
ype
::
const_iterator
it
=
binary_op_node_map
.
begin
();
for
(
binary_op_node_map_t
::
const_iterator
it
=
binary_op_node_map
.
begin
();
it
!=
binary_op_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
opcode
)
return
true
;
...
...
@@ -554,7 +554,7 @@ DataTree::isBinaryOpUsed(BinaryOpcode opcode) const
bool
DataTree
::
isTrinaryOpUsed
(
TrinaryOpcode
opcode
)
const
{
for
(
trinary_op_node_map_t
ype
::
const_iterator
it
=
trinary_op_node_map
.
begin
();
for
(
trinary_op_node_map_t
::
const_iterator
it
=
trinary_op_node_map
.
begin
();
it
!=
trinary_op_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
opcode
)
return
true
;
...
...
@@ -565,7 +565,7 @@ DataTree::isTrinaryOpUsed(TrinaryOpcode opcode) const
bool
DataTree
::
isExternalFunctionUsed
(
int
symb_id
)
const
{
for
(
external_function_node_map_t
ype
::
const_iterator
it
=
external_function_node_map
.
begin
();
for
(
external_function_node_map_t
::
const_iterator
it
=
external_function_node_map
.
begin
();
it
!=
external_function_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
symb_id
)
return
true
;
...
...
@@ -576,7 +576,7 @@ DataTree::isExternalFunctionUsed(int symb_id) const
bool
DataTree
::
isFirstDerivExternalFunctionUsed
(
int
symb_id
)
const
{
for
(
first_deriv_external_function_node_map_t
ype
::
const_iterator
it
=
first_deriv_external_function_node_map
.
begin
();
for
(
first_deriv_external_function_node_map_t
::
const_iterator
it
=
first_deriv_external_function_node_map
.
begin
();
it
!=
first_deriv_external_function_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
symb_id
)
return
true
;
...
...
@@ -587,7 +587,7 @@ DataTree::isFirstDerivExternalFunctionUsed(int symb_id) const
bool
DataTree
::
isSecondDerivExternalFunctionUsed
(
int
symb_id
)
const
{
for
(
second_deriv_external_function_node_map_t
ype
::
const_iterator
it
=
second_deriv_external_function_node_map
.
begin
();
for
(
second_deriv_external_function_node_map_t
::
const_iterator
it
=
second_deriv_external_function_node_map
.
begin
();
it
!=
second_deriv_external_function_node_map
.
end
();
it
++
)
if
(
it
->
first
.
second
==
symb_id
)
return
true
;
...
...
DataTree.hh
View file @
c8fdd5d9
...
...
@@ -54,23 +54,23 @@ protected:
//! A reference to the external functions table
ExternalFunctionsTable
&
external_functions_table
;
typedef
map
<
int
,
NumConstNode
*>
num_const_node_map_t
ype
;
num_const_node_map_t
ype
num_const_node_map
;
typedef
map
<
int
,
NumConstNode
*>
num_const_node_map_t
;
num_const_node_map_t
num_const_node_map
;
//! Pair (symbol_id, lag) used as key
typedef
map
<
pair
<
int
,
int
>
,
VariableNode
*>
variable_node_map_t
ype
;
variable_node_map_t
ype
variable_node_map
;
typedef
map
<
pair
<
NodeID
,
UnaryOpcode
>
,
UnaryOpNode
*>
unary_op_node_map_t
ype
;
unary_op_node_map_t
ype
unary_op_node_map
;
typedef
map
<
pair
<
pair
<
NodeID
,
NodeID
>
,
BinaryOpcode
>
,
BinaryOpNode
*>
binary_op_node_map_t
ype
;
binary_op_node_map_t
ype
binary_op_node_map
;
typedef
map
<
pair
<
pair
<
pair
<
NodeID
,
NodeID
>
,
NodeID
>
,
TrinaryOpcode
>
,
TrinaryOpNode
*>
trinary_op_node_map_t
ype
;
trinary_op_node_map_t
ype
trinary_op_node_map
;
typedef
map
<
pair
<
vector
<
NodeID
>
,
int
>
,
ExternalFunctionNode
*>
external_function_node_map_t
ype
;
external_function_node_map_t
ype
external_function_node_map
;
typedef
map
<
pair
<
pair
<
vector
<
NodeID
>
,
int
>
,
int
>
,
FirstDerivExternalFunctionNode
*>
first_deriv_external_function_node_map_t
ype
;
first_deriv_external_function_node_map_t
ype
first_deriv_external_function_node_map
;
typedef
map
<
pair
<
pair
<
vector
<
NodeID
>
,
pair
<
int
,
int
>
>
,
int
>
,
SecondDerivExternalFunctionNode
*>
second_deriv_external_function_node_map_t
ype
;
second_deriv_external_function_node_map_t
ype
second_deriv_external_function_node_map
;
typedef
map
<
pair
<
int
,
int
>
,
VariableNode
*>
variable_node_map_t
;
variable_node_map_t
variable_node_map
;
typedef
map
<
pair
<
NodeID
,
UnaryOpcode
>
,
UnaryOpNode
*>
unary_op_node_map_t
;
unary_op_node_map_t
unary_op_node_map
;
typedef
map
<
pair
<
pair
<
NodeID
,
NodeID
>
,
BinaryOpcode
>
,
BinaryOpNode
*>
binary_op_node_map_t
;
binary_op_node_map_t
binary_op_node_map
;
typedef
map
<
pair
<
pair
<
pair
<
NodeID
,
NodeID
>
,
NodeID
>
,
TrinaryOpcode
>
,
TrinaryOpNode
*>
trinary_op_node_map_t
;
trinary_op_node_map_t
trinary_op_node_map
;
typedef
map
<
pair
<
vector
<
NodeID
>
,
int
>
,
ExternalFunctionNode
*>
external_function_node_map_t
;
external_function_node_map_t
external_function_node_map
;
typedef
map
<
pair
<
pair
<
vector
<
NodeID
>
,
int
>
,
int
>
,
FirstDerivExternalFunctionNode
*>
first_deriv_external_function_node_map_t
;
first_deriv_external_function_node_map_t
first_deriv_external_function_node_map
;
typedef
map
<
pair
<
pair
<
vector
<
NodeID
>
,
pair
<
int
,
int
>
>
,
int
>
,
SecondDerivExternalFunctionNode
*>
second_deriv_external_function_node_map_t
;
second_deriv_external_function_node_map_t
second_deriv_external_function_node_map
;
//! Stores local variables value (maps symbol ID to corresponding node)
map
<
int
,
NodeID
>
local_variables_table
;
...
...
@@ -79,9 +79,9 @@ protected:
VariableNode
*
AddVariableInternal
(
int
symb_id
,
int
lag
);
private:
typedef
list
<
NodeID
>
node_list_t
ype
;
typedef
list
<
NodeID
>
node_list_t
;
//! The list of nodes
node_list_t
ype
node_list
;
node_list_t
node_list
;
//! A counter for filling ExprNode's idx field
int
node_counter
;
...
...
@@ -250,7 +250,7 @@ inline NodeID
DataTree
::
AddUnaryOp
(
UnaryOpcode
op_code
,
NodeID
arg
,
int
arg_exp_info_set
,
const
string
&
arg_exp_info_set_name
)
{
// If the node already exists in tree, share it
unary_op_node_map_t
ype
::
iterator
it
=
unary_op_node_map
.
find
(
make_pair
(
arg
,
op_code
));
unary_op_node_map_t
::
iterator
it
=
unary_op_node_map
.
find
(
make_pair
(
arg
,
op_code
));
if
(
it
!=
unary_op_node_map
.
end
())
return
it
->
second
;
...
...
@@ -261,7 +261,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, NodeID arg, int arg_exp_info_set, cons
{
try
{
double
argval
=
arg
->
eval
(
eval_context_t
ype
());
double
argval
=
arg
->
eval
(
eval_context_t
());
double
val
=
UnaryOpNode
::
eval_opcode
(
op_code
,
argval
);
return
AddPossiblyNegativeConstant
(
val
);
}
...
...
@@ -275,15 +275,15 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, NodeID arg, int arg_exp_info_set, cons
inline
NodeID
DataTree
::
AddBinaryOp
(
NodeID
arg1
,
BinaryOpcode
op_code
,
NodeID
arg2
)
{
binary_op_node_map_t
ype
::
iterator
it
=
binary_op_node_map
.
find
(
make_pair
(
make_pair
(
arg1
,
arg2
),
op_code
));
binary_op_node_map_t
::
iterator
it
=
binary_op_node_map
.
find
(
make_pair
(
make_pair
(
arg1
,
arg2
),
op_code
));
if
(
it
!=
binary_op_node_map
.
end
())
return
it
->
second
;
// Try to reduce to a constant
try
{
double
argval1
=
arg1
->
eval
(
eval_context_t
ype
());
double
argval2
=
arg2
->
eval
(
eval_context_t
ype
());
double
argval1
=
arg1
->
eval
(
eval_context_t
());
double
argval2
=
arg2
->
eval
(
eval_context_t
());
double
val
=
BinaryOpNode
::
eval_opcode
(
argval1
,
op_code
,
argval2
);
return
AddPossiblyNegativeConstant
(
val
);
}
...
...
@@ -296,16 +296,16 @@ DataTree::AddBinaryOp(NodeID arg1, BinaryOpcode op_code, NodeID arg2)
inline
NodeID
DataTree
::
AddTrinaryOp
(
NodeID
arg1
,
TrinaryOpcode
op_code
,
NodeID
arg2
,
NodeID
arg3
)
{
trinary_op_node_map_t
ype
::
iterator
it
=
trinary_op_node_map
.
find
(
make_pair
(
make_pair
(
make_pair
(
arg1
,
arg2
),
arg3
),
op_code
));
trinary_op_node_map_t
::
iterator
it
=
trinary_op_node_map
.
find
(
make_pair
(
make_pair
(
make_pair
(
arg1
,
arg2
),
arg3
),
op_code
));
if
(
it
!=
trinary_op_node_map
.
end
())
return
it
->
second
;
// Try to reduce to a constant
try
{
double
argval1
=
arg1
->
eval
(
eval_context_t
ype
());
double
argval2
=
arg2
->
eval
(
eval_context_t
ype
());
double
argval3
=
arg3
->
eval
(
eval_context_t
ype
());
double
argval1
=
arg1
->
eval
(
eval_context_t
());
double
argval2
=
arg2
->
eval
(
eval_context_t
());
double
argval3
=
arg3
->
eval
(
eval_context_t
());
double
val
=
TrinaryOpNode
::
eval_opcode
(
argval1
,
op_code
,
argval2
,
argval3
);
return
AddPossiblyNegativeConstant
(
val
);
}
...
...
DynamicModel.cc
View file @
c8fdd5d9
This diff is collapsed.
Click to expand it.
DynamicModel.hh
View file @
c8fdd5d9
...
...
@@ -62,47 +62,47 @@ private:
Only non-null derivatives are stored in the map.
Parameter indices are those of the getDerivID() method.
*/
first_derivatives_t
ype
residuals_params_derivatives
;
first_derivatives_t
residuals_params_derivatives
;
//! Second derivatives of the residuals w.r. to parameters
/*! First index is equation number, second and third indeces are parameters.
Only non-null derivatives are stored in the map.
Parameter indices are those of the getDerivID() method.
*/
second_derivatives_t
ype
residuals_params_second_derivatives
;
second_derivatives_t
residuals_params_second_derivatives
;
//! Derivatives of the jacobian w.r. to parameters
/*! First index is equation number, second is endo/exo/exo_det variable, and third is parameter.
Only non-null derivatives are stored in the map.
Variable and parameter indices are those of the getDerivID() method.
*/
second_derivatives_t
ype
jacobian_params_derivatives
;
second_derivatives_t
jacobian_params_derivatives
;
//! Second derivatives of the jacobian w.r. to parameters
/*! First index is equation number, second is endo/exo/exo_det variable, and third and fourth are parameters.
Only non-null derivatives are stored in the map.
Variable and parameter indices are those of the getDerivID() method.
*/
third_derivatives_t
ype
jacobian_params_second_derivatives
;
third_derivatives_t
jacobian_params_second_derivatives
;
//! Derivatives of the hessian w.r. to parameters
/*! First index is equation number, first and second are endo/exo/exo_det variable, and third is parameter.
Only non-null derivatives are stored in the map.
Variable and parameter indices are those of the getDerivID() method.
*/
third_derivatives_t
ype
hessian_params_derivatives
;
third_derivatives_t
hessian_params_derivatives
;
//! Temporary terms for the file containing parameters dervicatives
temporary_terms_t
ype
params_derivs_temporary_terms
;
temporary_terms_t
params_derivs_temporary_terms
;
//! Temporary terms for block decomposed models
vector
<
vector
<
temporary_terms_t
ype
>
>
v_temporary_terms
;
vector
<
vector
<
temporary_terms_t
>
>
v_temporary_terms
;
vector
<
temporary_terms_inuse_t
ype
>
v_temporary_terms_inuse
;
vector
<
temporary_terms_inuse_t
>
v_temporary_terms_inuse
;
//! Store the derivatives or the chainrule derivatives:map<pair< equation, pair< variable, lead_lag >, NodeID>