From be2764520a45873067f61fc8bd313c355bbb3474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 7 Feb 2013 16:43:44 +0100 Subject: [PATCH] Estimation DLL: explicitly fail with option loglinear or observation trends --- mex/sources/estimation/DetrendData.cc | 5 ++--- mex/sources/estimation/DetrendData.hh | 8 ++------ mex/sources/estimation/InitializeKalmanFilter.cc | 4 ++-- mex/sources/estimation/logMHMCMCposterior.cc | 10 +++++++++- mex/sources/estimation/logposterior.cc | 8 ++++++++ 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/mex/sources/estimation/DetrendData.cc b/mex/sources/estimation/DetrendData.cc index 928e78959..5d2a63506 100644 --- a/mex/sources/estimation/DetrendData.cc +++ b/mex/sources/estimation/DetrendData.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Dynare Team + * Copyright (C) 2009-2013 Dynare Team * * This file is part of Dynare. * @@ -25,8 +25,7 @@ #include "DetrendData.hh" -DetrendData::DetrendData(const bool INlogLinear) //, Vector& INtrendCoeff) - : logLinear(INlogLinear) //trendCoeff(INtrendCoeff) +DetrendData::DetrendData() { }; diff --git a/mex/sources/estimation/DetrendData.hh b/mex/sources/estimation/DetrendData.hh index 5f26d9f69..1e91abc6f 100644 --- a/mex/sources/estimation/DetrendData.hh +++ b/mex/sources/estimation/DetrendData.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Dynare Team + * Copyright (C) 2009-2013 Dynare Team * * This file is part of Dynare. * @@ -32,13 +32,9 @@ class DetrendData public: virtual ~DetrendData(){}; - DetrendData(const bool logLinear); // add later Vector& trendCoeff); + DetrendData(); void detrend(const VectorView &SteadyState, const MatrixConstView &dataView, MatrixView &detrendedDataView); -private: - const bool logLinear; - //Vector trendCoeff; - }; #endif // !defined(312823A1_6248_4af0_B204_DB22F1237E9B__INCLUDED_) diff --git a/mex/sources/estimation/InitializeKalmanFilter.cc b/mex/sources/estimation/InitializeKalmanFilter.cc index 1b071965e..7ed474996 100644 --- a/mex/sources/estimation/InitializeKalmanFilter.cc +++ b/mex/sources/estimation/InitializeKalmanFilter.cc @@ -38,8 +38,8 @@ InitializeKalmanFilter::InitializeKalmanFilter(const std::string &dynamicDllFile double lyapunov_tol_arg, int &info) : lyapunov_tol(lyapunov_tol_arg), zeta_varobs_back_mixed(zeta_varobs_back_mixed_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), + 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()), g_u(n_endo_arg, n_exo_arg), diff --git a/mex/sources/estimation/logMHMCMCposterior.cc b/mex/sources/estimation/logMHMCMCposterior.cc index 998bd9a81..cd97f621a 100644 --- a/mex/sources/estimation/logMHMCMCposterior.cc +++ b/mex/sources/estimation/logMHMCMCposterior.cc @@ -637,6 +637,15 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data, const mxArray *M_ = mexGetVariablePtr("global", "M_"); const mxArray *options_ = mexGetVariablePtr("global", "options_"); const mxArray *estim_params_ = mexGetVariablePtr("global", "estim_params_"); + const mxArray *bayestopt_ = mexGetVariablePtr("global", "bayestopt_"); + + double loglinear = *mxGetPr(mxGetField(options_, 0, "loglinear")); + if (loglinear == 1) + throw LogMHMCMCposteriorMexErrMsgTxtException("Option loglinear is not supported"); + + double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend")); + if (with_trend == 1) + throw LogMHMCMCposteriorMexErrMsgTxtException("Observation trends are not supported"); // Construct arguments of constructor of LogLikelihoodMain char *fName = mxArrayToString(mxGetField(M_, 0, "fname")); @@ -712,7 +721,6 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data, // Construct GaussianPrior drawDistribution m=0, sd=1 GaussianPrior drawGaussDist01(0.0, 1.0, -INFINITY, INFINITY, 0.0, 1.0); // get Jscale = diag(bayestopt_.jscale); - const mxArray *bayestopt_ = mexGetVariablePtr("global", "bayestopt_"); const Matrix Jscale(n_estParams); const VectorConstView vJscale(mxGetPr(mxGetField(bayestopt_, 0, "jscale")), n_estParams, 1); Proposal pdd(vJscale, D); diff --git a/mex/sources/estimation/logposterior.cc b/mex/sources/estimation/logposterior.cc index a3298cbef..f0910ca3e 100644 --- a/mex/sources/estimation/logposterior.cc +++ b/mex/sources/estimation/logposterior.cc @@ -106,6 +106,14 @@ logposterior(VEC1 &estParams, const MatrixConstView &data, const mxArray *bayestopt_, const mxArray *oo_, VEC2 &steadyState, double *trend_coeff, int &info, VectorView &deepParams, Matrix &H, MatrixView &Q) { + double loglinear = *mxGetPr(mxGetField(options_, 0, "loglinear")); + if (loglinear == 1) + throw LogposteriorMexErrMsgTxtException("Option loglinear is not supported"); + + double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend")); + if (with_trend == 1) + throw LogposteriorMexErrMsgTxtException("Observation trends are not supported"); + // Construct arguments of constructor of LogLikelihoodMain char *fName = mxArrayToString(mxGetField(M_, 0, "fname")); std::string dynamicDllFile(fName);