Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
preprocessor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dynare
preprocessor
Commits
469a328c
Verified
Commit
469a328c
authored
Feb 21, 2019
by
Houtan Bastani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace make_pair and make_tuple
parent
b09b5047
Pipeline
#857
passed with stage
in 1 minute and 27 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
34 deletions
+34
-34
src/DynamicModel.cc
src/DynamicModel.cc
+15
-15
src/ExprNode.cc
src/ExprNode.cc
+9
-9
src/ModelEquationBlock.cc
src/ModelEquationBlock.cc
+5
-5
src/ModelTree.cc
src/ModelTree.cc
+2
-2
src/ParsingDriver.cc
src/ParsingDriver.cc
+1
-1
src/StaticModel.cc
src/StaticModel.cc
+2
-2
No files found.
src/DynamicModel.cc
View file @
469a328c
...
...
@@ -57,7 +57,7 @@ DynamicModel::copyHelper(const DynamicModel &m)
first_chain_rule_derivatives
[
it
.
first
]
=
f
(
it
.
second
);
for
(
const
auto
&
it
:
m
.
equation_type_and_normalized_equation
)
equation_type_and_normalized_equation
.
push_back
(
make_pair
(
it
.
first
,
f
(
it
.
second
))
);
equation_type_and_normalized_equation
.
push_back
(
{
it
.
first
,
f
(
it
.
second
)}
);
for
(
const
auto
&
it
:
m
.
blocks_derivatives
)
{
...
...
@@ -3634,7 +3634,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
{
if
(
for_writing
.
find
(
it
.
first
.
first
)
==
for_writing
.
end
())
for_writing
.
insert
(
pair
<
string
,
vector
<
pair
<
string
,
string
>>
>
(
it
.
first
.
first
,
vector
<
pair
<
string
,
string
>>
()));
for_writing
[
it
.
first
.
first
].
push_back
(
make_pair
(
it
.
first
.
second
,
it
.
second
.
first
)
);
for_writing
[
it
.
first
.
first
].
push_back
(
{
it
.
first
.
second
,
it
.
second
.
first
}
);
}
for
(
auto
&
it
:
for_writing
)
...
...
@@ -4436,10 +4436,10 @@ DynamicModel::walkPacParameters(const string &name, map<pair<string, string>, pa
exit
(
EXIT_FAILURE
);
}
string
eq
=
"eq"
+
to_string
(
i
++
);
pac_equation_info
[
make_pair
(
name
,
eq
)]
=
make_tuple
(
lhs
,
optim_share_index
,
ar_params_and_vars
,
ec_params_and_vars
,
non_optim_vars_params_and_constants
)
;
eqtag_and_lag
[
make_pair
(
name
,
eqtag
)]
=
make_pair
(
eq
,
0
)
;
pac_equation_info
[
{
name
,
eq
}]
=
{
lhs
,
optim_share_index
,
ar_params_and_vars
,
ec_params_and_vars
,
non_optim_vars_params_and_constants
}
;
eqtag_and_lag
[
{
name
,
eqtag
}]
=
{
eq
,
0
}
;
}
}
}
...
...
@@ -4467,8 +4467,8 @@ DynamicModel::getPacMaxLag(const string &pac_model_name, map<pair<string, string
eqtag
=
tag
.
second
.
second
;
break
;
}
string
eq
=
eqtag_and_lag
[
make_pair
(
pac_model_name
,
eqtag
)
].
first
;
eqtag_and_lag
[
make_pair
(
pac_model_name
,
eqtag
)]
=
make_pair
(
eq
,
equation
->
PacMaxLag
((
*
(
endogs
.
begin
())).
first
))
;
string
eq
=
eqtag_and_lag
[
{
pac_model_name
,
eqtag
}
].
first
;
eqtag_and_lag
[
{
pac_model_name
,
eqtag
}]
=
{
eq
,
equation
->
PacMaxLag
((
*
(
endogs
.
begin
())).
first
)}
;
}
}
...
...
@@ -4530,7 +4530,7 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
{
int
alpha_i_symb_id
=
symbol_table
.
addSymbol
(
"mce_alpha_"
+
append_to_name
+
"_"
+
to_string
(
i
),
SymbolType
::
parameter
);
pac_mce_alpha_symb_ids
[
make_pair
(
name
,
standard_eqtag
)
].
push_back
(
alpha_i_symb_id
);
pac_mce_alpha_symb_ids
[
{
name
,
standard_eqtag
}
].
push_back
(
alpha_i_symb_id
);
A
=
AddPlus
(
A
,
AddVariable
(
alpha_i_symb_id
));
fp
=
AddPlus
(
fp
,
AddTimes
(
AddTimes
(
AddVariable
(
alpha_i_symb_id
),
...
...
@@ -4598,8 +4598,8 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
addEquation
(
AddEqual
(
AddVariable
(
mce_z1_symb_id
),
AddMinus
(
AddTimes
(
A
,
AddMinus
((
expr_t
)
target_base_diff_node
,
fs
)),
fp
)),
-
1
);
neqs
++
;
pac_mce_z1_symb_ids
[
make_pair
(
name
,
standard_eqtag
)
]
=
mce_z1_symb_id
;
pac_expectation_substitution
[
make_pair
(
name
,
eqtag
)
]
=
AddVariable
(
mce_z1_symb_id
);
pac_mce_z1_symb_ids
[
{
name
,
standard_eqtag
}
]
=
mce_z1_symb_id
;
pac_expectation_substitution
[
{
name
,
eqtag
}
]
=
AddVariable
(
mce_z1_symb_id
);
}
cout
<<
"Pac Model Consistent Expectation: added "
<<
neqs
<<
" auxiliary variables and equations."
<<
endl
;
}
...
...
@@ -4649,7 +4649,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
<<
"_var_"
<<
symbol_table
.
getName
(
lhsit
)
<<
"_lag_"
<<
i
;
int
new_param_symb_id
=
symbol_table
.
addSymbol
(
param_name_h0
.
str
(),
SymbolType
::
parameter
);
pac_h0_indices
[
make_pair
(
pac_model_name
,
standard_eqtag
)
].
push_back
(
new_param_symb_id
);
pac_h0_indices
[
{
pac_model_name
,
standard_eqtag
}
].
push_back
(
new_param_symb_id
);
subExpr
=
AddPlus
(
subExpr
,
AddTimes
(
AddVariable
(
new_param_symb_id
),
AddVariable
(
lhsit
,
-
i
)));
...
...
@@ -4665,7 +4665,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
<<
"_var_"
<<
symbol_table
.
getName
(
lhsit
)
<<
"_lag_"
<<
i
;
int
new_param_symb_id
=
symbol_table
.
addSymbol
(
param_name_h1
.
str
(),
SymbolType
::
parameter
);
pac_h1_indices
[
make_pair
(
pac_model_name
,
standard_eqtag
)
].
push_back
(
new_param_symb_id
);
pac_h1_indices
[
{
pac_model_name
,
standard_eqtag
}
].
push_back
(
new_param_symb_id
);
subExpr
=
AddPlus
(
subExpr
,
AddTimes
(
AddVariable
(
new_param_symb_id
),
AddVariable
(
lhsit
,
-
i
)));
...
...
@@ -4676,9 +4676,9 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
AddTimes
(
AddVariable
(
growth_param_index
),
AddVariable
(
growth_symb_id
,
growth_lag
)));
pac_expectation_substitution
[
make_pair
(
pac_model_name
,
eqtag
)
]
=
subExpr
;
pac_expectation_substitution
[
{
pac_model_name
,
eqtag
}
]
=
subExpr
;
}
pac_model_info
[
pac_model_name
]
=
make_tuple
(
move
(
lhs
),
growth_param_index
,
move
(
aux_model_type
))
;
pac_model_info
[
pac_model_name
]
=
{
move
(
lhs
),
growth_param_index
,
move
(
aux_model_type
)}
;
}
void
...
...
src/ExprNode.cc
View file @
469a328c
...
...
@@ -5772,12 +5772,12 @@ BinaryOpNode::fillAutoregressiveRowHelper(expr_t arg1, expr_t arg2,
if (find(lhs.begin(), lhs.end(), lhs_symb_id) == lhs.end())
return;
if
(
AR
.
find
(
make_tuple
(
eqn
,
-
lag
,
lhs_symb_id
)
)
!=
AR
.
end
())
if (AR.find(
{eqn, -lag, lhs_symb_id}
) != AR.end())
{
cerr << "BinaryOpNode::fillAutoregressiveRowHelper: Error filling AR matrix: lag/symb_id encountered more than once in equtaion" << endl;
exit(EXIT_FAILURE);
}
AR
[
make_tuple
(
eqn
,
-
lag
,
lhs_symb_id
)
]
=
arg1
;
AR[
{eqn, -lag, lhs_symb_id}
] = arg1;
}
void
...
...
@@ -5875,21 +5875,21 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
else
return;
if
(
A0
.
find
(
make_tuple
(
eqn
,
-
A0_max_lag
,
A0_colidx
)
)
!=
A0
.
end
())
if (A0.find(
{eqn, -A0_max_lag, A0_colidx}
) != A0.end())
{
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0 matrix: "
<< "lag/symb_id encountered more than once in equtaion" << endl;
exit(EXIT_FAILURE);
}
if
(
A0star
.
find
(
make_tuple
(
eqn
,
-
A0star_max_lag
,
A0star_colidx
)
)
!=
A0star
.
end
())
if (A0star.find(
{eqn, -A0star_max_lag, A0star_colidx}
) != A0star.end())
{
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0star matrix: "
<< "lag/symb_id encountered more than once in equtaion" << endl;
exit(EXIT_FAILURE);
}
A0
[
make_tuple
(
eqn
,
-
A0_max_lag
,
A0_colidx
)
]
=
arg1
;
A0star
[
make_tuple
(
eqn
,
-
A0star_max_lag
,
A0star_colidx
)
]
=
arg1
;
A0[
{eqn, -A0_max_lag, A0_colidx}
] = arg1;
A0star[
{eqn, -A0star_max_lag, A0star_colidx}
] = arg1;
}
else
{
...
...
@@ -5926,13 +5926,13 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
else
return;
if
(
A0
.
find
(
make_tuple
(
eqn
,
-
max_lag
,
colidx
)
)
!=
A0
.
end
())
if (A0.find(
{eqn, -max_lag, colidx}
) != A0.end())
{
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0 matrix: "
<< "lag/symb_id encountered more than once in equtaion" << endl;
exit(EXIT_FAILURE);
}
A0
[
make_tuple
(
eqn
,
-
max_lag
,
colidx
)
]
=
arg1
;
A0[
{eqn, -max_lag, colidx}
] = arg1;
}
}
...
...
@@ -9624,7 +9624,7 @@ ExprNode::matchVariableTimesConstantTimesParam() const
matchVTCTPHelper(variable_id, lag, param_id, constant, false);
if (variable_id == -1)
throw MatchFailureException{"No variable in this expression"};
return
make_tuple
(
variable_id
,
lag
,
param_id
,
constant
)
;
return
{variable_id, lag, param_id, constant}
;
}
void
...
...
src/ModelEquationBlock.cc
View file @
469a328c
/*
* Copyright (C) 2010-201
8
Dynare Team
* Copyright (C) 2010-201
9
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -36,7 +36,7 @@ SteadyStateModel::SteadyStateModel(const SteadyStateModel &m) :
static_model
{
m
.
static_model
}
{
for
(
const
auto
&
it
:
m
.
def_table
)
def_table
.
push_back
(
make_pair
(
it
.
first
,
it
.
second
->
clone
(
*
this
))
);
def_table
.
push_back
(
{
it
.
first
,
it
.
second
->
clone
(
*
this
)}
);
}
SteadyStateModel
&
...
...
@@ -48,7 +48,7 @@ SteadyStateModel::operator=(const SteadyStateModel &m)
def_table
.
clear
();
for
(
const
auto
&
it
:
m
.
def_table
)
def_table
.
push_back
(
make_pair
(
it
.
first
,
it
.
second
->
clone
(
*
this
))
);
def_table
.
push_back
(
{
it
.
first
,
it
.
second
->
clone
(
*
this
)}
);
return
*
this
;
}
...
...
@@ -298,7 +298,7 @@ Epilogue::Epilogue(const Epilogue &m) :
DynamicModel
{
m
}
{
for
(
const
auto
&
it
:
m
.
def_table
)
def_table
.
push_back
(
make_pair
(
it
.
first
,
it
.
second
->
clone
(
*
this
))
);
def_table
.
push_back
(
{
it
.
first
,
it
.
second
->
clone
(
*
this
)}
);
}
Epilogue
&
...
...
@@ -308,7 +308,7 @@ Epilogue::operator=(const Epilogue &m)
def_table
.
clear
();
for
(
const
auto
&
it
:
m
.
def_table
)
def_table
.
push_back
(
make_pair
(
it
.
first
,
it
.
second
->
clone
(
*
this
))
);
def_table
.
push_back
(
{
it
.
first
,
it
.
second
->
clone
(
*
this
)}
);
return
*
this
;
}
...
...
src/ModelTree.cc
View file @
469a328c
...
...
@@ -83,7 +83,7 @@ ModelTree::copyHelper(const ModelTree &m)
for
(
const
auto
&
it
:
m
.
trend_symbols_map
)
trend_symbols_map
[
it
.
first
]
=
f
(
it
.
second
);
for
(
const
auto
&
it
:
m
.
nonstationary_symbols_map
)
nonstationary_symbols_map
[
it
.
first
]
=
make_pair
(
it
.
second
.
first
,
f
(
it
.
second
.
second
))
;
nonstationary_symbols_map
[
it
.
first
]
=
{
it
.
second
.
first
,
f
(
it
.
second
.
second
)}
;
}
ModelTree
::
ModelTree
(
SymbolTable
&
symbol_table_arg
,
...
...
@@ -500,7 +500,7 @@ ModelTree::select_non_linear_equations_and_variables(vector<bool> is_equation_li
}
cout
.
flush
();
int
nb_endo
=
is_equation_linear
.
size
();
vector
<
pair
<
int
,
int
>>
blocks
(
1
,
make_pair
(
i
,
i
)
);
vector
<
pair
<
int
,
int
>>
blocks
(
1
,
{
i
,
i
}
);
inv_equation_reordered
.
resize
(
nb_endo
);
inv_variable_reordered
.
resize
(
nb_endo
);
for
(
int
i
=
0
;
i
<
nb_endo
;
i
++
)
...
...
src/ParsingDriver.cc
View file @
469a328c
...
...
@@ -1493,7 +1493,7 @@ ParsingDriver::var_model()
error
(
"You cannot pass the order option when passing equation tags to the var_model statement"
);
}
mod_file
->
var_model_table
.
addVarModel
(
name
,
eqtags
,
make_pair
(
symbol_list
,
order
)
);
mod_file
->
var_model_table
.
addVarModel
(
name
,
eqtags
,
{
symbol_list
,
order
}
);
symbol_list
.
clear
();
options_list
.
clear
();
var_map
[
its
->
second
]
=
symbol_list
.
getSymbols
();
...
...
src/StaticModel.cc
View file @
469a328c
/*
* Copyright (C) 2003-201
8
Dynare Team
* Copyright (C) 2003-201
9
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -55,7 +55,7 @@ StaticModel::copyHelper(const StaticModel &m)
first_chain_rule_derivatives
[
it
.
first
]
=
f
(
it
.
second
);
for
(
const
auto
&
it
:
m
.
equation_type_and_normalized_equation
)
equation_type_and_normalized_equation
.
push_back
(
make_pair
(
it
.
first
,
f
(
it
.
second
))
);
equation_type_and_normalized_equation
.
push_back
(
{
it
.
first
,
f
(
it
.
second
)}
);
for
(
const
auto
&
it
:
m
.
blocks_derivatives
)
{
...
...
Write
Preview
Markdown
is supported
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