Skip to content
Snippets Groups Projects
Select Git revision
  • 3085aa2e30ed532dc04a4c293abfef663b36215b
  • master default
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • covariance-quadratic-approximation
  • benchmark-ec
  • kalman_mex
  • 5.5
  • 5.4
  • 5.3
  • 5.2
  • 5.1
  • 5.0
  • 5.0-rc1
  • 4.7-beta3
  • 4.7-beta2
  • 4.7-beta1
  • 4.6.4
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.6.0-rc2
  • 4.6.0-rc1
  • 4.6-beta1
  • 4.5.7
  • 4.5.6
41 results

ModFile.cc

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    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;