Commit bedc69be authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Estimation DLL: pass the name of the dynamic MEX file through the whole...

Estimation DLL: pass the name of the dynamic MEX file through the whole hierarchy of constructors (instead of the basename of the MOD file)
parent 35ad5b1a
......@@ -30,7 +30,7 @@ InitializeKalmanFilter::~InitializeKalmanFilter()
{
}
InitializeKalmanFilter::InitializeKalmanFilter(const std::string &modName, size_t n_endo_arg, size_t n_exo_arg,
InitializeKalmanFilter::InitializeKalmanFilter(const std::string &dynamicDllFile, size_t n_endo_arg, size_t n_exo_arg,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg,
const std::vector<size_t> &zeta_varobs_back_mixed_arg,
......@@ -38,7 +38,7 @@ InitializeKalmanFilter::InitializeKalmanFilter(const std::string &modName, size_
double lyapunov_tol_arg, int &info) :
lyapunov_tol(lyapunov_tol_arg),
zeta_varobs_back_mixed(zeta_varobs_back_mixed_arg),
detrendData(false), modelSolution(modName, n_endo_arg, n_exo_arg, zeta_fwrd_arg, zeta_back_arg,
detrendData(false), modelSolution(dynamicDllFile, n_endo_arg, n_exo_arg, zeta_fwrd_arg, zeta_back_arg,
zeta_mixed_arg, zeta_static_arg, qz_criterium_arg),
discLyapFast(zeta_varobs_back_mixed.size()),
g_x(n_endo_arg, zeta_back_arg.size() + zeta_mixed_arg.size()),
......
......@@ -43,7 +43,7 @@ public:
/*!
\param[in] zeta_varobs_back_mixed_arg The union of indices of observed, backward and mixed variables
*/
InitializeKalmanFilter(const std::string& modName, size_t n_endo, size_t n_exo, const std::vector<size_t> &zeta_fwrd_arg,
InitializeKalmanFilter(const std::string& dynamicDllFile, size_t n_endo, size_t n_exo, const std::vector<size_t> &zeta_fwrd_arg,
const std::vector<size_t> &zeta_back_arg, const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg,
const std::vector<size_t> &zeta_varobs_back_mixed_arg,
double qz_criterium_arg, double lyapunov_tol_arg, int &info);
......
......@@ -30,7 +30,7 @@ KalmanFilter::~KalmanFilter()
}
KalmanFilter::KalmanFilter(const std::string &modName, size_t n_endo, size_t n_exo,
KalmanFilter::KalmanFilter(const std::string &dynamicDllFile, size_t n_endo, size_t n_exo,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg,
double qz_criterium_arg, const std::vector<size_t> &varobs_arg,
......@@ -42,7 +42,7 @@ KalmanFilter::KalmanFilter(const std::string &modName, size_t n_endo, size_t n_e
Finv(varobs_arg.size(), varobs_arg.size()), K(zeta_varobs_back_mixed.size(), varobs_arg.size()), KFinv(zeta_varobs_back_mixed.size(), varobs_arg.size()),
oldKFinv(zeta_varobs_back_mixed.size(), varobs_arg.size()), Finverter(varobs_arg.size()), a_init(zeta_varobs_back_mixed.size(), 1),
a_new(zeta_varobs_back_mixed.size(), 1), vt(varobs_arg.size(), 1), vtFinv(1, varobs_arg.size()), vtFinvVt(1), riccati_tol(riccati_tol_arg),
initKalmanFilter(modName, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg,
initKalmanFilter(dynamicDllFile, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg,
zeta_static_arg, zeta_varobs_back_mixed, qz_criterium_arg, lyapunov_tol_arg, info)
{
a_init.setAll(0.0);
......
......@@ -48,7 +48,7 @@ class KalmanFilter {
public:
virtual ~KalmanFilter();
KalmanFilter(const std::string &modName, size_t n_endo, size_t n_exo, const std::vector<size_t> &zeta_fwrd_arg,
KalmanFilter(const std::string &dynamicDllFile, size_t n_endo, size_t n_exo, const std::vector<size_t> &zeta_fwrd_arg,
const std::vector<size_t> &zeta_back_arg, const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg,
double qz_criterium_arg, const std::vector<size_t> &varobs_arg,
double riccati_tol_arg, double lyapunov_tol_arg, int &info);
......
......@@ -26,13 +26,13 @@
#include "LogLikelihoodMain.hh"
LogLikelihoodMain::LogLikelihoodMain( //const Matrix &data_arg, Vector &deepParams_arg,
const std::string &modName, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
const std::string &dynamicDllFile, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg, const double qz_criterium,
const std::vector<size_t> &varobs, double riccati_tol, double lyapunov_tol, int &info_arg)
: estSubsamples(estiParDesc.estSubsamples),
logLikelihoodSubSample(modName, estiParDesc, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg, zeta_static_arg, qz_criterium,
logLikelihoodSubSample(dynamicDllFile, estiParDesc, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg, zeta_static_arg, qz_criterium,
varobs, riccati_tol, lyapunov_tol, info_arg),
//deepParams(deepParams_arg),
vll(estSubsamples[estSubsamples.size()-1].endPeriod) // time dimension size of data
......
......@@ -37,7 +37,7 @@ private:
public:
virtual ~LogLikelihoodMain();
LogLikelihoodMain( //const Matrix &data, Vector &deepParams_arg, //GeneralParams& estimOptions,
const std::string &modName, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
const std::string &dynamicDllFile, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg, const std::vector<size_t> &zeta_mixed_arg,
const std::vector<size_t> &zeta_static_arg, const double qz_criterium_arg, const std::vector<size_t> &varobs_arg,
double riccati_tol_arg, double lyapunov_tol_arg, int &info);
......
......@@ -32,12 +32,12 @@ LogLikelihoodSubSample::~LogLikelihoodSubSample()
{
};
LogLikelihoodSubSample::LogLikelihoodSubSample(const std::string &modName, EstimatedParametersDescription &INestiParDesc, size_t n_endo, size_t n_exo,
LogLikelihoodSubSample::LogLikelihoodSubSample(const std::string &dynamicDllFile, EstimatedParametersDescription &INestiParDesc, size_t n_endo, size_t n_exo,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg, const double qz_criterium,
const std::vector<size_t> &varobs, double riccati_tol, double lyapunov_tol, int &INinfo) :
estiParDesc(INestiParDesc),
kalmanFilter(modName, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg, zeta_static_arg, qz_criterium,
kalmanFilter(dynamicDllFile, n_endo, n_exo, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg, zeta_static_arg, qz_criterium,
varobs, riccati_tol, lyapunov_tol, INinfo), eigQ(n_exo), eigH(varobs.size()), info(INinfo)
{
};
......
......@@ -33,7 +33,7 @@
class LogLikelihoodSubSample {
public:
LogLikelihoodSubSample(const std::string &modName, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
LogLikelihoodSubSample(const std::string &dynamicDllFile, EstimatedParametersDescription &estiParDesc, size_t n_endo, size_t n_exo,
const std::vector<size_t> &zeta_fwrd_arg, const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg, const std::vector<size_t> &zeta_static_arg, const double qz_criterium,
const std::vector<size_t> &varobs_arg, double riccati_tol_in, double lyapunov_tol, int &info);
......
......@@ -30,14 +30,14 @@
/**
* compute the steady state (2nd stage), and computes first order approximation
*/
ModelSolution::ModelSolution(const std::string& modName, size_t n_endo_arg, size_t n_exo_arg, const std::vector<size_t>& zeta_fwrd_arg,
ModelSolution::ModelSolution(const std::string& dynamicDllFile, size_t n_endo_arg, size_t n_exo_arg, const std::vector<size_t>& zeta_fwrd_arg,
const std::vector<size_t>& zeta_back_arg, const std::vector<size_t>& zeta_mixed_arg,
const std::vector<size_t>& zeta_static_arg, double INqz_criterium)
: n_endo(n_endo_arg), n_exo(n_exo_arg), // n_jcols = Num of Jacobian columns = nStat+2*nPred+3*nBoth+2*nForw+nExog
n_jcols (n_exo+n_endo+ zeta_back_arg.size() /*nsPred*/ + zeta_fwrd_arg.size() /*nsForw*/ +2*zeta_mixed_arg.size()),
jacobian (n_endo,n_jcols), residual(n_endo), Mx(2,n_exo),
decisionRules ( n_endo_arg, n_exo_arg, zeta_fwrd_arg, zeta_back_arg, zeta_mixed_arg, zeta_static_arg, INqz_criterium),
dynamicDLLp(modName, n_endo, n_jcols, /* nMax_lag= */ 1, n_exo, std::string(""))
dynamicDLLp(dynamicDllFile, n_endo, n_jcols, /* nMax_lag= */ 1, n_exo)
{
Mx.setAll(0.0);
jacobian.setAll(0.0);
......
......@@ -38,7 +38,7 @@
class ModelSolution{
public:
ModelSolution(const std::string& modName, size_t n_endo, size_t n_exo, const std::vector<size_t>& zeta_fwrd_arg,
ModelSolution(const std::string& dynamicDllFile, size_t n_endo, size_t n_exo, const std::vector<size_t>& zeta_fwrd_arg,
const std::vector<size_t>& zeta_back_arg, const std::vector<size_t>& zeta_mixed_arg,
const std::vector<size_t>& zeta_static_arg, double qz_criterium);
virtual ~ModelSolution(){};
......
......@@ -28,20 +28,16 @@ using namespace std;
* Members of DynamicModelDLL for handling loading and calling
* <model>_dynamic () function
**************************************/
DynamicModelDLL::DynamicModelDLL(const std::string &modName, const size_t y_length, const size_t j_cols,
const int n_max_lag, const size_t n_exog, const std::string &sExt) throw (TSException) :
DynamicModelDLL::DynamicModelDLL(const std::string &dynamicDllFile, const size_t y_length, const size_t j_cols,
const int n_max_lag, const size_t n_exog) throw (TSException) :
length(y_length), jcols(j_cols), nMax_lag(n_max_lag), nExog(n_exog)
{
std::string fName;
#if !defined(__CYGWIN32__) && !defined(_WIN32)
if (modName[0] != '/')
if (dynamicDllFile[0] != '/')
fName = "./";
#endif
if (sExt.size()>0) //construct modelNmae_dynamic file name with the given extension
fName += modName + "_dynamic" + sExt;
else // i.e. an already pre-constructed modelNmae_dynamic file name together with the appropriate extension
fName += modName;
// end if
fName += dynamicDllFile;
try
{
......
......@@ -64,8 +64,8 @@ private:
public:
// construct and load Dynamic model DLL
DynamicModelDLL(const std::string &modName, const size_t length, const size_t jcols,
const int nMax_lag, const size_t nExog, const std::string &sExt) throw (TSException);
DynamicModelDLL(const std::string &dynamicDllFile, const size_t length, const size_t jcols,
const int nMax_lag, const size_t nExog) throw (TSException);
virtual ~DynamicModelDLL();
// evaluate Dynamic model DLL
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment