Rename EquationType::evaluate_s to evaluateRenormalized, for clarity

issue#70
Sébastien Villemot 2020-05-20 11:49:32 +02:00
parent c6a17913b4
commit a6d9ba6e55
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
5 changed files with 12 additions and 12 deletions

View File

@ -109,7 +109,7 @@ enum class EquationType
{ {
unknown, //!< Unknown equation type unknown, //!< Unknown equation type
evaluate, //!< Simple evaluation, normalized variable on left-hand side (written as such by the user) evaluate, //!< Simple evaluation, normalized variable on left-hand side (written as such by the user)
evaluate_s, //!< Simple evaluation, normalized variable on left-hand side (normalization computed by the preprocessor) evaluateRenormalized, //!< Simple evaluation, normalized variable on left-hand side (normalization computed by the preprocessor)
solve //!< No simple evaluation of the equation, it has to be solved solve //!< No simple evaluation of the equation, it has to be solved
}; };

View File

@ -394,7 +394,7 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
case BlockSimulationType::evaluateBackward: case BlockSimulationType::evaluateBackward:
case BlockSimulationType::evaluateForward: case BlockSimulationType::evaluateForward:
evaluation: evaluation:
if (equ_type == EquationType::evaluate_s) if (equ_type == EquationType::evaluateRenormalized)
{ {
e = getBlockEquationRenormalizedExpr(blk, eq); e = getBlockEquationRenormalizedExpr(blk, eq);
lhs = e->arg1; lhs = e->arg1;
@ -955,7 +955,7 @@ DynamicModel::writeDynamicBlockBytecode(const string &basename, bool linear_deco
rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, true, false); rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, true, false);
lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, true, false); lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, true, false);
} }
else if (equ_type == EquationType::evaluate_s) else if (equ_type == EquationType::evaluateRenormalized)
{ {
eq_node = getBlockEquationRenormalizedExpr(block, i); eq_node = getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->arg1; lhs = eq_node->arg1;
@ -4449,7 +4449,7 @@ DynamicModel::determineBlockDerivativesType(int blk)
if (int var_orig = getBlockVariableID(blk, var); if (int var_orig = getBlockVariableID(blk, var);
endos_and_lags.find({ var_orig, lag }) != endos_and_lags.end()) endos_and_lags.find({ var_orig, lag }) != endos_and_lags.end())
{ {
if (getBlockEquationType(blk, eq) == EquationType::evaluate_s if (getBlockEquationType(blk, eq) == EquationType::evaluateRenormalized
&& eq < nb_recursive) && eq < nb_recursive)
/* Its a normalized recursive equation, we have to recompute /* Its a normalized recursive equation, we have to recompute
the derivative using the chain rule */ the derivative using the chain rule */
@ -4483,7 +4483,7 @@ DynamicModel::computeChainRuleJacobian()
for (int i = 0; i < nb_recursives; i++) for (int i = 0; i < nb_recursives; i++)
{ {
int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0); int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0);
if (getBlockEquationType(blk, i) == EquationType::evaluate_s) if (getBlockEquationType(blk, i) == EquationType::evaluateRenormalized)
recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i); recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i);
else else
recursive_vars[deriv_id] = getBlockEquationExpr(blk, i); recursive_vars[deriv_id] = getBlockEquationExpr(blk, i);

View File

@ -542,7 +542,7 @@ ModelTree::equationTypeDetermination(const map<tuple<int, int, int>, expr_t> &fi
{ {
normalized_eq = equations[eq]->normalizeEquation(symbol_table.getID(SymbolType::endogenous, var), 0); normalized_eq = equations[eq]->normalizeEquation(symbol_table.getID(SymbolType::endogenous, var), 0);
if ((mfs == 2 && variable_not_in_derivative) || mfs == 3) if ((mfs == 2 && variable_not_in_derivative) || mfs == 3)
Equation_Simulation_Type = EquationType::evaluate_s; Equation_Simulation_Type = EquationType::evaluateRenormalized;
} }
catch (ExprNode::NormalizationFailed &e) catch (ExprNode::NormalizationFailed &e)
{ {
@ -643,7 +643,7 @@ ModelTree::computeSimulationTypeOfBlock(int blk)
else else
{ {
bool can_eval = (getBlockEquationType(blk, 0) == EquationType::evaluate bool can_eval = (getBlockEquationType(blk, 0) == EquationType::evaluate
|| getBlockEquationType(blk, 0) == EquationType::evaluate_s); || getBlockEquationType(blk, 0) == EquationType::evaluateRenormalized);
if (blocks[blk].max_endo_lead > 0) if (blocks[blk].max_endo_lead > 0)
type = can_eval ? BlockSimulationType::evaluateBackward : type = can_eval ? BlockSimulationType::evaluateBackward :
BlockSimulationType::solveBackwardSimple; BlockSimulationType::solveBackwardSimple;

View File

@ -353,7 +353,7 @@ protected:
bool bool
isBlockEquationRenormalized(int blk, int eq) const isBlockEquationRenormalized(int blk, int eq) const
{ {
return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].first == EquationType::evaluate_s; return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].first == EquationType::evaluateRenormalized;
}; };
//! Return the expr_t of equation belonging to the block //! Return the expr_t of equation belonging to the block
BinaryOpNode * BinaryOpNode *

View File

@ -218,7 +218,7 @@ StaticModel::writeStaticPerBlockMFiles(const string &basename) const
case BlockSimulationType::evaluateBackward: case BlockSimulationType::evaluateBackward:
case BlockSimulationType::evaluateForward: case BlockSimulationType::evaluateForward:
evaluation: evaluation:
if (equ_type == EquationType::evaluate_s) if (equ_type == EquationType::evaluateRenormalized)
{ {
e = getBlockEquationRenormalizedExpr(blk, eq); e = getBlockEquationRenormalizedExpr(blk, eq);
lhs = e->arg1; lhs = e->arg1;
@ -569,7 +569,7 @@ StaticModel::writeStaticBlockBytecode(const string &basename) const
rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false); rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false); lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
} }
else if (equ_type == EquationType::evaluate_s) else if (equ_type == EquationType::evaluateRenormalized)
{ {
eq_node = getBlockEquationRenormalizedExpr(block, i); eq_node = getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->arg1; lhs = eq_node->arg1;
@ -745,7 +745,7 @@ StaticModel::writeStaticBlockBytecode(const string &basename) const
rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false); rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false); lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
} }
else if (equ_type == EquationType::evaluate_s) else if (equ_type == EquationType::evaluateRenormalized)
{ {
eq_node = getBlockEquationRenormalizedExpr(block, i); eq_node = getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->arg1; lhs = eq_node->arg1;
@ -1903,7 +1903,7 @@ StaticModel::computeChainRuleJacobian()
for (int i = 0; i < nb_recursives; i++) for (int i = 0; i < nb_recursives; i++)
{ {
int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0); int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0);
if (getBlockEquationType(blk, i) == EquationType::evaluate_s) if (getBlockEquationType(blk, i) == EquationType::evaluateRenormalized)
recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i); recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i);
else else
recursive_vars[deriv_id] = getBlockEquationExpr(blk, i); recursive_vars[deriv_id] = getBlockEquationExpr(blk, i);