Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • dynare-6.x protected
  • dynare-5.x protected
  • dynare-4.6 protected
  • master-dist
  • path_setting
  • old-oop-style
  • master-with-fame-io
8 results

save.m

Blame
  • DynamicModel.hh 31.16 KiB
    /*
     * Copyright © 2003-2022 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 _DYNAMICMODEL_HH
    #define _DYNAMICMODEL_HH
    
    #include <fstream>
    #include <filesystem>
    
    #include "StaticModel.hh"
    #include "Bytecode.hh"
    
    using namespace std;
    
    //! Stores a dynamic model
    class DynamicModel : public ModelTree
    {
    public:
      //! A reference to the trend component model table
      TrendComponentModelTable &trend_component_model_table;
      //! A reference to the VAR model table
      VarModelTable &var_model_table;
      /* Used in the balanced growth test, for determining whether the
         cross-derivative of a given equation, w.r.t. an endogenous and a trend
         variable is zero. Controlled by option “balanced_growth_test_tol” of the
         “model” block. The default should not be too small (see dynare#1389). */
      double balanced_growth_test_tol{1e-6};
    private:
      /* Used in the balanced growth test, for skipping equations where the test
         cannot be performed (i.e. when LHS=RHS at the initial values). Should not
         be too large, otherwise the test becomes less powerful. */
      constexpr static double zero_band{1e-8};
    
      //! Stores equations declared as [static]
      /*! They will be used in the conversion to StaticModel to replace equations marked as [dynamic] */
      vector<BinaryOpNode *> static_only_equations;
    
      //! Stores line numbers of equations declared as [static]
      vector<optional<int>> static_only_equations_lineno;
    
      //! Stores the equation tags of equations declared as [static]
      EquationTags static_only_equations_equation_tags;
    
      using deriv_id_table_t = map<pair<int, int>, int>;
      //! Maps a pair (symbol_id, lag) to a deriv ID
      deriv_id_table_t deriv_id_table;
      //! Maps a deriv ID to a pair (symbol_id, lag)
      vector<pair<int, int>> inv_deriv_id_table;
    
      //! Maps a deriv_id to the column index of the dynamic Jacobian
      /*! Contains only endogenous, exogenous and exogenous deterministic */
      map<int, int> dyn_jacobian_cols_table;
    
      //! Maximum lag and lead over all types of variables (positive values)