New option “static_mfs” to “model” block (and “model_options” command)
Currently defaults to 0.master
parent
98c27fad59
commit
6ec7f580d5
|
@ -87,7 +87,8 @@ DynamicModel::DynamicModel(const DynamicModel &m) :
|
|||
variableMapping{m.variableMapping},
|
||||
blocks_jacob_cols_endo{m.blocks_jacob_cols_endo},
|
||||
var_expectation_functions_to_write{m.var_expectation_functions_to_write},
|
||||
mfs{m.mfs}
|
||||
mfs{m.mfs},
|
||||
static_mfs{m.static_mfs}
|
||||
{
|
||||
copyHelper(m);
|
||||
}
|
||||
|
@ -135,6 +136,7 @@ DynamicModel::operator=(const DynamicModel &m)
|
|||
|
||||
var_expectation_functions_to_write = m.var_expectation_functions_to_write;
|
||||
mfs = m.mfs;
|
||||
static_mfs = m.static_mfs;
|
||||
|
||||
copyHelper(m);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ using namespace std;
|
|||
//! Stores a dynamic model
|
||||
class DynamicModel : public ModelTree
|
||||
{
|
||||
friend class StaticModel; // For reading static_mfs from converting constructor
|
||||
public:
|
||||
//! A reference to the trend component model table
|
||||
TrendComponentModelTable &trend_component_model_table;
|
||||
|
@ -112,6 +113,11 @@ private:
|
|||
// Value of the “mfs” option of “model” block (or ”model_options” command)
|
||||
int mfs{1};
|
||||
|
||||
/* Value of the “static_mfs” option of “model” block (or the “model_options”
|
||||
command).
|
||||
Only used when converting to StaticModel class. */
|
||||
int static_mfs{0};
|
||||
|
||||
// Writes dynamic model file (MATLAB/Octave version, legacy representation)
|
||||
void writeDynamicMFile(const string &basename) const;
|
||||
//! Writes the code of the block-decomposed model in virtual machine bytecode
|
||||
|
@ -670,6 +676,12 @@ public:
|
|||
{
|
||||
mfs = mfs_arg;
|
||||
}
|
||||
|
||||
void
|
||||
setStaticMFS(int static_mfs_arg)
|
||||
{
|
||||
static_mfs = static_mfs_arg;
|
||||
}
|
||||
};
|
||||
|
||||
template<bool julia>
|
||||
|
|
|
@ -196,6 +196,7 @@ class ParsingDriver;
|
|||
%token ENDVAL_STEADY STEADY_SOLVE_ALGO STEADY_MAXIT STEADY_TOLF STEADY_TOLX STEADY_MARKOWITZ
|
||||
%token HOMOTOPY_MAX_COMPLETION_SHARE HOMOTOPY_MIN_STEP_SIZE HOMOTOPY_INITIAL_STEP_SIZE HOMOTOPY_STEP_SIZE_INCREASE_SUCCESS_COUNT
|
||||
%token HOMOTOPY_LINEARIZATION_FALLBACK HOMOTOPY_MARGINAL_LINEARIZATION_FALLBACK FROM_INITVAL_TO_ENDVAL
|
||||
%token STATIC_MFS
|
||||
|
||||
%token <vector<string>> SYMBOL_VEC
|
||||
|
||||
|
@ -944,6 +945,7 @@ resid : RESID ';'
|
|||
model_option : BLOCK { driver.block(); }
|
||||
| CUTOFF EQUAL non_negative_number { driver.cutoff($3); };
|
||||
| MFS EQUAL INT_NUMBER { driver.mfs($3); };
|
||||
| STATIC_MFS EQUAL INT_NUMBER { driver.static_mfs($3); };
|
||||
| BYTECODE { driver.bytecode(); }
|
||||
| USE_DLL { driver.use_dll(); }
|
||||
| NO_STATIC { driver.no_static();}
|
||||
|
|
|
@ -801,6 +801,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
|
|||
}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>cutoff {return token::CUTOFF;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>mfs {return token::MFS;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>static_mfs {return token::STATIC_MFS;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>balanced_growth_test_tol {return token::BALANCED_GROWTH_TEST_TOL;}
|
||||
<DYNARE_BLOCK>gamma_pdf {return token::GAMMA_PDF;}
|
||||
<DYNARE_BLOCK>beta_pdf {return token::BETA_PDF;}
|
||||
|
|
|
@ -700,6 +700,13 @@ ParsingDriver::mfs(const string &value)
|
|||
mod_file->dynamic_model.setMFS(val);
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::static_mfs(const string &value)
|
||||
{
|
||||
int val = stoi(value);
|
||||
mod_file->dynamic_model.setStaticMFS(val);
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::compilation_setup_substitute_flags(const string &flags)
|
||||
{
|
||||
|
|
|
@ -337,6 +337,8 @@ public:
|
|||
void cutoff(const string &value);
|
||||
//! mfs option of model block
|
||||
void mfs(const string &value);
|
||||
//! static_mfs option of model block
|
||||
void static_mfs(const string &value);
|
||||
//! the flags to substitute for the default compiler flags used by `use_dll`
|
||||
void compilation_setup_substitute_flags(const string &flags);
|
||||
//! the flags to add to the default compiler flags used by `use_dll`
|
||||
|
|
|
@ -50,7 +50,8 @@ StaticModel::copyHelper(const StaticModel &m)
|
|||
StaticModel::StaticModel(const StaticModel &m) :
|
||||
ModelTree{m},
|
||||
ramsey_multipliers_derivatives{m.ramsey_multipliers_derivatives},
|
||||
ramsey_multipliers_derivatives_sparse_colptr{m.ramsey_multipliers_derivatives_sparse_colptr}
|
||||
ramsey_multipliers_derivatives_sparse_colptr{m.ramsey_multipliers_derivatives_sparse_colptr},
|
||||
static_mfs{m.static_mfs}
|
||||
{
|
||||
copyHelper(m);
|
||||
}
|
||||
|
@ -63,6 +64,8 @@ StaticModel::operator=(const StaticModel &m)
|
|||
ramsey_multipliers_derivatives = m.ramsey_multipliers_derivatives;
|
||||
ramsey_multipliers_derivatives_sparse_colptr = m.ramsey_multipliers_derivatives_sparse_colptr;
|
||||
|
||||
static_mfs = m.static_mfs;
|
||||
|
||||
copyHelper(m);
|
||||
|
||||
return *this;
|
||||
|
@ -115,6 +118,8 @@ StaticModel::StaticModel(const DynamicModel &m) :
|
|||
user_set_add_libs = m.user_set_add_libs;
|
||||
user_set_subst_libs = m.user_set_subst_libs;
|
||||
user_set_compiler = m.user_set_compiler;
|
||||
|
||||
static_mfs = m.static_mfs;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -53,6 +53,13 @@ private:
|
|||
// Stores, for each temporary term, its index in the MATLAB/Octave vector
|
||||
temporary_terms_idxs_t ramsey_multipliers_derivatives_temporary_terms_idxs;
|
||||
|
||||
/* Value of the “static_mfs” option of “model” block (or the “model_options”
|
||||
command).
|
||||
NB: the default value defined here is not used when converting from
|
||||
DynamicModel class, and in particular it does not affect the main “model”
|
||||
block. See the DynamicModel class for the default value in that case. */
|
||||
int static_mfs{0};
|
||||
|
||||
// Writes static model file (MATLAB/Octave version, legacy representation)
|
||||
void writeStaticMFile(const string &basename) const;
|
||||
|
||||
|
@ -199,7 +206,7 @@ public:
|
|||
int
|
||||
getMFS() const override
|
||||
{
|
||||
return 0;
|
||||
return static_mfs;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue