Skip to content
Snippets Groups Projects
Select Git revision
  • 93e6dc4417c4620e7bfd007149a616c8907ae2b1
  • master default protected
  • julia protected
  • 6.x protected
  • python-codegen
  • llvm-15
  • 5.x protected
  • 4.6 protected
  • uop
  • rework_pac
  • aux_vars_fix
  • julia-7.0.0
  • julia-6.4.0
  • julia-6.3.0
  • julia-6.2.0
15 results

ModelBlocks.hh

Blame
  • SubModel.hh 15.39 KiB
    /*
     * Copyright © 2018-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.SS
     *
     * You should have received a copy of the GNU General Public License
     * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
     */
    
    #ifndef SUB_MODEL_HH
    #define SUB_MODEL_HH
    
    #include <iostream>
    #include <map>
    #include <optional>
    #include <set>
    #include <vector>
    
    #include "ExprNode.hh"
    #include "Statement.hh"
    #include "SymbolList.hh"
    #include "SymbolTable.hh"
    
    // DynamicModel.hh can’t be included here, otherwise it would be a circular dependency
    class DynamicModel;
    
    using namespace std;
    
    //! A table with all Trend Component Models in the .mod file
    /*!
      The unique name of the trend component model is the identifier
    */
    class TrendComponentModelTable
    {
    private:
      SymbolTable& symbol_table;
      set<string> names;
      map<string, vector<string>> eqtags, target_eqtags;
      map<string, vector<int>> eqnums, target_eqnums, nontarget_eqnums, max_lags, lhs, target_lhs,
          nontarget_lhs;
      map<string, vector<optional<int>>> orig_diff_var;
      map<string, vector<set<pair<int, int>>>> rhs;
      map<string, vector<bool>> diff;
      map<string, vector<expr_t>> lhs_expr_t;
      map<string, vector<optional<int>>> target_vars;
      map<string, map<tuple<int, int, int>, expr_t>> AR; // name -> (eqn, lag, lhs_symb_id) -> expr_t
      /* Note that A0 in the trend-component model context is not the same thing as
         in the structural VAR context. */
      map<string, map<tuple<int, int>, expr_t>> A0, A0star; // name -> (eqn, col) -> expr_t
    public:
      explicit TrendComponentModelTable(SymbolTable& symbol_table_arg);
    
      //! Add a trend component model
      void addTrendComponentModel(string name_arg, vector<string> eqtags_arg,
                                  vector<string> target_eqtags_arg);
    
      [[nodiscard]] inline bool isExistingTrendComponentModelName(const string& name_arg) const;
      [[nodiscard]] inline bool empty() const;
    
      [[nodiscard]] const map<string, vector<string>>& getEqTags() const;