K-order DLL: make it compatible with changes introduced in

648c3cd177
time-shift
Sébastien Villemot 2010-09-20 18:30:00 +02:00
parent 648c3cd177
commit d7754ca288
3 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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);