Ask GCC to warn about C-style casts (-Wold-style-cast)
Adapt the code accordingly.issue#70
parent
c628f21245
commit
1907249fac
|
@ -44,7 +44,7 @@ esac
|
||||||
# Use C++ for testing headers
|
# Use C++ for testing headers
|
||||||
AC_LANG([C++])
|
AC_LANG([C++])
|
||||||
|
|
||||||
AM_CXXFLAGS="-Wall -Wno-parentheses"
|
AM_CXXFLAGS="-Wall -Wno-parentheses -Wold-style-cast"
|
||||||
AC_SUBST([AM_CXXFLAGS])
|
AC_SUBST([AM_CXXFLAGS])
|
||||||
|
|
||||||
# If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
|
# If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
|
||||||
|
|
|
@ -1266,13 +1266,13 @@ public:
|
||||||
memcpy(&function_type, code, sizeof(function_type)); code += sizeof(function_type);
|
memcpy(&function_type, code, sizeof(function_type)); code += sizeof(function_type);
|
||||||
int size;
|
int size;
|
||||||
memcpy(&size, code, sizeof(size)); code += sizeof(size);
|
memcpy(&size, code, sizeof(size)); code += sizeof(size);
|
||||||
char *name = (char *) mxMalloc((size+1)*sizeof(char));
|
char *name = static_cast<char *>(mxMalloc((size+1)*sizeof(char)));
|
||||||
memcpy(name, code, size); code += size;
|
memcpy(name, code, size); code += size;
|
||||||
name[size] = 0;
|
name[size] = 0;
|
||||||
func_name = name;
|
func_name = name;
|
||||||
mxFree(name);
|
mxFree(name);
|
||||||
memcpy(&size, code, sizeof(size)); code += sizeof(size);
|
memcpy(&size, code, sizeof(size)); code += sizeof(size);
|
||||||
name = (char *) mxMalloc((size+1)*sizeof(char));
|
name = static_cast<char *>(mxMalloc((size+1)*sizeof(char)));
|
||||||
memcpy(name, code, size); code += size;
|
memcpy(name, code, size); code += size;
|
||||||
name[size] = 0;
|
name[size] = 0;
|
||||||
arg_func_name = name;
|
arg_func_name = name;
|
||||||
|
@ -1699,7 +1699,7 @@ public:
|
||||||
}
|
}
|
||||||
Code_Size = CompiledCode.tellg();
|
Code_Size = CompiledCode.tellg();
|
||||||
CompiledCode.seekg(std::ios::beg);
|
CompiledCode.seekg(std::ios::beg);
|
||||||
code = (uint8_t *) mxMalloc(Code_Size);
|
code = static_cast<uint8_t *>(mxMalloc(Code_Size));
|
||||||
CompiledCode.seekg(0);
|
CompiledCode.seekg(0);
|
||||||
CompiledCode.read(reinterpret_cast<char *>(code), Code_Size);
|
CompiledCode.read(reinterpret_cast<char *>(code), Code_Size);
|
||||||
CompiledCode.close();
|
CompiledCode.close();
|
||||||
|
|
|
@ -297,7 +297,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
if (simulation_type == SOLVE_TWO_BOUNDARIES_COMPLETE || simulation_type == SOLVE_TWO_BOUNDARIES_SIMPLE)
|
if (simulation_type == SOLVE_TWO_BOUNDARIES_COMPLETE || simulation_type == SOLVE_TWO_BOUNDARIES_SIMPLE)
|
||||||
{
|
{
|
||||||
temporary_terms_t tt2;
|
temporary_terms_t tt2;
|
||||||
for (int i = 0; i < (int) block_size; i++)
|
for (int i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
if (v_temporary_terms[block][i].size() && global_temporary_terms)
|
if (v_temporary_terms[block][i].size() && global_temporary_terms)
|
||||||
{
|
{
|
||||||
|
@ -645,7 +645,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
int equation_ID = getBlockEquationID(block, i);
|
int equation_ID = getBlockEquationID(block, i);
|
||||||
EquationType equ_type = getBlockEquationType(block, i);
|
EquationType equ_type = getBlockEquationType(block, i);
|
||||||
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
tmp_output.str("");
|
tmp_output.str("");
|
||||||
|
@ -673,7 +673,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||||
output << endl << " ";
|
output << endl << " ";
|
||||||
tmp_output.str("");
|
tmp_output.str("");
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||||
|
@ -1360,7 +1360,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
compileTemporaryTerms(code_file, instruction_number, temporary_terms, map_idx, true, false);
|
compileTemporaryTerms(code_file, instruction_number, temporary_terms, map_idx, true, false);
|
||||||
|
|
||||||
// The equations
|
// The equations
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
//The Temporary terms
|
//The Temporary terms
|
||||||
temporary_terms_t tt2;
|
temporary_terms_t tt2;
|
||||||
|
@ -1371,10 +1371,10 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
||||||
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
|
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
|
||||||
|
|
||||||
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find(it->idx)->second));
|
FNUMEXPR_ fnumexpr(TemporaryTerm, static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
it->compile(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
|
it->compile(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
|
||||||
FSTPT_ fstpt((int)(map_idx.find(it->idx)->second));
|
FSTPT_ fstpt(static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fstpt.write(code_file, instruction_number);
|
fstpt.write(code_file, instruction_number);
|
||||||
// Insert current node into tt2
|
// Insert current node into tt2
|
||||||
tt2.insert(it);
|
tt2.insert(it);
|
||||||
|
@ -1411,7 +1411,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
}
|
}
|
||||||
if (equ_type == E_EVALUATE)
|
if (equ_type == E_EVALUATE)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||||
|
@ -1419,7 +1419,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
}
|
}
|
||||||
else if (equ_type == E_EVALUATE_S)
|
else if (equ_type == E_EVALUATE_S)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||||
|
@ -1430,7 +1430,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
case SOLVE_FORWARD_COMPLETE:
|
case SOLVE_FORWARD_COMPLETE:
|
||||||
case SOLVE_TWO_BOUNDARIES_COMPLETE:
|
case SOLVE_TWO_BOUNDARIES_COMPLETE:
|
||||||
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
||||||
if (i < (int) block_recursive)
|
if (i < static_cast<int>(block_recursive))
|
||||||
goto evaluation;
|
goto evaluation;
|
||||||
variable_ID = getBlockVariableID(block, i);
|
variable_ID = getBlockVariableID(block, i);
|
||||||
equation_ID = getBlockEquationID(block, i);
|
equation_ID = getBlockEquationID(block, i);
|
||||||
|
@ -1441,7 +1441,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
end:
|
end:
|
||||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||||
|
@ -1498,12 +1498,12 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
continue;
|
continue;
|
||||||
if (!Uf[eqr].Ufl)
|
if (!Uf[eqr].Ufl)
|
||||||
{
|
{
|
||||||
Uf[eqr].Ufl = (Uff_l *) malloc(sizeof(Uff_l));
|
Uf[eqr].Ufl = static_cast<Uff_l *>(malloc(sizeof(Uff_l)));
|
||||||
Uf[eqr].Ufl_First = Uf[eqr].Ufl;
|
Uf[eqr].Ufl_First = Uf[eqr].Ufl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Uf[eqr].Ufl->pNext = (Uff_l *) malloc(sizeof(Uff_l));
|
Uf[eqr].Ufl->pNext = static_cast<Uff_l *>(malloc(sizeof(Uff_l)));
|
||||||
Uf[eqr].Ufl = Uf[eqr].Ufl->pNext;
|
Uf[eqr].Ufl = Uf[eqr].Ufl->pNext;
|
||||||
}
|
}
|
||||||
Uf[eqr].Ufl->pNext = nullptr;
|
Uf[eqr].Ufl->pNext = nullptr;
|
||||||
|
@ -1518,9 +1518,9 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
count_u++;
|
count_u++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
if (i >= (int) block_recursive)
|
if (i >= static_cast<int>(block_recursive))
|
||||||
{
|
{
|
||||||
FLDR_ fldr(i-block_recursive);
|
FLDR_ fldr(i-block_recursive);
|
||||||
fldr.write(code_file, instruction_number);
|
fldr.write(code_file, instruction_number);
|
||||||
|
@ -1938,12 +1938,12 @@ DynamicModel::Write_Inf_To_Bin_File_Block(const string &basename, const int &num
|
||||||
|
|
||||||
if (is_two_boundaries)
|
if (is_two_boundaries)
|
||||||
u_count_int += block_mfs;
|
u_count_int += block_mfs;
|
||||||
for (j = block_recursive; j < (int) block_size; j++)
|
for (j = block_recursive; j < static_cast<int>(block_size); j++)
|
||||||
{
|
{
|
||||||
unsigned int varr = getBlockVariableID(num, j);
|
unsigned int varr = getBlockVariableID(num, j);
|
||||||
SaveCode.write(reinterpret_cast<char *>(&varr), sizeof(varr));
|
SaveCode.write(reinterpret_cast<char *>(&varr), sizeof(varr));
|
||||||
}
|
}
|
||||||
for (j = block_recursive; j < (int) block_size; j++)
|
for (j = block_recursive; j < static_cast<int>(block_size); j++)
|
||||||
{
|
{
|
||||||
unsigned int eqr = getBlockEquationID(num, j);
|
unsigned int eqr = getBlockEquationID(num, j);
|
||||||
SaveCode.write(reinterpret_cast<char *>(&eqr), sizeof(eqr));
|
SaveCode.write(reinterpret_cast<char *>(&eqr), sizeof(eqr));
|
||||||
|
@ -4624,7 +4624,7 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
|
||||||
{
|
{
|
||||||
int symb_id = symbol_table.addDiffAuxiliaryVar(diff_node_to_search->idx, diff_node_to_search);
|
int symb_id = symbol_table.addDiffAuxiliaryVar(diff_node_to_search->idx, diff_node_to_search);
|
||||||
target_base_diff_node = AddVariable(symb_id);
|
target_base_diff_node = AddVariable(symb_id);
|
||||||
addEquation(dynamic_cast<BinaryOpNode *>(AddEqual((expr_t) target_base_diff_node,
|
addEquation(dynamic_cast<BinaryOpNode *>(AddEqual(const_cast<VariableNode *>(target_base_diff_node),
|
||||||
AddMinus(AddVariable(pac_target_symb_id),
|
AddMinus(AddVariable(pac_target_symb_id),
|
||||||
AddVariable(pac_target_symb_id, -1)))), -1);
|
AddVariable(pac_target_symb_id, -1)))), -1);
|
||||||
neqs++;
|
neqs++;
|
||||||
|
@ -4666,7 +4666,7 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
|
||||||
fs = AddPlus(fs, AddTimes(ssum, target_aux_var_to_add[k]));
|
fs = AddPlus(fs, AddTimes(ssum, target_aux_var_to_add[k]));
|
||||||
}
|
}
|
||||||
addEquation(AddEqual(AddVariable(mce_z1_symb_id),
|
addEquation(AddEqual(AddVariable(mce_z1_symb_id),
|
||||||
AddMinus(AddTimes(A, AddMinus((expr_t) target_base_diff_node, fs)), fp)), -1);
|
AddMinus(AddTimes(A, AddMinus(const_cast<VariableNode *>(target_base_diff_node), fs)), fp)), -1);
|
||||||
neqs++;
|
neqs++;
|
||||||
pac_expectation_substitution[{name, eqtag}] = AddVariable(mce_z1_symb_id);
|
pac_expectation_substitution[{name, eqtag}] = AddVariable(mce_z1_symb_id);
|
||||||
}
|
}
|
||||||
|
@ -5383,7 +5383,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model)
|
||||||
// Add aux LM to constraints in equations
|
// Add aux LM to constraints in equations
|
||||||
// equation[i]->lhs = rhs becomes equation[i]->MULT_(i+1)*(lhs-rhs) = 0
|
// equation[i]->lhs = rhs becomes equation[i]->MULT_(i+1)*(lhs-rhs) = 0
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int) equations.size(); i++)
|
for (i = 0; i < static_cast<int>(equations.size()); i++)
|
||||||
{
|
{
|
||||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
|
auto *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
|
||||||
assert(substeq != nullptr);
|
assert(substeq != nullptr);
|
||||||
|
@ -5419,7 +5419,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model)
|
||||||
|
|
||||||
// Create (modified) Lagrangian (so that we can take the derivative once at time t)
|
// Create (modified) Lagrangian (so that we can take the derivative once at time t)
|
||||||
expr_t lagrangian = Zero;
|
expr_t lagrangian = Zero;
|
||||||
for (i = 0; i < (int) equations.size(); i++)
|
for (i = 0; i < static_cast<int>(equations.size()); i++)
|
||||||
for (int lag = -max_eq_lag; lag <= max_eq_lead; lag++)
|
for (int lag = -max_eq_lag; lag <= max_eq_lead; lag++)
|
||||||
{
|
{
|
||||||
expr_t dfpower = nullptr;
|
expr_t dfpower = nullptr;
|
||||||
|
@ -5611,7 +5611,7 @@ DynamicModel::getTypeByDerivID(int deriv_id) const noexcept(false)
|
||||||
int
|
int
|
||||||
DynamicModel::getLagByDerivID(int deriv_id) const noexcept(false)
|
DynamicModel::getLagByDerivID(int deriv_id) const noexcept(false)
|
||||||
{
|
{
|
||||||
if (deriv_id < 0 || deriv_id >= (int) inv_deriv_id_table.size())
|
if (deriv_id < 0 || deriv_id >= static_cast<int>(inv_deriv_id_table.size()))
|
||||||
throw UnknownDerivIDException();
|
throw UnknownDerivIDException();
|
||||||
|
|
||||||
return inv_deriv_id_table[deriv_id].second;
|
return inv_deriv_id_table[deriv_id].second;
|
||||||
|
@ -5620,7 +5620,7 @@ DynamicModel::getLagByDerivID(int deriv_id) const noexcept(false)
|
||||||
int
|
int
|
||||||
DynamicModel::getSymbIDByDerivID(int deriv_id) const noexcept(false)
|
DynamicModel::getSymbIDByDerivID(int deriv_id) const noexcept(false)
|
||||||
{
|
{
|
||||||
if (deriv_id < 0 || deriv_id >= (int) inv_deriv_id_table.size())
|
if (deriv_id < 0 || deriv_id >= static_cast<int>(inv_deriv_id_table.size()))
|
||||||
throw UnknownDerivIDException();
|
throw UnknownDerivIDException();
|
||||||
|
|
||||||
return inv_deriv_id_table[deriv_id].first;
|
return inv_deriv_id_table[deriv_id].first;
|
||||||
|
@ -5715,7 +5715,7 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
|
||||||
it != deriv_id_table.end(); it++)
|
it != deriv_id_table.end(); it++)
|
||||||
if (symbol_table.getType(it->first.first) == SymbolType::trend
|
if (symbol_table.getType(it->first.first) == SymbolType::trend
|
||||||
|| symbol_table.getType(it->first.first) == SymbolType::logTrend)
|
|| symbol_table.getType(it->first.first) == SymbolType::logTrend)
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
expr_t homogeneq = AddMinus(equations[eq]->arg1,
|
expr_t homogeneq = AddMinus(equations[eq]->arg1,
|
||||||
equations[eq]->arg2);
|
equations[eq]->arg2);
|
||||||
|
@ -6525,7 +6525,7 @@ DynamicModel::isChecksumMatching(const string &basename, bool block) const
|
||||||
|
|
||||||
ExprNodeOutputType buffer_type = block ? ExprNodeOutputType::matlabDynamicModelSparse : ExprNodeOutputType::CDynamicModel;
|
ExprNodeOutputType buffer_type = block ? ExprNodeOutputType::matlabDynamicModelSparse : ExprNodeOutputType::CDynamicModel;
|
||||||
|
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
expr_t lhs = eq_node->arg1;
|
expr_t lhs = eq_node->arg1;
|
||||||
|
@ -6624,7 +6624,7 @@ DynamicModel::writeJsonAST(ostream &output) const
|
||||||
{
|
{
|
||||||
vector<pair<string, string>> eqtags;
|
vector<pair<string, string>> eqtags;
|
||||||
output << R"("abstract_syntax_tree":[)" << endl;
|
output << R"("abstract_syntax_tree":[)" << endl;
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
if (eq != 0)
|
if (eq != 0)
|
||||||
output << ", ";
|
output << ", ";
|
||||||
|
|
|
@ -607,13 +607,13 @@ public:
|
||||||
int
|
int
|
||||||
getBlockInitialEquationID(int block_number, int equation_number) const override
|
getBlockInitialEquationID(int block_number, int equation_number) const override
|
||||||
{
|
{
|
||||||
return ((int) inv_equation_reordered[equation_number] - (int) get<1>(block_type_firstequation_size_mfs[block_number]));
|
return (static_cast<int>(inv_equation_reordered[equation_number]) - static_cast<int>(get<1>(block_type_firstequation_size_mfs[block_number])));
|
||||||
};
|
};
|
||||||
//! Return the position of variable_number in the block number belonging to the block block_number
|
//! Return the position of variable_number in the block number belonging to the block block_number
|
||||||
int
|
int
|
||||||
getBlockInitialVariableID(int block_number, int variable_number) const override
|
getBlockInitialVariableID(int block_number, int variable_number) const override
|
||||||
{
|
{
|
||||||
return ((int) inv_variable_reordered[variable_number] - (int) get<1>(block_type_firstequation_size_mfs[block_number]));
|
return (static_cast<int>(inv_variable_reordered[variable_number]) - static_cast<int>(get<1>(block_type_firstequation_size_mfs[block_number])));
|
||||||
};
|
};
|
||||||
//! Return the block number containing the endogenous variable variable_number
|
//! Return the block number containing the endogenous variable variable_number
|
||||||
int
|
int
|
||||||
|
|
|
@ -4899,18 +4899,18 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<tuple<int, expr_t, expr_t>>
|
||||||
{
|
{
|
||||||
if (op_code == BinaryOpcode::equal) /* The end of the normalization process :
|
if (op_code == BinaryOpcode::equal) /* The end of the normalization process :
|
||||||
All the operations needed to normalize the equation are applied. */
|
All the operations needed to normalize the equation are applied. */
|
||||||
for (int i = 0; i < (int) List_of_Op_RHS1.size(); i++)
|
for (int i = 0; i < static_cast<int>(List_of_Op_RHS1.size()); i++)
|
||||||
{
|
{
|
||||||
tuple<int, expr_t, expr_t> it = List_of_Op_RHS1.back();
|
tuple<int, expr_t, expr_t> it = List_of_Op_RHS1.back();
|
||||||
List_of_Op_RHS1.pop_back();
|
List_of_Op_RHS1.pop_back();
|
||||||
if (get<1>(it) && !get<2>(it)) /*Binary operator*/
|
if (get<1>(it) && !get<2>(it)) /*Binary operator*/
|
||||||
expr_t_2 = Compute_RHS(expr_t_2, (BinaryOpNode *) get<1>(it), get<0>(it), 1);
|
expr_t_2 = Compute_RHS(expr_t_2, static_cast<BinaryOpNode *>(get<1>(it)), get<0>(it), 1);
|
||||||
else if (get<2>(it) && !get<1>(it)) /*Binary operator*/
|
else if (get<2>(it) && !get<1>(it)) /*Binary operator*/
|
||||||
expr_t_2 = Compute_RHS(get<2>(it), expr_t_2, get<0>(it), 1);
|
expr_t_2 = Compute_RHS(get<2>(it), expr_t_2, get<0>(it), 1);
|
||||||
else if (get<2>(it) && get<1>(it)) /*Binary operator*/
|
else if (get<2>(it) && get<1>(it)) /*Binary operator*/
|
||||||
expr_t_2 = Compute_RHS(get<1>(it), get<2>(it), get<0>(it), 1);
|
expr_t_2 = Compute_RHS(get<1>(it), get<2>(it), get<0>(it), 1);
|
||||||
else /*Unary operator*/
|
else /*Unary operator*/
|
||||||
expr_t_2 = Compute_RHS((UnaryOpNode *) expr_t_2, (UnaryOpNode *) get<1>(it), get<0>(it), 0);
|
expr_t_2 = Compute_RHS(static_cast<UnaryOpNode *>(expr_t_2), static_cast<UnaryOpNode *>(get<1>(it)), get<0>(it), 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
List_of_Op_RHS = List_of_Op_RHS1;
|
List_of_Op_RHS = List_of_Op_RHS1;
|
||||||
|
@ -4918,18 +4918,18 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<tuple<int, expr_t, expr_t>>
|
||||||
else if (is_endogenous_present_2)
|
else if (is_endogenous_present_2)
|
||||||
{
|
{
|
||||||
if (op_code == BinaryOpcode::equal)
|
if (op_code == BinaryOpcode::equal)
|
||||||
for (int i = 0; i < (int) List_of_Op_RHS2.size(); i++)
|
for (int i = 0; i < static_cast<int>(List_of_Op_RHS2.size()); i++)
|
||||||
{
|
{
|
||||||
tuple<int, expr_t, expr_t> it = List_of_Op_RHS2.back();
|
tuple<int, expr_t, expr_t> it = List_of_Op_RHS2.back();
|
||||||
List_of_Op_RHS2.pop_back();
|
List_of_Op_RHS2.pop_back();
|
||||||
if (get<1>(it) && !get<2>(it)) /*Binary operator*/
|
if (get<1>(it) && !get<2>(it)) /*Binary operator*/
|
||||||
expr_t_1 = Compute_RHS((BinaryOpNode *) expr_t_1, (BinaryOpNode *) get<1>(it), get<0>(it), 1);
|
expr_t_1 = Compute_RHS(static_cast<BinaryOpNode *>(expr_t_1), static_cast<BinaryOpNode *>(get<1>(it)), get<0>(it), 1);
|
||||||
else if (get<2>(it) && !get<1>(it)) /*Binary operator*/
|
else if (get<2>(it) && !get<1>(it)) /*Binary operator*/
|
||||||
expr_t_1 = Compute_RHS((BinaryOpNode *) get<2>(it), (BinaryOpNode *) expr_t_1, get<0>(it), 1);
|
expr_t_1 = Compute_RHS(static_cast<BinaryOpNode *>(get<2>(it)), static_cast<BinaryOpNode *>(expr_t_1), get<0>(it), 1);
|
||||||
else if (get<2>(it) && get<1>(it)) /*Binary operator*/
|
else if (get<2>(it) && get<1>(it)) /*Binary operator*/
|
||||||
expr_t_1 = Compute_RHS(get<1>(it), get<2>(it), get<0>(it), 1);
|
expr_t_1 = Compute_RHS(get<1>(it), get<2>(it), get<0>(it), 1);
|
||||||
else
|
else
|
||||||
expr_t_1 = Compute_RHS((UnaryOpNode *) expr_t_1, (UnaryOpNode *) get<1>(it), get<0>(it), 0);
|
expr_t_1 = Compute_RHS(static_cast<UnaryOpNode *>(expr_t_1), static_cast<UnaryOpNode *>(get<1>(it)), get<0>(it), 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
List_of_Op_RHS = List_of_Op_RHS2;
|
List_of_Op_RHS = List_of_Op_RHS2;
|
||||||
|
@ -6910,7 +6910,7 @@ AbstractExternalFunctionNode::prepareForDerivation()
|
||||||
argument->prepareForDerivation();
|
argument->prepareForDerivation();
|
||||||
|
|
||||||
non_null_derivatives = arguments.at(0)->non_null_derivatives;
|
non_null_derivatives = arguments.at(0)->non_null_derivatives;
|
||||||
for (int i = 1; i < (int) arguments.size(); i++)
|
for (int i = 1; i < static_cast<int>(arguments.size()); i++)
|
||||||
set_union(non_null_derivatives.begin(),
|
set_union(non_null_derivatives.begin(),
|
||||||
non_null_derivatives.end(),
|
non_null_derivatives.end(),
|
||||||
arguments.at(i)->non_null_derivatives.begin(),
|
arguments.at(i)->non_null_derivatives.begin(),
|
||||||
|
@ -7521,7 +7521,7 @@ expr_t
|
||||||
ExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
ExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
||||||
{
|
{
|
||||||
vector<expr_t> dNodes;
|
vector<expr_t> dNodes;
|
||||||
for (int i = 0; i < (int) dargs.size(); i++)
|
for (int i = 0; i < static_cast<int>(dargs.size()); i++)
|
||||||
dNodes.push_back(datatree.AddTimes(dargs.at(i),
|
dNodes.push_back(datatree.AddTimes(dargs.at(i),
|
||||||
datatree.AddFirstDerivExternalFunction(symb_id, arguments, i+1)));
|
datatree.AddFirstDerivExternalFunction(symb_id, arguments, i+1)));
|
||||||
|
|
||||||
|
@ -7596,7 +7596,7 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign
|
||||||
|
|
||||||
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
||||||
{
|
{
|
||||||
tef_terms[{ symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
||||||
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
||||||
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
||||||
|
@ -7698,7 +7698,7 @@ ExternalFunctionNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutpu
|
||||||
|
|
||||||
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
||||||
{
|
{
|
||||||
tef_terms[{ symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
||||||
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
||||||
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
||||||
|
@ -7775,7 +7775,7 @@ ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
|
||||||
|
|
||||||
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
|
||||||
{
|
{
|
||||||
tef_terms[{ symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
||||||
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
||||||
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
||||||
|
@ -7866,7 +7866,7 @@ expr_t
|
||||||
FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
||||||
{
|
{
|
||||||
vector<expr_t> dNodes;
|
vector<expr_t> dNodes;
|
||||||
for (int i = 0; i < (int) dargs.size(); i++)
|
for (int i = 0; i < static_cast<int>(dargs.size()); i++)
|
||||||
dNodes.push_back(datatree.AddTimes(dargs.at(i),
|
dNodes.push_back(datatree.AddTimes(dargs.at(i),
|
||||||
datatree.AddSecondDerivExternalFunction(symb_id, arguments, inputIndex, i+1)));
|
datatree.AddSecondDerivExternalFunction(symb_id, arguments, inputIndex, i+1)));
|
||||||
expr_t theDeriv = datatree.Zero;
|
expr_t theDeriv = datatree.Zero;
|
||||||
|
@ -8054,7 +8054,7 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ first_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ first_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(first_deriv_symb_id, tef_terms);
|
int indx = getIndxInTefTerms(first_deriv_symb_id, tef_terms);
|
||||||
stringstream ending;
|
stringstream ending;
|
||||||
ending << "_tefd_def_" << indx;
|
ending << "_tefd_def_" << indx;
|
||||||
|
@ -8080,7 +8080,7 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
|
||||||
<< datatree.symbol_table.getName(symb_id) << "'," << inputIndex << ",{";
|
<< datatree.symbol_table.getName(symb_id) << "'," << inputIndex << ",{";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ first_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ first_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
output << "TEFD_def_" << getIndxInTefTerms(first_deriv_symb_id, tef_terms)
|
output << "TEFD_def_" << getIndxInTefTerms(first_deriv_symb_id, tef_terms)
|
||||||
<< " = " << datatree.symbol_table.getName(first_deriv_symb_id) << "(";
|
<< " = " << datatree.symbol_table.getName(first_deriv_symb_id) << "(";
|
||||||
}
|
}
|
||||||
|
@ -8123,7 +8123,7 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &
|
||||||
<< R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
|
<< R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ first_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ first_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
ef << R"({"first_deriv_external_function": {)"
|
ef << R"({"first_deriv_external_function": {)"
|
||||||
<< R"("external_function_term": "TEFD_def_)" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) << R"(")"
|
<< R"("external_function_term": "TEFD_def_)" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) << R"(")"
|
||||||
<< R"(, "analytic_derivative": true)"
|
<< R"(, "analytic_derivative": true)"
|
||||||
|
@ -8165,7 +8165,7 @@ FirstDerivExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ first_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ first_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
int indx = getIndxInTefTerms(symb_id, tef_terms);
|
||||||
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
|
||||||
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
|
||||||
|
@ -8419,7 +8419,7 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ second_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ second_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
int indx = getIndxInTefTerms(second_deriv_symb_id, tef_terms);
|
int indx = getIndxInTefTerms(second_deriv_symb_id, tef_terms);
|
||||||
stringstream ending;
|
stringstream ending;
|
||||||
ending << "_tefdd_def_" << indx;
|
ending << "_tefdd_def_" << indx;
|
||||||
|
@ -8447,7 +8447,7 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
|
||||||
<< inputIndex1 << "," << inputIndex2 << ",{";
|
<< inputIndex1 << "," << inputIndex2 << ",{";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ second_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ second_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
output << "TEFDD_def_" << getIndxInTefTerms(second_deriv_symb_id, tef_terms)
|
output << "TEFDD_def_" << getIndxInTefTerms(second_deriv_symb_id, tef_terms)
|
||||||
<< " = " << datatree.symbol_table.getName(second_deriv_symb_id) << "(";
|
<< " = " << datatree.symbol_table.getName(second_deriv_symb_id) << "(";
|
||||||
}
|
}
|
||||||
|
@ -8491,7 +8491,7 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string>
|
||||||
<< R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
|
<< R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tef_terms[{ second_deriv_symb_id, arguments }] = (int) tef_terms.size();
|
tef_terms[{ second_deriv_symb_id, arguments }] = static_cast<int>(tef_terms.size());
|
||||||
ef << R"({"second_deriv_external_function": {)"
|
ef << R"({"second_deriv_external_function": {)"
|
||||||
<< R"("external_function_term": "TEFDD_def_)" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) << R"(")"
|
<< R"("external_function_term": "TEFDD_def_)" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) << R"(")"
|
||||||
<< R"(, "analytic_derivative": true)"
|
<< R"(, "analytic_derivative": true)"
|
||||||
|
|
|
@ -134,7 +134,7 @@ isLatexOutput(ExprNodeOutputType output_type)
|
||||||
|
|
||||||
/* Equal to 1 for Matlab langage or Julia, or to 0 for C language. Not defined for LaTeX.
|
/* Equal to 1 for Matlab langage or Julia, or to 0 for C language. Not defined for LaTeX.
|
||||||
In Matlab and Julia, array indexes begin at 1, while they begin at 0 in C */
|
In Matlab and Julia, array indexes begin at 1, while they begin at 0 in C */
|
||||||
#define ARRAY_SUBSCRIPT_OFFSET(output_type) ((int) (isMatlabOutput(output_type) || isJuliaOutput(output_type)))
|
#define ARRAY_SUBSCRIPT_OFFSET(output_type) (static_cast<int>(isMatlabOutput(output_type) || isJuliaOutput(output_type)))
|
||||||
|
|
||||||
// Left and right array subscript delimiters: '(' and ')' for Matlab, '[' and ']' for C
|
// Left and right array subscript delimiters: '(' and ')' for Matlab, '[' and ']' for C
|
||||||
#define LEFT_ARRAY_SUBSCRIPT(output_type) (isMatlabOutput(output_type) ? '(' : '[')
|
#define LEFT_ARRAY_SUBSCRIPT(output_type) (isMatlabOutput(output_type) ? '(' : '[')
|
||||||
|
|
|
@ -72,6 +72,8 @@ DynareFlex.cc FlexLexer.h: DynareFlex.ll
|
||||||
$(LEX) -o DynareFlex.cc DynareFlex.ll
|
$(LEX) -o DynareFlex.cc DynareFlex.ll
|
||||||
cp $(LEXINC)/FlexLexer.h . || test -f ./FlexLexer.h
|
cp $(LEXINC)/FlexLexer.h . || test -f ./FlexLexer.h
|
||||||
|
|
||||||
|
dynare_m-DynareFlex.$(OBJEXT): CXXFLAGS += -Wno-old-style-cast
|
||||||
|
|
||||||
DynareBison.cc DynareBison.hh location.hh stack.hh position.hh: DynareBison.yy
|
DynareBison.cc DynareBison.hh location.hh stack.hh position.hh: DynareBison.yy
|
||||||
$(YACC) -W -o DynareBison.cc DynareBison.yy
|
$(YACC) -W -o DynareBison.cc DynareBison.yy
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
|
||||||
if (endo.find({ symbol_table.getTypeSpecificID(symb_id), 0 }) != endo.end())
|
if (endo.find({ symbol_table.getTypeSpecificID(symb_id), 0 }) != endo.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
endo2eqs.emplace(symbol_table.getTypeSpecificID(symb_id), (int) i);
|
endo2eqs.emplace(symbol_table.getTypeSpecificID(symb_id), static_cast<int>(i));
|
||||||
cout << "Endogenous " << symbol_table.getName(symb_id) << " normalized in equation " << (i+1) << endl;
|
cout << "Endogenous " << symbol_table.getName(symb_id) << " normalized in equation " << (i+1) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ ModelTree::computeNaturalNormalization()
|
||||||
bool bool_result = true;
|
bool bool_result = true;
|
||||||
set<pair<int, int> > result;
|
set<pair<int, int> > result;
|
||||||
endo2eq.resize(equations.size());
|
endo2eq.resize(equations.size());
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
if (!is_equation_linear[eq])
|
if (!is_equation_linear[eq])
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
|
@ -621,7 +621,7 @@ ModelTree::computePrologueAndEpilogue(const jacob_map_t &static_jacobian_arg, ve
|
||||||
{
|
{
|
||||||
int tmp_epilogue = epilogue;
|
int tmp_epilogue = epilogue;
|
||||||
something_has_been_done = false;
|
something_has_been_done = false;
|
||||||
for (int i = prologue; i < n - (int) epilogue; i++)
|
for (int i = prologue; i < n - static_cast<int>(epilogue); i++)
|
||||||
{
|
{
|
||||||
int nze = 0;
|
int nze = 0;
|
||||||
for (int j = prologue; j < n - tmp_epilogue; j++)
|
for (int j = prologue; j < n - tmp_epilogue; j++)
|
||||||
|
@ -712,12 +712,12 @@ ModelTree::getVariableLeadLagByBlock(const dynamic_jacob_map_t &dynamic_jacobian
|
||||||
vector<int> variable_blck(nb_endo), equation_blck(nb_endo);
|
vector<int> variable_blck(nb_endo), equation_blck(nb_endo);
|
||||||
for (int i = 0; i < nb_endo; i++)
|
for (int i = 0; i < nb_endo; i++)
|
||||||
{
|
{
|
||||||
if (i < (int) prologue)
|
if (i < static_cast<int>(prologue))
|
||||||
{
|
{
|
||||||
variable_blck[variable_reordered[i]] = i;
|
variable_blck[variable_reordered[i]] = i;
|
||||||
equation_blck[equation_reordered[i]] = i;
|
equation_blck[equation_reordered[i]] = i;
|
||||||
}
|
}
|
||||||
else if (i < (int) (components_set.size() + prologue))
|
else if (i < static_cast<int>(components_set.size() + prologue))
|
||||||
{
|
{
|
||||||
variable_blck[variable_reordered[i]] = components_set[i-prologue] + prologue;
|
variable_blck[variable_reordered[i]] = components_set[i-prologue] + prologue;
|
||||||
equation_blck[equation_reordered[i]] = components_set[i-prologue] + prologue;
|
equation_blck[equation_reordered[i]] = components_set[i-prologue] + prologue;
|
||||||
|
@ -782,8 +782,8 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
|
||||||
else
|
else
|
||||||
tmp_normalized_contemporaneous_jacobian = static_jacobian;
|
tmp_normalized_contemporaneous_jacobian = static_jacobian;
|
||||||
for (const auto &it : tmp_normalized_contemporaneous_jacobian)
|
for (const auto &it : tmp_normalized_contemporaneous_jacobian)
|
||||||
if (reverse_equation_reordered[it.first.first] >= (int) prologue && reverse_equation_reordered[it.first.first] < (int) (nb_var - epilogue)
|
if (reverse_equation_reordered[it.first.first] >= static_cast<int>(prologue) && reverse_equation_reordered[it.first.first] < static_cast<int>(nb_var - epilogue)
|
||||||
&& reverse_variable_reordered[it.first.second] >= (int) prologue && reverse_variable_reordered[it.first.second] < (int) (nb_var - epilogue)
|
&& reverse_variable_reordered[it.first.second] >= static_cast<int>(prologue) && reverse_variable_reordered[it.first.second] < static_cast<int>(nb_var - epilogue)
|
||||||
&& it.first.first != endo2eq[it.first.second])
|
&& it.first.first != endo2eq[it.first.second])
|
||||||
add_edge(vertex(reverse_equation_reordered[endo2eq[it.first.second]]-prologue, G2),
|
add_edge(vertex(reverse_equation_reordered[endo2eq[it.first.second]]-prologue, G2),
|
||||||
vertex(reverse_equation_reordered[it.first.first]-prologue, G2),
|
vertex(reverse_equation_reordered[it.first.first]-prologue, G2),
|
||||||
|
@ -863,7 +863,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
|
||||||
n_backward = vector<unsigned int>(prologue+num+epilogue, 0);
|
n_backward = vector<unsigned int>(prologue+num+epilogue, 0);
|
||||||
n_mixed = vector<unsigned int>(prologue+num+epilogue, 0);
|
n_mixed = vector<unsigned int>(prologue+num+epilogue, 0);
|
||||||
|
|
||||||
for (int i = 0; i < (int) prologue; i++)
|
for (int i = 0; i < static_cast<int>(prologue); i++)
|
||||||
{
|
{
|
||||||
if (variable_lag_lead[tmp_variable_reordered[i]].first != 0 && variable_lag_lead[tmp_variable_reordered[i]].second != 0)
|
if (variable_lag_lead[tmp_variable_reordered[i]].first != 0 && variable_lag_lead[tmp_variable_reordered[i]].second != 0)
|
||||||
n_mixed[i]++;
|
n_mixed[i]++;
|
||||||
|
@ -961,7 +961,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int) epilogue; i++)
|
for (int i = 0; i < static_cast<int>(epilogue); i++)
|
||||||
{
|
{
|
||||||
if (variable_lag_lead[tmp_variable_reordered[prologue+n+i]].first != 0 && variable_lag_lead[tmp_variable_reordered[prologue+n+i]].second != 0)
|
if (variable_lag_lead[tmp_variable_reordered[prologue+n+i]].first != 0 && variable_lag_lead[tmp_variable_reordered[prologue+n+i]].second != 0)
|
||||||
n_mixed[prologue+num+i]++;
|
n_mixed[prologue+num+i]++;
|
||||||
|
@ -1025,21 +1025,21 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
|
||||||
unsigned int l_n_forward = 0;
|
unsigned int l_n_forward = 0;
|
||||||
unsigned int l_n_backward = 0;
|
unsigned int l_n_backward = 0;
|
||||||
unsigned int l_n_mixed = 0;
|
unsigned int l_n_mixed = 0;
|
||||||
for (i = 0; i < (int) (prologue+blocks.size()+epilogue); i++)
|
for (i = 0; i < static_cast<int>(prologue+blocks.size()+epilogue); i++)
|
||||||
{
|
{
|
||||||
int first_count_equ = count_equ;
|
int first_count_equ = count_equ;
|
||||||
if (i < (int) prologue)
|
if (i < static_cast<int>(prologue))
|
||||||
{
|
{
|
||||||
Blck_Size = 1;
|
Blck_Size = 1;
|
||||||
MFS_Size = 1;
|
MFS_Size = 1;
|
||||||
}
|
}
|
||||||
else if (i < (int) (prologue+blocks.size()))
|
else if (i < static_cast<int>(prologue+blocks.size()))
|
||||||
{
|
{
|
||||||
Blck_Size = blocks[blck_count_simult].first;
|
Blck_Size = blocks[blck_count_simult].first;
|
||||||
MFS_Size = blocks[blck_count_simult].second;
|
MFS_Size = blocks[blck_count_simult].second;
|
||||||
blck_count_simult++;
|
blck_count_simult++;
|
||||||
}
|
}
|
||||||
else if (i < (int) (prologue+blocks.size()+epilogue))
|
else if (i < static_cast<int>(prologue+blocks.size()+epilogue))
|
||||||
{
|
{
|
||||||
Blck_Size = 1;
|
Blck_Size = 1;
|
||||||
MFS_Size = 1;
|
MFS_Size = 1;
|
||||||
|
@ -1348,7 +1348,7 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
|
||||||
reference_count,
|
reference_count,
|
||||||
is_matlab);
|
is_matlab);
|
||||||
|
|
||||||
for (int order = 1; order < (int) derivatives.size(); order++)
|
for (int order = 1; order < static_cast<int>(derivatives.size()); order++)
|
||||||
for (const auto &it : derivatives[order])
|
for (const auto &it : derivatives[order])
|
||||||
it.second->computeTemporaryTerms({ 0, order },
|
it.second->computeTemporaryTerms({ 0, order },
|
||||||
temp_terms_map,
|
temp_terms_map,
|
||||||
|
@ -1364,14 +1364,14 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
|
||||||
// Fill the new structure
|
// Fill the new structure
|
||||||
temporary_terms_derivatives.clear();
|
temporary_terms_derivatives.clear();
|
||||||
temporary_terms_derivatives.resize(derivatives.size());
|
temporary_terms_derivatives.resize(derivatives.size());
|
||||||
for (int order = 0; order < (int) derivatives.size(); order++)
|
for (int order = 0; order < static_cast<int>(derivatives.size()); order++)
|
||||||
temporary_terms_derivatives[order] = move(temp_terms_map[{ 0, order }]);
|
temporary_terms_derivatives[order] = move(temp_terms_map[{ 0, order }]);
|
||||||
|
|
||||||
// Compute indices in MATLAB/Julia vector
|
// Compute indices in MATLAB/Julia vector
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (auto &it : temporary_terms_mlv)
|
for (auto &it : temporary_terms_mlv)
|
||||||
temporary_terms_idxs[it.first] = idx++;
|
temporary_terms_idxs[it.first] = idx++;
|
||||||
for (int order = 0; order < (int) derivatives.size(); order++)
|
for (int order = 0; order < static_cast<int>(derivatives.size()); order++)
|
||||||
for (const auto &it : temporary_terms_derivatives[order])
|
for (const auto &it : temporary_terms_derivatives[order])
|
||||||
temporary_terms_idxs[it] = idx++;
|
temporary_terms_idxs[it] = idx++;
|
||||||
}
|
}
|
||||||
|
@ -1618,17 +1618,17 @@ ModelTree::compileTemporaryTerms(ostream &code_file, unsigned int &instruction_n
|
||||||
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
|
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
|
||||||
}
|
}
|
||||||
|
|
||||||
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find(it->idx)->second));
|
FNUMEXPR_ fnumexpr(TemporaryTerm, static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
it->compile(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
|
it->compile(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
|
||||||
if (dynamic)
|
if (dynamic)
|
||||||
{
|
{
|
||||||
FSTPT_ fstpt((int)(map_idx.find(it->idx)->second));
|
FSTPT_ fstpt(static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fstpt.write(code_file, instruction_number);
|
fstpt.write(code_file, instruction_number);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FSTPST_ fstpst((int)(map_idx.find(it->idx)->second));
|
FSTPST_ fstpst(static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fstpst.write(code_file, instruction_number);
|
fstpst.write(code_file, instruction_number);
|
||||||
}
|
}
|
||||||
// Insert current node into tt2
|
// Insert current node into tt2
|
||||||
|
@ -1696,7 +1696,7 @@ void
|
||||||
ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
|
ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms) const
|
const temporary_terms_t &temporary_terms) const
|
||||||
{
|
{
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
expr_t lhs = eq_node->arg1;
|
expr_t lhs = eq_node->arg1;
|
||||||
|
@ -1754,7 +1754,7 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
|
||||||
void
|
void
|
||||||
ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
||||||
{
|
{
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
expr_t lhs = eq_node->arg1;
|
expr_t lhs = eq_node->arg1;
|
||||||
|
@ -1827,9 +1827,9 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
|
||||||
}
|
}
|
||||||
if (is_two_boundaries)
|
if (is_two_boundaries)
|
||||||
u_count_int += symbol_table.endo_nbr();
|
u_count_int += symbol_table.endo_nbr();
|
||||||
for (j = 0; j < (int) symbol_table.endo_nbr(); j++)
|
for (j = 0; j < static_cast<int>(symbol_table.endo_nbr()); j++)
|
||||||
SaveCode.write(reinterpret_cast<char *>(&j), sizeof(j));
|
SaveCode.write(reinterpret_cast<char *>(&j), sizeof(j));
|
||||||
for (j = 0; j < (int) symbol_table.endo_nbr(); j++)
|
for (j = 0; j < static_cast<int>(symbol_table.endo_nbr()); j++)
|
||||||
SaveCode.write(reinterpret_cast<char *>(&j), sizeof(j));
|
SaveCode.write(reinterpret_cast<char *>(&j), sizeof(j));
|
||||||
SaveCode.close();
|
SaveCode.close();
|
||||||
}
|
}
|
||||||
|
@ -1875,7 +1875,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
|
||||||
content_output << endl << R"(\end{dmath*})" << endl;
|
content_output << endl << R"(\end{dmath*})" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
content_output << "% Equation " << eq + 1 << endl;
|
content_output << "% Equation " << eq + 1 << endl;
|
||||||
if (write_equation_tags)
|
if (write_equation_tags)
|
||||||
|
@ -2042,7 +2042,7 @@ ModelTree::computeParamsDerivatives(int paramsDerivsOrder)
|
||||||
// First-order derivatives w.r.t. params
|
// First-order derivatives w.r.t. params
|
||||||
for (int param : deriv_id_set)
|
for (int param : deriv_id_set)
|
||||||
{
|
{
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
expr_t d = equations[eq]->getDerivative(param);
|
expr_t d = equations[eq]->getDerivative(param);
|
||||||
if (d == Zero)
|
if (d == Zero)
|
||||||
|
@ -2050,7 +2050,7 @@ ModelTree::computeParamsDerivatives(int paramsDerivsOrder)
|
||||||
params_derivatives[{ 0, 1 }][{ eq, param }] = d;
|
params_derivatives[{ 0, 1 }][{ eq, param }] = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int endoOrd = 1; endoOrd < (int) derivatives.size(); endoOrd++)
|
for (int endoOrd = 1; endoOrd < static_cast<int>(derivatives.size()); endoOrd++)
|
||||||
for (const auto &it : derivatives[endoOrd])
|
for (const auto &it : derivatives[endoOrd])
|
||||||
{
|
{
|
||||||
expr_t d = it.second->getDerivative(param);
|
expr_t d = it.second->getDerivative(param);
|
||||||
|
@ -2063,7 +2063,7 @@ ModelTree::computeParamsDerivatives(int paramsDerivsOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Higher-order derivatives w.r.t. parameters
|
// Higher-order derivatives w.r.t. parameters
|
||||||
for (int endoOrd = 0; endoOrd < (int) derivatives.size(); endoOrd++)
|
for (int endoOrd = 0; endoOrd < static_cast<int>(derivatives.size()); endoOrd++)
|
||||||
for (int paramOrd = 2; paramOrd <= paramsDerivsOrder; paramOrd++)
|
for (int paramOrd = 2; paramOrd <= paramsDerivsOrder; paramOrd++)
|
||||||
for (const auto &it : params_derivatives[{ endoOrd, paramOrd-1 }])
|
for (const auto &it : params_derivatives[{ endoOrd, paramOrd-1 }])
|
||||||
for (int param : deriv_id_set)
|
for (int param : deriv_id_set)
|
||||||
|
@ -2120,7 +2120,7 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
||||||
output << endl << R"("residuals":[)" << endl;
|
output << endl << R"("residuals":[)" << endl;
|
||||||
else
|
else
|
||||||
output << endl << R"("model":[)" << endl;
|
output << endl << R"("model":[)" << endl;
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
if (eq > 0)
|
if (eq > 0)
|
||||||
output << ", ";
|
output << ", ";
|
||||||
|
|
|
@ -33,7 +33,7 @@ NumericalConstants::AddNonNegativeConstant(const string &iConst)
|
||||||
if (iter != numConstantsIndex.end())
|
if (iter != numConstantsIndex.end())
|
||||||
return iter->second;
|
return iter->second;
|
||||||
|
|
||||||
auto id = (int) mNumericalConstants.size();
|
auto id = static_cast<int>(mNumericalConstants.size());
|
||||||
mNumericalConstants.push_back(iConst);
|
mNumericalConstants.push_back(iConst);
|
||||||
numConstantsIndex[iConst] = id;
|
numConstantsIndex[iConst] = id;
|
||||||
|
|
||||||
|
@ -52,13 +52,13 @@ NumericalConstants::AddNonNegativeConstant(const string &iConst)
|
||||||
string
|
string
|
||||||
NumericalConstants::get(int ID) const
|
NumericalConstants::get(int ID) const
|
||||||
{
|
{
|
||||||
assert(ID >= 0 && ID < (int) mNumericalConstants.size());
|
assert(ID >= 0 && ID < static_cast<int>(mNumericalConstants.size()));
|
||||||
return mNumericalConstants[ID];
|
return mNumericalConstants[ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
NumericalConstants::getDouble(int ID) const
|
NumericalConstants::getDouble(int ID) const
|
||||||
{
|
{
|
||||||
assert(ID >= 0 && ID < (int) double_vals.size());
|
assert(ID >= 0 && ID < static_cast<int>(double_vals.size()));
|
||||||
return (double_vals[ID]);
|
return (double_vals[ID]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3022,7 +3022,7 @@ ParsingDriver::add_model_var_or_external_function(const string &function_name, b
|
||||||
model_error("Symbol " + function_name +
|
model_error("Symbol " + function_name +
|
||||||
" is being treated as if it were a function (i.e., takes an argument that is not an integer).", "");
|
" is being treated as if it were a function (i.e., takes an argument that is not an integer).", "");
|
||||||
|
|
||||||
nid = add_model_variable(mod_file->symbol_table.getID(function_name), (int) rv.second);
|
nid = add_model_variable(mod_file->symbol_table.getID(function_name), static_cast<int>(rv.second));
|
||||||
stack_external_function_args.pop();
|
stack_external_function_args.pop();
|
||||||
return nid;
|
return nid;
|
||||||
}
|
}
|
||||||
|
@ -3037,7 +3037,7 @@ ParsingDriver::add_model_var_or_external_function(const string &function_name, b
|
||||||
if (mod_file->external_functions_table.getNargs(symb_id) == ExternalFunctionsTable::IDNotSet)
|
if (mod_file->external_functions_table.getNargs(symb_id) == ExternalFunctionsTable::IDNotSet)
|
||||||
error("Before using " + function_name
|
error("Before using " + function_name
|
||||||
+"() in the model block, you must first declare it via the external_function() statement");
|
+"() in the model block, you must first declare it via the external_function() statement");
|
||||||
else if ((int) (stack_external_function_args.top().size()) != mod_file->external_functions_table.getNargs(symb_id))
|
else if (static_cast<int>(stack_external_function_args.top().size()) != mod_file->external_functions_table.getNargs(symb_id))
|
||||||
error("The number of arguments passed to " + function_name
|
error("The number of arguments passed to " + function_name
|
||||||
+"() does not match those of a previous call or declaration of this function.");
|
+"() does not match those of a previous call or declaration of this function.");
|
||||||
}
|
}
|
||||||
|
@ -3058,7 +3058,7 @@ ParsingDriver::add_model_var_or_external_function(const string &function_name, b
|
||||||
{
|
{
|
||||||
// assume it's a lead/lagged variable
|
// assume it's a lead/lagged variable
|
||||||
declare_exogenous(function_name);
|
declare_exogenous(function_name);
|
||||||
return add_model_variable(mod_file->symbol_table.getID(function_name), (int) rv.second);
|
return add_model_variable(mod_file->symbol_table.getID(function_name), static_cast<int>(rv.second));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error("To use an external function (" + function_name +
|
error("To use an external function (" + function_name +
|
||||||
|
@ -3301,7 +3301,7 @@ ParsingDriver::smm_estimation()
|
||||||
void
|
void
|
||||||
ParsingDriver::prior_posterior_function(bool prior_func)
|
ParsingDriver::prior_posterior_function(bool prior_func)
|
||||||
{
|
{
|
||||||
mod_file->addStatement(make_unique<PriorPosteriorFunctionStatement>((bool) prior_func, options_list));
|
mod_file->addStatement(make_unique<PriorPosteriorFunctionStatement>(static_cast<bool>(prior_func), options_list));
|
||||||
options_list.clear();
|
options_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
|
||||||
const expr_t value = it.value;
|
const expr_t value = it.value;
|
||||||
|
|
||||||
output << "M_.det_shocks = [ M_.det_shocks;" << endl
|
output << "M_.det_shocks = [ M_.det_shocks;" << endl
|
||||||
<< "struct('exo_det'," << (int) exo_det
|
<< "struct('exo_det'," << static_cast<int>(exo_det)
|
||||||
<< ",'exo_id'," << id
|
<< ",'exo_id'," << id
|
||||||
<< ",'multiplicative'," << (int) mshocks
|
<< ",'multiplicative'," << static_cast<int>(mshocks)
|
||||||
<< ",'periods'," << period1 << ":" << period2
|
<< ",'periods'," << period1 << ":" << period2
|
||||||
<< ",'value',";
|
<< ",'value',";
|
||||||
value->writeOutput(output);
|
value->writeOutput(output);
|
||||||
|
|
|
@ -269,7 +269,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count_local, temporary_terms_l, first_occurence_local, block, v_temporary_terms_local, i);
|
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count_local, temporary_terms_l, first_occurence_local, block, v_temporary_terms_local, i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->computeTemporaryTerms(reference_count_local, temporary_terms_l, first_occurence_local, block, v_temporary_terms_local, i);
|
eq_node->computeTemporaryTerms(reference_count_local, temporary_terms_l, first_occurence_local, block, v_temporary_terms_local, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
||||||
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
||||||
expr_t id = get<3>(it);
|
expr_t id = get<3>(it);
|
||||||
id->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
id->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < (int) getBlockSize(block); i++)
|
for (int i = 0; i < static_cast<int>(getBlockSize(block)); i++)
|
||||||
for (const auto &it : v_temporary_terms[block][i])
|
for (const auto &it : v_temporary_terms[block][i])
|
||||||
it->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
it->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||||
v_temporary_terms_inuse[block] = temporary_terms_in_use;
|
v_temporary_terms_inuse[block] = temporary_terms_in_use;
|
||||||
|
@ -454,7 +454,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
int equation_ID = getBlockEquationID(block, i);
|
int equation_ID = getBlockEquationID(block, i);
|
||||||
EquationType equ_type = getBlockEquationType(block, i);
|
EquationType equ_type = getBlockEquationType(block, i);
|
||||||
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
tmp_output.str("");
|
tmp_output.str("");
|
||||||
|
@ -482,7 +482,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||||
output << endl << " ";
|
output << endl << " ";
|
||||||
tmp_output.str("");
|
tmp_output.str("");
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||||
|
@ -793,7 +793,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
fjmp_if_eval.write(code_file, instruction_number);
|
fjmp_if_eval.write(code_file, instruction_number);
|
||||||
int prev_instruction_number = instruction_number;
|
int prev_instruction_number = instruction_number;
|
||||||
|
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
//The Temporary terms
|
//The Temporary terms
|
||||||
temporary_terms_t tt2;
|
temporary_terms_t tt2;
|
||||||
|
@ -804,10 +804,10 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
||||||
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
|
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
|
||||||
|
|
||||||
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find(it->idx)->second));
|
FNUMEXPR_ fnumexpr(TemporaryTerm, static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
it->compile(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
|
it->compile(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
|
||||||
FSTPST_ fstpst((int)(map_idx.find(it->idx)->second));
|
FSTPST_ fstpst(static_cast<int>(map_idx.find(it->idx)->second));
|
||||||
fstpst.write(code_file, instruction_number);
|
fstpst.write(code_file, instruction_number);
|
||||||
// Insert current node into tt2
|
// Insert current node into tt2
|
||||||
tt2.insert(it);
|
tt2.insert(it);
|
||||||
|
@ -829,7 +829,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
}
|
}
|
||||||
if (equ_type == E_EVALUATE)
|
if (equ_type == E_EVALUATE)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||||
|
@ -837,7 +837,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
}
|
}
|
||||||
else if (equ_type == E_EVALUATE_S)
|
else if (equ_type == E_EVALUATE_S)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||||
|
@ -846,7 +846,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
break;
|
break;
|
||||||
case SOLVE_BACKWARD_COMPLETE:
|
case SOLVE_BACKWARD_COMPLETE:
|
||||||
case SOLVE_FORWARD_COMPLETE:
|
case SOLVE_FORWARD_COMPLETE:
|
||||||
if (i < (int) block_recursive)
|
if (i < static_cast<int>(block_recursive))
|
||||||
goto evaluation;
|
goto evaluation;
|
||||||
variable_ID = getBlockVariableID(block, i);
|
variable_ID = getBlockVariableID(block, i);
|
||||||
equation_ID = getBlockEquationID(block, i);
|
equation_ID = getBlockEquationID(block, i);
|
||||||
|
@ -857,7 +857,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
end:
|
end:
|
||||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||||
|
@ -905,12 +905,12 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
{
|
{
|
||||||
if (!Uf[eqr].Ufl)
|
if (!Uf[eqr].Ufl)
|
||||||
{
|
{
|
||||||
Uf[eqr].Ufl = (Uff_l *) malloc(sizeof(Uff_l));
|
Uf[eqr].Ufl = static_cast<Uff_l *>(malloc(sizeof(Uff_l)));
|
||||||
Uf[eqr].Ufl_First = Uf[eqr].Ufl;
|
Uf[eqr].Ufl_First = Uf[eqr].Ufl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Uf[eqr].Ufl->pNext = (Uff_l *) malloc(sizeof(Uff_l));
|
Uf[eqr].Ufl->pNext = static_cast<Uff_l *>(malloc(sizeof(Uff_l)));
|
||||||
Uf[eqr].Ufl = Uf[eqr].Ufl->pNext;
|
Uf[eqr].Ufl = Uf[eqr].Ufl->pNext;
|
||||||
}
|
}
|
||||||
Uf[eqr].Ufl->pNext = nullptr;
|
Uf[eqr].Ufl->pNext = nullptr;
|
||||||
|
@ -924,9 +924,9 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
count_u++;
|
count_u++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
if (i >= (int) block_recursive)
|
if (i >= static_cast<int>(block_recursive))
|
||||||
{
|
{
|
||||||
FLDR_ fldr(i-block_recursive);
|
FLDR_ fldr(i-block_recursive);
|
||||||
fldr.write(code_file, instruction_number);
|
fldr.write(code_file, instruction_number);
|
||||||
|
@ -984,7 +984,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
temporary_terms_t tt2, tt3;
|
temporary_terms_t tt2, tt3;
|
||||||
deriv_node_temp_terms_t tef_terms2;
|
deriv_node_temp_terms_t tef_terms2;
|
||||||
|
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < static_cast<int>(block_size); i++)
|
||||||
{
|
{
|
||||||
if (v_temporary_terms_local[block].size())
|
if (v_temporary_terms_local[block].size())
|
||||||
{
|
{
|
||||||
|
@ -993,12 +993,12 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
|
||||||
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms2);
|
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms2);
|
||||||
|
|
||||||
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx2[block].find(it->idx)->second));
|
FNUMEXPR_ fnumexpr(TemporaryTerm, static_cast<int>(map_idx2[block].find(it->idx)->second));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
|
|
||||||
it->compile(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms);
|
it->compile(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms);
|
||||||
|
|
||||||
FSTPST_ fstpst((int)(map_idx2[block].find(it->idx)->second));
|
FSTPST_ fstpst(static_cast<int>(map_idx2[block].find(it->idx)->second));
|
||||||
fstpst.write(code_file, instruction_number);
|
fstpst.write(code_file, instruction_number);
|
||||||
// Insert current node into tt2
|
// Insert current node into tt2
|
||||||
tt3.insert(it);
|
tt3.insert(it);
|
||||||
|
@ -1021,7 +1021,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
}
|
}
|
||||||
if (equ_type == E_EVALUATE)
|
if (equ_type == E_EVALUATE)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
|
@ -1029,7 +1029,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
}
|
}
|
||||||
else if (equ_type == E_EVALUATE_S)
|
else if (equ_type == E_EVALUATE_S)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
|
@ -1038,7 +1038,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
break;
|
break;
|
||||||
case SOLVE_BACKWARD_COMPLETE:
|
case SOLVE_BACKWARD_COMPLETE:
|
||||||
case SOLVE_FORWARD_COMPLETE:
|
case SOLVE_FORWARD_COMPLETE:
|
||||||
if (i < (int) block_recursive)
|
if (i < static_cast<int>(block_recursive))
|
||||||
goto evaluation_l;
|
goto evaluation_l;
|
||||||
variable_ID = getBlockVariableID(block, i);
|
variable_ID = getBlockVariableID(block, i);
|
||||||
equation_ID = getBlockEquationID(block, i);
|
equation_ID = getBlockEquationID(block, i);
|
||||||
|
@ -1049,7 +1049,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
end_l:
|
end_l:
|
||||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||||
lhs = eq_node->arg1;
|
lhs = eq_node->arg1;
|
||||||
rhs = eq_node->arg2;
|
rhs = eq_node->arg2;
|
||||||
lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
|
@ -1155,12 +1155,12 @@ StaticModel::Write_Inf_To_Bin_File_Block(const string &basename, const int &num,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = block_recursive; j < (int) block_size; j++)
|
for (j = block_recursive; j < static_cast<int>(block_size); j++)
|
||||||
{
|
{
|
||||||
unsigned int varr = getBlockVariableID(num, j);
|
unsigned int varr = getBlockVariableID(num, j);
|
||||||
SaveCode.write(reinterpret_cast<char *>(&varr), sizeof(varr));
|
SaveCode.write(reinterpret_cast<char *>(&varr), sizeof(varr));
|
||||||
}
|
}
|
||||||
for (j = block_recursive; j < (int) block_size; j++)
|
for (j = block_recursive; j < static_cast<int>(block_size); j++)
|
||||||
{
|
{
|
||||||
unsigned int eqr = getBlockEquationID(num, j);
|
unsigned int eqr = getBlockEquationID(num, j);
|
||||||
SaveCode.write(reinterpret_cast<char *>(&eqr), sizeof(eqr));
|
SaveCode.write(reinterpret_cast<char *>(&eqr), sizeof(eqr));
|
||||||
|
@ -2106,7 +2106,7 @@ StaticModel::writeStaticBlockMFSFile(const string &basename) const
|
||||||
|
|
||||||
unsigned int nb_blocks = getNbBlocks();
|
unsigned int nb_blocks = getNbBlocks();
|
||||||
|
|
||||||
for (int b = 0; b < (int) nb_blocks; b++)
|
for (int b = 0; b < static_cast<int>(nb_blocks); b++)
|
||||||
{
|
{
|
||||||
|
|
||||||
set<int> local_var;
|
set<int> local_var;
|
||||||
|
@ -2119,7 +2119,7 @@ StaticModel::writeStaticBlockMFSFile(const string &basename) const
|
||||||
{
|
{
|
||||||
output << " y_tmp = " << basename << ".block.static_" << b+1 << "(y, x, params);" << endl;
|
output << " y_tmp = " << basename << ".block.static_" << b+1 << "(y, x, params);" << endl;
|
||||||
ostringstream tmp;
|
ostringstream tmp;
|
||||||
for (int i = 0; i < (int) getBlockSize(b); i++)
|
for (int i = 0; i < static_cast<int>(getBlockSize(b)); i++)
|
||||||
tmp << " " << getBlockVariableID(b, i)+1;
|
tmp << " " << getBlockVariableID(b, i)+1;
|
||||||
output << " var_index = [" << tmp.str() << "];" << endl
|
output << " var_index = [" << tmp.str() << "];" << endl
|
||||||
<< " residual = y(var_index) - y_tmp(var_index);" << endl
|
<< " residual = y(var_index) - y_tmp(var_index);" << endl
|
||||||
|
@ -2146,7 +2146,7 @@ StaticModel::writeOutput(ostream &output, bool block) const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int nb_blocks = getNbBlocks();
|
unsigned int nb_blocks = getNbBlocks();
|
||||||
for (int b = 0; b < (int) nb_blocks; b++)
|
for (int b = 0; b < static_cast<int>(nb_blocks); b++)
|
||||||
{
|
{
|
||||||
BlockSimulationType simulation_type = getBlockSimulationType(b);
|
BlockSimulationType simulation_type = getBlockSimulationType(b);
|
||||||
unsigned int block_size = getBlockSize(b);
|
unsigned int block_size = getBlockSize(b);
|
||||||
|
|
|
@ -330,13 +330,13 @@ public:
|
||||||
int
|
int
|
||||||
getBlockInitialEquationID(int block_number, int equation_number) const override
|
getBlockInitialEquationID(int block_number, int equation_number) const override
|
||||||
{
|
{
|
||||||
return ((int) inv_equation_reordered[equation_number] - (int) get<1>(block_type_firstequation_size_mfs[block_number]));
|
return (static_cast<int>(inv_equation_reordered[equation_number]) - static_cast<int>(get<1>(block_type_firstequation_size_mfs[block_number])));
|
||||||
};
|
};
|
||||||
//! Return the position of variable_number in the block number belonging to the block block_number
|
//! Return the position of variable_number in the block number belonging to the block block_number
|
||||||
int
|
int
|
||||||
getBlockInitialVariableID(int block_number, int variable_number) const override
|
getBlockInitialVariableID(int block_number, int variable_number) const override
|
||||||
{
|
{
|
||||||
return ((int) inv_variable_reordered[variable_number] - (int) get<1>(block_type_firstequation_size_mfs[block_number]));
|
return (static_cast<int>(inv_variable_reordered[variable_number]) - static_cast<int>(get<1>(block_type_firstequation_size_mfs[block_number])));
|
||||||
};
|
};
|
||||||
//! Return the position of variable_number in the block number belonging to the block block_number
|
//! Return the position of variable_number in the block number belonging to the block block_number
|
||||||
int
|
int
|
||||||
|
|
|
@ -354,7 +354,7 @@ TrendComponentModelTable::writeOutput(const string &basename, ostream &output) c
|
||||||
{
|
{
|
||||||
int eqn, lag, lhs_symb_id;
|
int eqn, lag, lhs_symb_id;
|
||||||
tie (eqn, lag, lhs_symb_id) = it.first;
|
tie (eqn, lag, lhs_symb_id) = it.first;
|
||||||
int colidx = (int) distance(nontarget_lhs_vec.begin(), find(nontarget_lhs_vec.begin(), nontarget_lhs_vec.end(), lhs_symb_id));
|
int colidx = static_cast<int>(distance(nontarget_lhs_vec.begin(), find(nontarget_lhs_vec.begin(), nontarget_lhs_vec.end(), lhs_symb_id)));
|
||||||
ar_ec_output << " AR(" << eqn + 1 << ", " << colidx + 1 << ", " << lag << ") = ";
|
ar_ec_output << " AR(" << eqn + 1 << ", " << colidx + 1 << ", " << lag << ") = ";
|
||||||
it.second->writeOutput(ar_ec_output, ExprNodeOutputType::matlabDynamicModel);
|
it.second->writeOutput(ar_ec_output, ExprNodeOutputType::matlabDynamicModel);
|
||||||
ar_ec_output << ";" << endl;
|
ar_ec_output << ";" << endl;
|
||||||
|
@ -527,7 +527,7 @@ VarModelTable::writeOutput(const string &basename, ostream &output) const
|
||||||
{
|
{
|
||||||
int eqn, lag, lhs_symb_id;
|
int eqn, lag, lhs_symb_id;
|
||||||
tie (eqn, lag, lhs_symb_id) = it.first;
|
tie (eqn, lag, lhs_symb_id) = it.first;
|
||||||
int colidx = (int) distance(lhs.begin(), find(lhs.begin(), lhs.end(), lhs_symb_id));
|
int colidx = static_cast<int>(distance(lhs.begin(), find(lhs.begin(), lhs.end(), lhs_symb_id)));
|
||||||
ar_output << " ar(" << eqn + 1 << ", " << colidx + 1 << ", " << lag << ") = ";
|
ar_output << " ar(" << eqn + 1 << ", " << colidx + 1 << ", " << lag << ") = ";
|
||||||
it.second->writeOutput(ar_output, ExprNodeOutputType::matlabDynamicModel);
|
it.second->writeOutput(ar_output, ExprNodeOutputType::matlabDynamicModel);
|
||||||
ar_output << ";" << endl;
|
ar_output << ";" << endl;
|
||||||
|
|
|
@ -108,7 +108,7 @@ SymbolTable::freeze() noexcept(false)
|
||||||
|
|
||||||
frozen = true;
|
frozen = true;
|
||||||
|
|
||||||
for (int i = 0; i < (int) symbol_table.size(); i++)
|
for (int i = 0; i < static_cast<int>(symbol_table.size()); i++)
|
||||||
{
|
{
|
||||||
int tsi;
|
int tsi;
|
||||||
switch (getType(i))
|
switch (getType(i))
|
||||||
|
@ -168,22 +168,22 @@ SymbolTable::getID(SymbolType type, int tsid) const noexcept(false)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SymbolType::endogenous:
|
case SymbolType::endogenous:
|
||||||
if (tsid < 0 || tsid >= (int) endo_ids.size())
|
if (tsid < 0 || tsid >= static_cast<int>(endo_ids.size()))
|
||||||
throw UnknownTypeSpecificIDException(tsid, type);
|
throw UnknownTypeSpecificIDException(tsid, type);
|
||||||
else
|
else
|
||||||
return endo_ids[tsid];
|
return endo_ids[tsid];
|
||||||
case SymbolType::exogenous:
|
case SymbolType::exogenous:
|
||||||
if (tsid < 0 || tsid >= (int) exo_ids.size())
|
if (tsid < 0 || tsid >= static_cast<int>(exo_ids.size()))
|
||||||
throw UnknownTypeSpecificIDException(tsid, type);
|
throw UnknownTypeSpecificIDException(tsid, type);
|
||||||
else
|
else
|
||||||
return exo_ids[tsid];
|
return exo_ids[tsid];
|
||||||
case SymbolType::exogenousDet:
|
case SymbolType::exogenousDet:
|
||||||
if (tsid < 0 || tsid >= (int) exo_det_ids.size())
|
if (tsid < 0 || tsid >= static_cast<int>(exo_det_ids.size()))
|
||||||
throw UnknownTypeSpecificIDException(tsid, type);
|
throw UnknownTypeSpecificIDException(tsid, type);
|
||||||
else
|
else
|
||||||
return exo_det_ids[tsid];
|
return exo_det_ids[tsid];
|
||||||
case SymbolType::parameter:
|
case SymbolType::parameter:
|
||||||
if (tsid < 0 || tsid >= (int) param_ids.size())
|
if (tsid < 0 || tsid >= static_cast<int>(param_ids.size()))
|
||||||
throw UnknownTypeSpecificIDException(tsid, type);
|
throw UnknownTypeSpecificIDException(tsid, type);
|
||||||
else
|
else
|
||||||
return param_ids[tsid];
|
return param_ids[tsid];
|
||||||
|
@ -347,7 +347,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
|
||||||
if (aux_vars.size() == 0)
|
if (aux_vars.size() == 0)
|
||||||
output << "M_.aux_vars = [];" << endl;
|
output << "M_.aux_vars = [];" << endl;
|
||||||
else
|
else
|
||||||
for (int i = 0; i < (int) aux_vars.size(); i++)
|
for (int i = 0; i < static_cast<int>(aux_vars.size()); i++)
|
||||||
{
|
{
|
||||||
output << "M_.aux_vars(" << i+1 << ").endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id())+1 << ";" << endl
|
output << "M_.aux_vars(" << i+1 << ").endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id())+1 << ";" << endl
|
||||||
<< "M_.aux_vars(" << i+1 << ").type = " << aux_vars[i].get_type_id() << ";" << endl;
|
<< "M_.aux_vars(" << i+1 << ").type = " << aux_vars[i].get_type_id() << ";" << endl;
|
||||||
|
@ -475,7 +475,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
|
||||||
if (aux_vars.size() > 0)
|
if (aux_vars.size() > 0)
|
||||||
{
|
{
|
||||||
output << "struct aux_vars_t *av[" << aux_vars.size() << "];" << endl;
|
output << "struct aux_vars_t *av[" << aux_vars.size() << "];" << endl;
|
||||||
for (int i = 0; i < (int) aux_vars.size(); i++)
|
for (int i = 0; i < static_cast<int>(aux_vars.size()); i++)
|
||||||
{
|
{
|
||||||
output << "av[" << i << "].endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
|
output << "av[" << i << "].endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
|
||||||
<< "av[" << i << "].type = " << aux_vars[i].get_type_id() << ";" << endl;
|
<< "av[" << i << "].type = " << aux_vars[i].get_type_id() << ";" << endl;
|
||||||
|
@ -580,7 +580,7 @@ SymbolTable::writeCCOutput(ostream &output) const noexcept(false)
|
||||||
output << R"(param_names[")" << getName(param_ids[id]) << R"("] = )" << id << ";" << endl;
|
output << R"(param_names[")" << getName(param_ids[id]) << R"("] = )" << id << ";" << endl;
|
||||||
|
|
||||||
// Write the auxiliary variable table
|
// Write the auxiliary variable table
|
||||||
for (int i = 0; i < (int) aux_vars.size(); i++)
|
for (int i = 0; i < static_cast<int>(aux_vars.size()); i++)
|
||||||
{
|
{
|
||||||
output << "aux_vars_t av" << i << ";" << endl;
|
output << "aux_vars_t av" << i << ";" << endl;
|
||||||
output << "av" << i << ".endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
|
output << "av" << i << ".endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
|
||||||
|
@ -987,7 +987,7 @@ SymbolTable::addObservedVariable(int symb_id) noexcept(false)
|
||||||
int
|
int
|
||||||
SymbolTable::observedVariablesNbr() const
|
SymbolTable::observedVariablesNbr() const
|
||||||
{
|
{
|
||||||
return (int) varobs.size();
|
return static_cast<int>(varobs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1001,7 +1001,7 @@ SymbolTable::getObservedVariableIndex(int symb_id) const
|
||||||
{
|
{
|
||||||
auto it = find(varobs.begin(), varobs.end(), symb_id);
|
auto it = find(varobs.begin(), varobs.end(), symb_id);
|
||||||
assert(it != varobs.end());
|
assert(it != varobs.end());
|
||||||
return (int) (it - varobs.begin());
|
return static_cast<int>(it - varobs.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1015,7 +1015,7 @@ SymbolTable::addObservedExogenousVariable(int symb_id) noexcept(false)
|
||||||
int
|
int
|
||||||
SymbolTable::observedExogenousVariablesNbr() const
|
SymbolTable::observedExogenousVariablesNbr() const
|
||||||
{
|
{
|
||||||
return (int) varexobs.size();
|
return static_cast<int>(varexobs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1029,7 +1029,7 @@ SymbolTable::getObservedExogenousVariableIndex(int symb_id) const
|
||||||
{
|
{
|
||||||
auto it = find(varexobs.begin(), varexobs.end(), symb_id);
|
auto it = find(varexobs.begin(), varexobs.end(), symb_id);
|
||||||
assert(it != varexobs.end());
|
assert(it != varexobs.end());
|
||||||
return (int) (it - varexobs.begin());
|
return static_cast<int>(it - varexobs.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
vector <int>
|
vector <int>
|
||||||
|
|
|
@ -422,7 +422,7 @@ public:
|
||||||
inline void
|
inline void
|
||||||
SymbolTable::validateSymbID(int symb_id) const noexcept(false)
|
SymbolTable::validateSymbID(int symb_id) const noexcept(false)
|
||||||
{
|
{
|
||||||
if (symb_id < 0 || symb_id > (int) symbol_table.size())
|
if (symb_id < 0 || symb_id > static_cast<int>(symbol_table.size()))
|
||||||
throw UnknownSymbolIDException(symb_id);
|
throw UnknownSymbolIDException(symb_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ MacroDriver::begin_if(const MacroValuePtr &value) noexcept(false)
|
||||||
auto ival = dynamic_pointer_cast<IntMV>(value);
|
auto ival = dynamic_pointer_cast<IntMV>(value);
|
||||||
if (!ival)
|
if (!ival)
|
||||||
throw MacroValue::TypeError("Argument of @#if must be an integer");
|
throw MacroValue::TypeError("Argument of @#if must be an integer");
|
||||||
last_if = (bool) ival->value;
|
last_if = static_cast<bool>(ival->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -19,5 +19,7 @@ libmacro_a_CPPFLAGS = $(BOOST_CPPFLAGS) -I..
|
||||||
MacroFlex.cc: MacroFlex.ll
|
MacroFlex.cc: MacroFlex.ll
|
||||||
$(LEX) -o MacroFlex.cc MacroFlex.ll
|
$(LEX) -o MacroFlex.cc MacroFlex.ll
|
||||||
|
|
||||||
|
libmacro_a-MacroFlex.$(OBJEXT): CXXFLAGS += -Wno-old-style-cast
|
||||||
|
|
||||||
MacroBison.cc MacroBison.hh location.hh stack.hh position.hh: MacroBison.yy
|
MacroBison.cc MacroBison.hh location.hh stack.hh position.hh: MacroBison.yy
|
||||||
$(YACC) -W -o MacroBison.cc MacroBison.yy
|
$(YACC) -W -o MacroBison.cc MacroBison.yy
|
||||||
|
|
Loading…
Reference in New Issue