Select Git revision
ExprNode.hh
Forked from
Dynare / preprocessor
174 commits behind the upstream repository.
-
Sébastien Villemot authored
Automatically detected using clang-tidy with bugprone-reserved-identifier check. By the way, homogeneize the define identifiers in relation to camel case convention.
Sébastien Villemot authoredAutomatically detected using clang-tidy with bugprone-reserved-identifier check. By the way, homogeneize the define identifiers in relation to camel case convention.
ExprNode.hh 114.55 KiB
/*
* Copyright © 2007-2023 Dynare Team
*
* This file is part of Dynare.
*
* Dynare is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dynare is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef EXPR_NODE_HH
#define EXPR_NODE_HH
#include <functional>
#include <map>
#include <optional>
#include <ostream>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#include "Bytecode.hh"
#include "CommonEnums.hh"
#include "ExternalFunctionsTable.hh"
class DataTree;
class NumConstNode;
class VariableNode;
class UnaryOpNode;
class BinaryOpNode;
class PacExpectationNode;
using expr_t = class ExprNode*;
struct ExprNodeLess;
//! Type for set of temporary terms
/*! The ExprNodeLess ordering is important for the temporary terms algorithm,
see the definition of ExprNodeLess */
using temporary_terms_t = set<expr_t, ExprNodeLess>;
/*! Keeps track of array indices of temporary_terms for writing */
using temporary_terms_idxs_t = unordered_map<expr_t, int>;
//! Type for evaluation contexts
/*! The key is a symbol id. Lags are assumed to be null */
using eval_context_t = map<int, double>;
//! Type for tracking first/second derivative functions that have already been written as temporary
//! terms
using deriv_node_temp_terms_t = map<pair<int, vector<expr_t>>, int>;
//! Type for the substitution map used for creating aux. vars for diff and unary_ops
/*! Let ≅ be the equivalence relationship such that two expressions e₁ and e₂
are equivalent iff e₁ can be obtained from e₂ by shifting all leads/lags by
the same number of periods (e.g. x₋₁+y₂≅x₁+y₄).
For each equivalence class, we select a representative element, which is