diff --git a/mex/sources/k_order_perturbation/dynamic_dll.cc b/mex/sources/k_order_perturbation/dynamic_dll.cc index 001ee694937339ab00ea4272a802dd40dcc68eb7..5760b29604295472d8f5c31b9a94b83c53eeed9b 100644 --- a/mex/sources/k_order_perturbation/dynamic_dll.cc +++ b/mex/sources/k_order_perturbation/dynamic_dll.cc @@ -27,8 +27,8 @@ * <model>_dynamic () function **************************************/ DynamicModelDLL::DynamicModelDLL(const string &modName, const int y_length, const int j_cols, - const int n_max_lag, const int n_exog, const string &sExt) throw (DynareException) : - length(y_length), jcols(j_cols), nMax_lag(n_max_lag), nExog(n_exog) + const int n_max_lag, const int n_exog, const Vector &ySteady_arg, const string &sExt) throw (DynareException) : + length(y_length), jcols(j_cols), nMax_lag(n_max_lag), nExog(n_exog), ySteady(ySteady_arg) { string fName; #if !defined(__CYGWIN32__) && !defined(_WIN32) @@ -97,7 +97,8 @@ void DynamicModelDLL::eval(double *y, double *x, int nb_row_x, double *params, int it_, double *residual, double *g1, double *g2, double *g3) { - Dynamic(y, x, nb_row_x, params, it_, residual, g1, g2, g3); + double *steady_state = const_cast<double *>(ySteady.base()); + Dynamic(y, x, nb_row_x, params, steady_state, it_, residual, g1, g2, g3); } void @@ -124,8 +125,9 @@ DynamicModelDLL::eval(const Vector &y, const TwoDMatrix &x, const Vector *modPa double *dy = const_cast<double *>(y.base()); double *dx = const_cast<double *>(x.base()); double *dbParams = const_cast<double *>(modParams->base()); + double *steady_state = const_cast<double *>(ySteady.base()); - Dynamic(dy, dx, nExog, dbParams, it_, dresidual, dg1, dg2, dg3); + Dynamic(dy, dx, nExog, dbParams, steady_state, it_, dresidual, dg1, dg2, dg3); } void diff --git a/mex/sources/k_order_perturbation/dynamic_dll.hh b/mex/sources/k_order_perturbation/dynamic_dll.hh index 10b6615ae9ec4f43f7e2e76261ece8eca8fe54f0..efed398d9306f2a74faa1de8b04ac31b822e4099 100644 --- a/mex/sources/k_order_perturbation/dynamic_dll.hh +++ b/mex/sources/k_order_perturbation/dynamic_dll.hh @@ -30,7 +30,7 @@ // <model>_Dynamic DLL pointer typedef void (*DynamicFn) -(double *y, double *x, int nb_row_x, double *params, +(double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, double *g1, double *g2, double *g3); /** @@ -46,6 +46,7 @@ private: const int jcols; // tot num var t-1, t and t+1 instances + exogs = Num of Jacobian columns const int nMax_lag; // no of lags const int nExog; // no of exogenous + const Vector &ySteady; #if defined(_WIN32) || defined(__CYGWIN32__) HINSTANCE dynamicHinstance; // DLL instance pointer in Windows #else @@ -55,7 +56,7 @@ private: public: // construct and load Dynamic model DLL DynamicModelDLL(const string &fname, const int length, const int jcols, - const int nMax_lag, const int nExog, const string &sExt) throw (DynareException); + const int nMax_lag, const int nExog, const Vector &ySteady_arg, const string &sExt) throw (DynareException); virtual ~DynamicModelDLL(); // evaluate Dynamic model DLL diff --git a/mex/sources/k_order_perturbation/k_order_perturbation.cc b/mex/sources/k_order_perturbation/k_order_perturbation.cc index ba1de66b8eead1a94b91ced32c1da294346f2986..2082a2472f59b8e5e4ec049135f396ed0454af1c 100644 --- a/mex/sources/k_order_perturbation/k_order_perturbation.cc +++ b/mex/sources/k_order_perturbation/k_order_perturbation.cc @@ -195,7 +195,7 @@ extern "C" { std::string jName(fName); //params.basename); jName += ".jnl"; Journal journal(jName.c_str()); - DynamicModelDLL dynamicDLL(fName, nEndo, jcols, nMax_lag, nExog, dfExt); + DynamicModelDLL dynamicDLL(fName, nEndo, jcols, nMax_lag, nExog, ySteady, dfExt); // intiate tensor library tls.init(kOrder, nStat+2*nPred+3*nBoth+2*nForw+nExog);