Compare commits
10 Commits
7e6abc97c4
...
378d00fc3a
Author | SHA1 | Date |
---|---|---|
Sébastien Villemot | 378d00fc3a | |
Sébastien Villemot | 045fbaec0e | |
Sébastien Villemot | bffd68e0bf | |
Johannes Pfeifer | 6d9fc367d0 | |
Sébastien Villemot | b2e9ec205e | |
Sébastien Villemot | 5af38c8ced | |
Sébastien Villemot | c2d6ab8ee0 | |
Sébastien Villemot | c5cc61b110 | |
Sébastien Villemot | 5e89921ea1 | |
Sébastien Villemot | b8c521be31 |
|
@ -0,0 +1,9 @@
|
|||
# TODO: add the following check families:
|
||||
# - performance-*
|
||||
# - bugprone-*
|
||||
# - cppcoreguidelines-
|
||||
|
||||
# NB: as of clang-tidy 16, we get several false positives inside boost, notably this one:
|
||||
# https://github.com/llvm/llvm-project/issues/40486
|
||||
|
||||
Checks: 'modernize-*,-modernize-use-trailing-return-type,-clang-diagnostic-unqualified-std-cast-call'
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _BYTECODE_HH
|
||||
#define _BYTECODE_HH
|
||||
#ifndef BYTECODE_HH
|
||||
#define BYTECODE_HH
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
@ -1151,4 +1151,4 @@ BytecodeWriter& operator<<(BytecodeWriter& code_file, const FCALL_& instr);
|
|||
template<>
|
||||
BytecodeWriter& operator<<(BytecodeWriter& code_file, const FBEGINBLOCK_& instr);
|
||||
|
||||
#endif // _BYTECODE_HH
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2007-2022 Dynare Team
|
||||
* Copyright © 2007-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_ENUMS_HH
|
||||
#define _COMMON_ENUMS_HH
|
||||
#ifndef COMMON_ENUMS_HH
|
||||
#define COMMON_ENUMS_HH
|
||||
|
||||
//! Enumeration of possible symbol types
|
||||
/*! Warning: do not to change existing values for 0 to 4: the values matter for homotopy_setup
|
||||
|
@ -151,4 +151,4 @@ enum class PacTargetKind
|
|||
dd
|
||||
};
|
||||
|
||||
#endif // _COMMON_ENUMS_HH
|
||||
#endif
|
||||
|
|
|
@ -1106,7 +1106,7 @@ DynareSensitivityStatement::writeOutput(ostream& output, [[maybe_unused]] const
|
|||
if (auto opt = options_list.get_if<OptionsList::SymbolListVal>("graph_format"))
|
||||
opt->writeOutput("options_.graph_format", output);
|
||||
|
||||
output << "dynare_sensitivity(options_gsa);" << endl;
|
||||
output << "dynare_sensitivity(M_,oo_,options_,bayestopt_,estim_params_,options_gsa);" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2400,8 +2400,8 @@ ModelComparisonStatement::writeJsonOutput(ostream& output) const
|
|||
output << "}";
|
||||
}
|
||||
|
||||
PlannerObjectiveStatement::PlannerObjectiveStatement(const PlannerObjective& model_tree_arg) :
|
||||
model_tree {model_tree_arg}
|
||||
PlannerObjectiveStatement::PlannerObjectiveStatement(unique_ptr<PlannerObjective> model_tree_arg) :
|
||||
model_tree {move(model_tree_arg)}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2409,8 +2409,8 @@ void
|
|||
PlannerObjectiveStatement::checkPass(ModFileStructure& mod_file_struct,
|
||||
[[maybe_unused]] WarningConsolidation& warnings)
|
||||
{
|
||||
assert(model_tree.equation_number() == 1);
|
||||
if (model_tree.exoPresentInEqs())
|
||||
assert(model_tree->equation_number() == 1);
|
||||
if (model_tree->exoPresentInEqs())
|
||||
{
|
||||
cerr << "ERROR: You cannot include exogenous variables (or variables of undeclared type) in "
|
||||
"the planner objective. Please "
|
||||
|
@ -2424,13 +2424,13 @@ PlannerObjectiveStatement::checkPass(ModFileStructure& mod_file_struct,
|
|||
const PlannerObjective&
|
||||
PlannerObjectiveStatement::getPlannerObjective() const
|
||||
{
|
||||
return model_tree;
|
||||
return *model_tree;
|
||||
}
|
||||
|
||||
void
|
||||
PlannerObjectiveStatement::computingPass(const ModFileStructure& mod_file_struct)
|
||||
{
|
||||
model_tree.computingPass(max(3, mod_file_struct.order_option), 0, {}, false, false, false);
|
||||
model_tree->computingPass(max(3, mod_file_struct.order_option), 0, {}, false, false, false);
|
||||
computing_pass_called = true;
|
||||
}
|
||||
|
||||
|
@ -2439,14 +2439,14 @@ PlannerObjectiveStatement::writeOutput(ostream& output, const string& basename,
|
|||
[[maybe_unused]] bool minimal_workspace) const
|
||||
{
|
||||
output << "M_.NNZDerivatives_objective = [";
|
||||
for (int i = 1; i < static_cast<int>(model_tree.getNNZDerivatives().size()); i++)
|
||||
output << (i > model_tree.getComputedDerivsOrder() ? -1 : model_tree.getNNZDerivatives()[i])
|
||||
for (int i = 1; i < static_cast<int>(model_tree->getNNZDerivatives().size()); i++)
|
||||
output << (i > model_tree->getComputedDerivsOrder() ? -1 : model_tree->getNNZDerivatives()[i])
|
||||
<< ";";
|
||||
output << "];" << endl << "M_.objective_tmp_nbr = [";
|
||||
for (const auto& temporary_terms_derivative : model_tree.getTemporaryTermsDerivatives())
|
||||
for (const auto& temporary_terms_derivative : model_tree->getTemporaryTermsDerivatives())
|
||||
output << temporary_terms_derivative.size() << "; ";
|
||||
output << "];" << endl;
|
||||
model_tree.writeStaticFile(basename + ".objective", false, "", {}, false);
|
||||
model_tree->writeStaticFile(basename + ".objective", false, "", {}, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2455,9 +2455,9 @@ PlannerObjectiveStatement::writeJsonOutput(ostream& output) const
|
|||
output << R"({"statementName": "planner_objective")"
|
||||
<< ", ";
|
||||
if (computing_pass_called)
|
||||
model_tree.writeJsonComputingPassOutput(output, false);
|
||||
model_tree->writeJsonComputingPassOutput(output, false);
|
||||
else
|
||||
model_tree.writeJsonOutput(output);
|
||||
model_tree->writeJsonOutput(output);
|
||||
|
||||
output << "}";
|
||||
}
|
||||
|
@ -2941,7 +2941,8 @@ IdentificationStatement::writeOutput(ostream& output, [[maybe_unused]] const str
|
|||
if (auto opt = options_list.get_if<OptionsList::SymbolListVal>("graph_format"))
|
||||
opt->writeOutput("options_.graph_format", output);
|
||||
|
||||
output << "dynare_identification(options_ident);" << endl;
|
||||
output << "dynare_identification(M_,oo_,options_,bayestopt_,estim_params_,"
|
||||
<< "options_ident);" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _COMPUTINGTASKS_HH
|
||||
#define _COMPUTINGTASKS_HH
|
||||
#ifndef COMPUTING_TASKS_HH
|
||||
#define COMPUTING_TASKS_HH
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
|
||||
|
@ -618,11 +619,11 @@ public:
|
|||
class PlannerObjectiveStatement : public Statement
|
||||
{
|
||||
private:
|
||||
PlannerObjective model_tree;
|
||||
unique_ptr<PlannerObjective> model_tree;
|
||||
bool computing_pass_called {false};
|
||||
|
||||
public:
|
||||
explicit PlannerObjectiveStatement(const PlannerObjective& model_tree_arg);
|
||||
explicit PlannerObjectiveStatement(unique_ptr<PlannerObjective> model_tree_arg);
|
||||
/*! \todo check there are only endogenous variables at the current period in the objective
|
||||
(no exogenous, no lead/lag) */
|
||||
void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override;
|
||||
|
@ -631,7 +632,7 @@ public:
|
|||
void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override;
|
||||
void writeJsonOutput(ostream& output) const override;
|
||||
//! Return a reference the Planner Objective model tree
|
||||
const PlannerObjective& getPlannerObjective() const;
|
||||
[[nodiscard]] const PlannerObjective& getPlannerObjective() const;
|
||||
};
|
||||
|
||||
class BVARDensityStatement : public Statement
|
||||
|
|
|
@ -166,7 +166,6 @@ ConfigFile::getConfigFileInfo(const filesystem::path& config_file)
|
|||
if (!configFile.is_open())
|
||||
{
|
||||
cerr << "ERROR: Couldn't open file " << config_file.string() << endl;
|
||||
;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_FILE_HH
|
||||
#define _CONFIG_FILE_HH
|
||||
#ifndef CONFIG_FILE_HH
|
||||
#define CONFIG_FILE_HH
|
||||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
|
@ -145,4 +145,4 @@ public:
|
|||
void writeEndParallel(ostream& output) const;
|
||||
};
|
||||
|
||||
#endif // ! CONFIG_FILE_HH
|
||||
#endif
|
||||
|
|
|
@ -205,7 +205,7 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
|
|||
|
||||
// To treat commutativity of "+"
|
||||
// Nodes iArg1 and iArg2 are sorted by index
|
||||
if (iArg1->idx > iArg2->idx && !no_commutativity)
|
||||
if (iArg1->idx > iArg2->idx && !no_commutativity) // NOLINT(clang-analyzer-core.NullDereference)
|
||||
swap(iArg1, iArg2);
|
||||
return AddBinaryOp(iArg1, BinaryOpcode::plus, iArg2);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ DataTree::AddTimes(expr_t iArg1, expr_t iArg2)
|
|||
|
||||
// To treat commutativity of "*"
|
||||
// Nodes iArg1 and iArg2 are sorted by index
|
||||
if (iArg1->idx > iArg2->idx && !no_commutativity)
|
||||
if (iArg1->idx > iArg2->idx && !no_commutativity) // NOLINT(clang-analyzer-core.NullDereference)
|
||||
swap(iArg1, iArg2);
|
||||
return AddBinaryOp(iArg1, BinaryOpcode::times, iArg2);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DATATREE_HH
|
||||
#define _DATATREE_HH
|
||||
#ifndef DATA_TREE_HH
|
||||
#define DATA_TREE_HH
|
||||
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
|
@ -431,7 +431,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int
|
|||
{
|
||||
try
|
||||
{
|
||||
double argval = arg->eval({});
|
||||
double argval = arg->eval({}); // NOLINT(clang-analyzer-core.CallAndMessage)
|
||||
double val = UnaryOpNode::eval_opcode(op_code, argval);
|
||||
return AddPossiblyNegativeConstant(val);
|
||||
}
|
||||
|
@ -460,8 +460,8 @@ DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerD
|
|||
// Try to reduce to a constant
|
||||
try
|
||||
{
|
||||
double argval1 = arg1->eval({});
|
||||
double argval2 = arg2->eval({});
|
||||
double argval1 = arg1->eval({}); // NOLINT(clang-analyzer-core.CallAndMessage)
|
||||
double argval2 = arg2->eval({}); // NOLINT(clang-analyzer-core.CallAndMessage)
|
||||
double val = BinaryOpNode::eval_opcode(argval1, op_code, argval2, powerDerivOrder);
|
||||
return AddPossiblyNegativeConstant(val);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
#include <ranges>
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
|
@ -1355,10 +1356,10 @@ DynamicModel::fillVarModelTableFromOrigModel() const
|
|||
<< eqn << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
orig_diff_var_vec.push_back(diff_set.begin()->first);
|
||||
orig_diff_var_vec.emplace_back(diff_set.begin()->first);
|
||||
}
|
||||
else
|
||||
orig_diff_var_vec.push_back(nullopt);
|
||||
orig_diff_var_vec.emplace_back(nullopt);
|
||||
}
|
||||
|
||||
if (eqns.size() != lhs.size())
|
||||
|
@ -1702,10 +1703,10 @@ DynamicModel::fillTrendComponentModelTableFromOrigModel() const
|
|||
<< eqn << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
orig_diff_var_vec.push_back(diff_set.begin()->first);
|
||||
orig_diff_var_vec.emplace_back(diff_set.begin()->first);
|
||||
}
|
||||
else
|
||||
orig_diff_var_vec.push_back(nullopt);
|
||||
orig_diff_var_vec.emplace_back(nullopt);
|
||||
}
|
||||
|
||||
if (eqns.size() != lhs.size())
|
||||
|
@ -2730,7 +2731,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel& static_model)
|
|||
else
|
||||
{
|
||||
orig_endo_nbr++;
|
||||
neweqs_lineno.push_back(nullopt);
|
||||
neweqs_lineno.emplace_back(nullopt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3485,18 +3486,18 @@ void
|
|||
DynamicModel::detrendEquations()
|
||||
{
|
||||
// We go backwards in the list of trend_vars, to deal correctly with I(2) processes
|
||||
for (auto it = nonstationary_symbols_map.crbegin(); it != nonstationary_symbols_map.crend(); ++it)
|
||||
for (const auto& it : std::ranges::reverse_view(nonstationary_symbols_map))
|
||||
{
|
||||
for (auto& equation : equations)
|
||||
{
|
||||
equation = dynamic_cast<BinaryOpNode*>(
|
||||
equation->detrend(it->first, it->second.first, it->second.second));
|
||||
equation->detrend(it.first, it.second.first, it.second.second));
|
||||
assert(equation);
|
||||
}
|
||||
for (auto& equation : static_only_equations)
|
||||
{
|
||||
equation = dynamic_cast<BinaryOpNode*>(
|
||||
equation->detrend(it->first, it->second.first, it->second.second));
|
||||
equation->detrend(it.first, it.second.first, it.second.second));
|
||||
assert(equation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DYNAMICMODEL_HH
|
||||
#define _DYNAMICMODEL_HH
|
||||
#ifndef DYNAMIC_MODEL_HH
|
||||
#define DYNAMIC_MODEL_HH
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EQUATION_TAGS_HH
|
||||
#define _EQUATION_TAGS_HH
|
||||
#ifndef EQUATION_TAGS_HH
|
||||
#define EQUATION_TAGS_HH
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
|
|
@ -3727,7 +3727,7 @@ UnaryOpNode::substituteDiff(const lag_equivalence_table_t& nodes, subst_table_t&
|
|||
if (vn)
|
||||
symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, rit->second,
|
||||
vn->symb_id, vn->lag);
|
||||
else
|
||||
else // NOLINTNEXTLINE(clang-analyzer-core.NullDereference)
|
||||
symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, rit->second);
|
||||
|
||||
// make originating aux var & equation
|
||||
|
@ -3745,8 +3745,10 @@ UnaryOpNode::substituteDiff(const lag_equivalence_table_t& nodes, subst_table_t&
|
|||
for (int i = last_index; i > rit->first; i--)
|
||||
{
|
||||
if (i == last_index)
|
||||
// NOLINTBEGIN(clang-analyzer-core.NullDereference)
|
||||
symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(argsubst->idx, rit->second,
|
||||
last_aux_var->symb_id, -1);
|
||||
// NOLINTEND(clang-analyzer-core.NullDereference)
|
||||
else
|
||||
symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(
|
||||
new_aux_var->idx, rit->second, last_aux_var->symb_id, -1);
|
||||
|
@ -3884,6 +3886,7 @@ UnaryOpNode::substituteUnaryOpNodes(const lag_equivalence_table_t& nodes,
|
|||
}
|
||||
else
|
||||
subst_table[rit->second]
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
|
||||
= dynamic_cast<VariableNode*>(aux_var->decreaseLeadsLags(base_index - rit->first));
|
||||
|
||||
assert(subst_table.contains(this));
|
||||
|
@ -5692,6 +5695,7 @@ BinaryOpNode::getPacAREC(
|
|||
vector<tuple<int, int, optional<int>, double>> linear_combination;
|
||||
try
|
||||
{
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
|
||||
auto [vid, lag, pid, constant] = term->matchVariableTimesConstantTimesParam(true);
|
||||
linear_combination.emplace_back(vid.value(), lag, move(pid), constant);
|
||||
}
|
||||
|
@ -5773,6 +5777,7 @@ BinaryOpNode::isParamTimesEndogExpr() const
|
|||
}
|
||||
else
|
||||
{
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
|
||||
arg1->collectDynamicVariables(SymbolType::endogenous, endogs);
|
||||
arg1->collectDynamicVariables(SymbolType::exogenous, exogs);
|
||||
arg1->collectVariables(SymbolType::parameter, params);
|
||||
|
@ -9311,6 +9316,7 @@ BinaryOpNode::matchEndogenousTimesConstant() const
|
|||
varg1 && varg1->get_type() == SymbolType::endogenous && arg2->isConstant())
|
||||
return {varg1->symb_id, arg2};
|
||||
if (auto varg2 = dynamic_cast<VariableNode*>(arg2);
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
|
||||
varg2 && varg2->get_type() == SymbolType::endogenous && arg1->isConstant())
|
||||
return {varg2->symb_id, arg1};
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EXPR_NODE_HH
|
||||
#define _EXPR_NODE_HH
|
||||
#ifndef EXPR_NODE_HH
|
||||
#define EXPR_NODE_HH
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2014-2021 Dynare Team
|
||||
* Copyright © 2014-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EXTENDED_PREPROCESSOR_TYPES_HH
|
||||
#define _EXTENDED_PREPROCESSOR_TYPES_HH
|
||||
#ifndef EXTENDED_PREPROCESSOR_TYPES_HH
|
||||
#define EXTENDED_PREPROCESSOR_TYPES_HH
|
||||
|
||||
// Values for the “output” option
|
||||
enum class OutputType
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EXTERNALFUNCTIONSTABLE_HH
|
||||
#define _EXTERNALFUNCTIONSTABLE_HH
|
||||
#ifndef EXTERNAL_FUNCTIONS_TABLE_HH
|
||||
#define EXTERNAL_FUNCTIONS_TABLE_HH
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MOD_FILE_HH
|
||||
#define _MOD_FILE_HH
|
||||
#ifndef MOD_FILE_HH
|
||||
#define MOD_FILE_HH
|
||||
|
||||
#include <ctime>
|
||||
#include <filesystem>
|
||||
|
@ -194,4 +194,4 @@ public:
|
|||
bool jsonderivsimple = false);
|
||||
};
|
||||
|
||||
#endif // ! MOD_FILE_HH
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <ranges>
|
||||
#include <sstream>
|
||||
|
||||
#include "ModelEquationBlock.hh"
|
||||
|
@ -385,10 +386,10 @@ void
|
|||
Epilogue::detrend(const map<int, expr_t>& trend_symbols_map,
|
||||
const nonstationary_symbols_map_t& nonstationary_symbols_map)
|
||||
{
|
||||
for (auto it = nonstationary_symbols_map.crbegin(); it != nonstationary_symbols_map.crend(); ++it)
|
||||
for (const auto& it : ranges::reverse_view(nonstationary_symbols_map))
|
||||
for (auto& [symb_id, expr] : dynamic_def_table)
|
||||
{
|
||||
expr = expr->detrend(it->first, it->second.first, it->second.second);
|
||||
expr = expr->detrend(it.first, it.second.first, it.second.second);
|
||||
assert(expr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2010-2022 Dynare Team
|
||||
* Copyright © 2010-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MODEL_EQUATION_BLOCK_HH
|
||||
#define _MODEL_EQUATION_BLOCK_HH
|
||||
#ifndef MODEL_EQUATION_BLOCK_HH
|
||||
#define MODEL_EQUATION_BLOCK_HH
|
||||
|
||||
#include "DataTree.hh"
|
||||
#include "DynamicModel.hh"
|
||||
|
|
|
@ -393,7 +393,7 @@ ModelTree::evaluateAndReduceJacobian(const eval_context_t& eval_context) const
|
|||
double val {[&] {
|
||||
try
|
||||
{
|
||||
return d1->eval(eval_context);
|
||||
return d1->eval(eval_context); // NOLINT(clang-analyzer-core.NullDereference)
|
||||
}
|
||||
catch (ExprNode::EvalExternalFunctionException& e)
|
||||
{
|
||||
|
|
|
@ -17,26 +17,26 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MODELTREE_HH
|
||||
# define _MODELTREE_HH
|
||||
#ifndef MODEL_TREE_HH
|
||||
#define MODEL_TREE_HH
|
||||
|
||||
# include <array>
|
||||
# include <cassert>
|
||||
# include <condition_variable>
|
||||
# include <deque>
|
||||
# include <filesystem>
|
||||
# include <map>
|
||||
# include <mutex>
|
||||
# include <optional>
|
||||
# include <ostream>
|
||||
# include <string>
|
||||
# include <thread>
|
||||
# include <vector>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
# include "Bytecode.hh"
|
||||
# include "DataTree.hh"
|
||||
# include "EquationTags.hh"
|
||||
# include "ExtendedPreprocessorTypes.hh"
|
||||
#include "Bytecode.hh"
|
||||
#include "DataTree.hh"
|
||||
#include "EquationTags.hh"
|
||||
#include "ExtendedPreprocessorTypes.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -623,11 +623,11 @@ private:
|
|||
void copyHelper(const ModelTree& m);
|
||||
//! Returns the name of the MATLAB architecture given the extension used for MEX files
|
||||
static string matlab_arch(const string& mexext);
|
||||
# ifdef __APPLE__
|
||||
#ifdef __APPLE__
|
||||
/* Finds a suitable compiler on macOS.
|
||||
The boolean is false if this is GCC and true if this is Clang */
|
||||
static pair<filesystem::path, bool> findCompilerOnMacos(const string& mexext);
|
||||
# endif
|
||||
#endif
|
||||
/* Compiles a MEX file (if link=true) or an object file to be linked later
|
||||
into a MEX file (if link=false). The compilation is done in separate
|
||||
worker threads working in parallel, so the call to this function is not
|
||||
|
@ -751,6 +751,7 @@ ModelTree::writeTemporaryTerms(const temporary_terms_t& tt, temporary_terms_t& t
|
|||
if (dynamic_cast<AbstractExternalFunctionNode*>(it))
|
||||
it->writeExternalFunctionOutput(output, output_type, temp_term_union, tt_idxs, tef_terms);
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
|
||||
it->writeOutput(output, output_type, tt, tt_idxs, tef_terms);
|
||||
output << " = ";
|
||||
it->writeOutput(output, output_type, temp_term_union, tt_idxs, tef_terms);
|
||||
|
@ -2500,7 +2501,6 @@ ModelTree::writeSparseModelJuliaFiles(const string& basename) const
|
|||
writeToFileIfModified(output, julia_dir / (prefix + "G" + to_string(i) + "!.jl"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template<bool dynamic>
|
||||
void
|
||||
|
@ -3139,3 +3139,5 @@ ModelTree::writeSetAuxiliaryVariablesFile(const string& basename, bool julia) co
|
|||
output_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _NUMERICALCONSTANTS_HH
|
||||
#define _NUMERICALCONSTANTS_HH
|
||||
#ifndef NUMERICAL_CONSTANTS_HH
|
||||
#define NUMERICAL_CONSTANTS_HH
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _NUMERICALINITIALIZATION_HH
|
||||
#define _NUMERICALINITIALIZATION_HH
|
||||
#ifndef NUMERICAL_INITIALIZATION_HH
|
||||
#define NUMERICAL_INITIALIZATION_HH
|
||||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
|
|
|
@ -2235,7 +2235,7 @@ ParsingDriver::end_planner_objective(expr_t expr)
|
|||
expr_t eq = model_tree->AddEqual(expr, model_tree->Zero);
|
||||
model_tree->addEquation(eq, location.begin.line);
|
||||
|
||||
mod_file->addStatement(make_unique<PlannerObjectiveStatement>(*planner_objective));
|
||||
mod_file->addStatement(make_unique<PlannerObjectiveStatement>(move(planner_objective)));
|
||||
|
||||
// Handle undeclared variables (see #81)
|
||||
bool exit_after_write = false;
|
||||
|
@ -3181,7 +3181,7 @@ ParsingDriver::external_function()
|
|||
void
|
||||
ParsingDriver::push_external_function_arg_vector_onto_stack()
|
||||
{
|
||||
stack_external_function_args.push({});
|
||||
stack_external_function_args.emplace();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PARSING_DRIVER_HH
|
||||
#define _PARSING_DRIVER_HH
|
||||
#ifndef PARSING_DRIVER_HH
|
||||
#define PARSING_DRIVER_HH
|
||||
|
||||
#ifdef _MACRO_DRIVER_HH
|
||||
#ifdef MACRO_DRIVER_HH
|
||||
# error Impossible to include both ParsingDriver.hh and macro/Driver.hh
|
||||
#endif
|
||||
|
||||
|
@ -964,4 +964,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#endif // ! PARSING_DRIVER_HH
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SHOCKS_HH
|
||||
#define _SHOCKS_HH
|
||||
#ifndef SHOCKS_HH
|
||||
#define SHOCKS_HH
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
|
|
@ -184,6 +184,7 @@ OptionsList::writeOutput(ostream& output, const string& option_group) const
|
|||
void
|
||||
OptionsList::writeOutputCommon(ostream& output, const string& option_group) const
|
||||
{
|
||||
// NOLINTBEGIN(clang-analyzer-core.CallAndMessage)
|
||||
for (const auto& [name, val] : options)
|
||||
std::visit(
|
||||
[&]<class T>(const T& v) {
|
||||
|
@ -261,6 +262,7 @@ OptionsList::writeOutputCommon(ostream& output, const string& option_group) cons
|
|||
}
|
||||
},
|
||||
val);
|
||||
// NOLINTEND(clang-analyzer-core.CallAndMessage)
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STATEMENT_HH
|
||||
#define _STATEMENT_HH
|
||||
#ifndef STATEMENT_HH
|
||||
#define STATEMENT_HH
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
@ -335,4 +335,4 @@ private:
|
|||
static constexpr bool always_false_v {false};
|
||||
};
|
||||
|
||||
#endif // ! _STATEMENT_HH
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STATIC_MODEL_HH
|
||||
#define _STATIC_MODEL_HH
|
||||
#ifndef STATIC_MODEL_HH
|
||||
#define STATIC_MODEL_HH
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SUBMODEL_HH
|
||||
#define _SUBMODEL_HH
|
||||
#ifndef SUB_MODEL_HH
|
||||
#define SUB_MODEL_HH
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYMBOL_LIST_HH
|
||||
#define _SYMBOL_LIST_HH
|
||||
#ifndef SYMBOL_LIST_HH
|
||||
#define SYMBOL_LIST_HH
|
||||
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYMBOLTABLE_HH
|
||||
#define _SYMBOLTABLE_HH
|
||||
#ifndef SYMBOL_TABLE_HH
|
||||
#define SYMBOL_TABLE_HH
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
@ -363,7 +363,7 @@ public:
|
|||
//! Get number of parameters
|
||||
[[nodiscard]] inline int param_nbr() const noexcept(false);
|
||||
//! Returns the greatest symbol ID (the smallest is zero)
|
||||
inline int maxID();
|
||||
[[nodiscard]] inline int maxID() const;
|
||||
//! Get number of user-declared endogenous variables (without the auxiliary variables)
|
||||
[[nodiscard]] inline int orig_endo_nbr() const noexcept(false);
|
||||
//! Write output of this class
|
||||
|
@ -540,7 +540,7 @@ SymbolTable::param_nbr() const noexcept(false)
|
|||
}
|
||||
|
||||
inline int
|
||||
SymbolTable::maxID()
|
||||
SymbolTable::maxID() const
|
||||
{
|
||||
return symbol_table.size() - 1;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <boost/graph/strong_components.hpp>
|
||||
#include <boost/graph/topological_sort.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#include <ranges>
|
||||
|
||||
using namespace boost;
|
||||
|
||||
|
@ -325,8 +326,8 @@ VariableDependencyGraph::reorderRecursiveVariables(const set<int>& feedback_vert
|
|||
auto v_index = get(vertex_index, G);
|
||||
|
||||
// Suppress feedback vertices, in decreasing order
|
||||
for (auto it = feedback_vertices.rbegin(); it != feedback_vertices.rend(); ++it)
|
||||
G.suppress(*it);
|
||||
for (int feedback_vertex : ranges::reverse_view(feedback_vertices))
|
||||
G.suppress(feedback_vertex);
|
||||
|
||||
bool something_has_been_done = true;
|
||||
while (something_has_been_done)
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _VARIABLEDEPENDENCYGRAPH_HH
|
||||
#define _VARIABLEDEPENDENCYGRAPH_HH
|
||||
#ifndef VARIABLE_DEPENDENCY_GRAPH_HH
|
||||
#define VARIABLE_DEPENDENCY_GRAPH_HH
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
@ -94,4 +94,4 @@ private:
|
|||
bool suppressionOfVerticesWithLoop(set<int>& feed_back_vertices);
|
||||
};
|
||||
|
||||
#endif // _VARIABLEDEPENDENCYGRAPH_HH
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2012-2017 Dynare Team
|
||||
* Copyright © 2012-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _WARNINGCONSOLIDATION_HH
|
||||
#define _WARNINGCONSOLIDATION_HH
|
||||
#ifndef WARNING_CONSOLIDATION_HH
|
||||
#define WARNING_CONSOLIDATION_HH
|
||||
|
||||
#include "DynareBisonLocation.hh"
|
||||
#include <sstream>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2019-2020 Dynare Team
|
||||
* Copyright © 2019-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DIRECTIVES_HH
|
||||
#define _DIRECTIVES_HH
|
||||
#ifndef DIRECTIVES_HH
|
||||
#define DIRECTIVES_HH
|
||||
|
||||
#include "Expressions.hh"
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MACRO_DRIVER_HH
|
||||
#define _MACRO_DRIVER_HH
|
||||
#ifndef MACRO_DRIVER_HH
|
||||
#define MACRO_DRIVER_HH
|
||||
|
||||
#ifdef _PARSING_DRIVER_HH
|
||||
#ifdef PARSING_DRIVER_HH
|
||||
# error Impossible to include both ../ParsingDriver.hh and Driver.hh
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
void
|
||||
pushContext()
|
||||
{
|
||||
directive_stack.emplace(vector<DirectivePtr>());
|
||||
directive_stack.emplace();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _ENVIRONMENT_HH
|
||||
#define _ENVIRONMENT_HH
|
||||
#ifndef ENVIRONMENT_HH
|
||||
#define ENVIRONMENT_HH
|
||||
|
||||
#include "ForwardDeclarationsAndEnums.hh"
|
||||
|
||||
|
|
|
@ -623,12 +623,15 @@ Range::eval(Environment& env) const
|
|||
"the arguments must evaluate to reals");
|
||||
|
||||
vector<ExpressionPtr> arr;
|
||||
// We do want a float counter, because that’s the macro-language semantics
|
||||
// NOLINTBEGIN(clang-analyzer-security.FloatLoopCounter)
|
||||
if (*incdbl > 0 && *startdbl <= *enddbl)
|
||||
for (double i = *startdbl; i <= *enddbl; i += *incdbl)
|
||||
arr.emplace_back(make_shared<Real>(i));
|
||||
else if (*startdbl >= *enddbl && *incdbl < 0)
|
||||
for (double i = *startdbl; i >= *enddbl; i += *incdbl)
|
||||
arr.emplace_back(make_shared<Real>(i));
|
||||
// NOLINTEND(clang-analyzer-security.FloatLoopCounter)
|
||||
|
||||
return make_shared<Array>(arr, location);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EXPRESSIONS_HH
|
||||
#define _EXPRESSIONS_HH
|
||||
#ifndef EXPRESSIONS_HH
|
||||
#define EXPRESSIONS_HH
|
||||
|
||||
#include "Environment.hh"
|
||||
#include "ForwardDeclarationsAndEnums.hh"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2019 Dynare Team
|
||||
* Copyright © 2019-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FORWARDDECLARATIONSANDENUMS_HH
|
||||
#define _FORWARDDECLARATIONSANDENUMS_HH
|
||||
#ifndef FORWARD_DECLARATIONS_AND_ENUMS_HH
|
||||
#define FORWARD_DECLARATIONS_AND_ENUMS_HH
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
Loading…
Reference in New Issue