2009-05-06 12:10:27 +02:00
|
|
|
/*
|
2009-05-19 10:57:07 +02:00
|
|
|
* Copyright (C) 2008-2009 Dynare Team
|
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
/******************************************************
|
2009-12-16 18:18:38 +01:00
|
|
|
// k_order_perturbation.cpp : Defines the entry point for the k-order perturbation application DLL.
|
|
|
|
//
|
|
|
|
// called from Dynare dr1_k_order.m, (itself called form resol.m instead of regular dr1.m)
|
|
|
|
// if options_.order < 2 % 1st order only
|
|
|
|
// [ysteady, ghx_u]=k_order_perturbation(dr,task,M_,options_, oo_ , ['.' mexext]);
|
|
|
|
// else % 2nd order
|
|
|
|
// [ysteady, ghx_u, g_2]=k_order_perturbation(dr,task,M_,options_, oo_ , ['.' mexext]);
|
|
|
|
// inputs:
|
|
|
|
// dr, - Dynare structure
|
|
|
|
// task, - check or not, not used
|
|
|
|
// M_ - Dynare structure
|
|
|
|
// options_ - Dynare structure
|
|
|
|
// oo_ - Dynare structure
|
|
|
|
// ['.' mexext] Matlab dll extension
|
|
|
|
// returns:
|
|
|
|
// ysteady steady state
|
|
|
|
// ghx_u - first order rules packed in one matrix
|
|
|
|
// g_2 - 2nd order rules packed in one matrix
|
2009-05-27 16:28:23 +02:00
|
|
|
**********************************************************/
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-12-17 12:00:50 +01:00
|
|
|
#include "k_ord_dynare.hh"
|
|
|
|
#include "dynamic_dll.hh"
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-11-30 17:31:27 +01:00
|
|
|
#include <cmath>
|
|
|
|
#include <cstring>
|
2009-05-06 12:10:27 +02:00
|
|
|
#include <cctype>
|
2010-02-08 16:58:24 +01:00
|
|
|
#include <cassert>
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-11-03 15:16:18 +01:00
|
|
|
#ifdef _MSC_VER
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
BOOL APIENTRY
|
|
|
|
DllMain(HANDLE hModule,
|
|
|
|
DWORD ul_reason_for_call,
|
|
|
|
LPVOID lpReserved
|
|
|
|
)
|
2009-05-06 12:10:27 +02:00
|
|
|
{
|
|
|
|
switch (ul_reason_for_call)
|
2009-05-27 16:28:23 +02:00
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
case DLL_THREAD_ATTACH:
|
|
|
|
case DLL_THREAD_DETACH:
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
break;
|
|
|
|
}
|
2009-05-06 12:10:27 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Some MS Windows preambles
|
|
|
|
// This is an example of an exported variable
|
2009-05-27 16:28:23 +02:00
|
|
|
K_ORDER_PERTURBATION_API int nK_order_perturbation = 0;
|
2009-05-06 12:10:27 +02:00
|
|
|
|
|
|
|
// This is an example of an exported function.
|
2009-05-27 16:28:23 +02:00
|
|
|
K_ORDER_PERTURBATION_API int
|
|
|
|
fnK_order_perturbation(void)
|
2009-05-06 12:10:27 +02:00
|
|
|
{
|
|
|
|
return 42;
|
|
|
|
}
|
|
|
|
|
2009-11-03 15:16:18 +01:00
|
|
|
#endif // _MSC_VER
|
2009-05-06 12:10:27 +02:00
|
|
|
|
2009-10-02 12:23:49 +02:00
|
|
|
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE) // exclude mexFunction for other applications
|
2009-11-30 17:31:27 +01:00
|
|
|
|
|
|
|
const char **
|
|
|
|
DynareMxArrayToString(const char *cNamesCharStr, const int len, const int width)
|
|
|
|
{
|
|
|
|
char **cNamesMX;
|
|
|
|
cNamesMX = (char **) calloc(len, sizeof(char *));
|
2009-12-16 18:18:38 +01:00
|
|
|
for (int i = 0; i < len; i++)
|
2009-11-30 17:31:27 +01:00
|
|
|
cNamesMX[i] = (char *) calloc(width+1, sizeof(char));
|
|
|
|
|
|
|
|
for (int i = 0; i < width; i++)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < len; j++)
|
|
|
|
{
|
|
|
|
// Allow alphanumeric and underscores "_" only:
|
|
|
|
if (isalnum(cNamesCharStr[j+i*len]) || ('_' == cNamesCharStr[j+i*len]))
|
|
|
|
{
|
|
|
|
cNamesMX[j][i] = cNamesCharStr[j+i*len];
|
|
|
|
}
|
|
|
|
else cNamesMX[j][i] = '\0';
|
|
|
|
}
|
|
|
|
}
|
2009-12-16 18:18:38 +01:00
|
|
|
return (const char **) cNamesMX;
|
2009-11-30 17:31:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
// Convert Matlab Dynare endo and exo names array to C type array of string pointers
|
|
|
|
// Poblem is that Matlab mx function returns a long string concatenated by columns rather than rows
|
|
|
|
// hence a rather low level approach is needed
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
const char **
|
|
|
|
DynareMxArrayToString(const mxArray *mxFldp, const int len, const int width)
|
|
|
|
{
|
|
|
|
char *cNamesCharStr = mxArrayToString(mxFldp);
|
|
|
|
const char **ret = DynareMxArrayToString(cNamesCharStr, len, width);
|
2009-12-16 18:18:38 +01:00
|
|
|
|
2009-11-30 17:31:27 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
extern "C" {
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
// mexFunction: Matlab Inerface point and the main application driver
|
|
|
|
void
|
|
|
|
mexFunction(int nlhs, mxArray *plhs[],
|
|
|
|
int nrhs, const mxArray *prhs[])
|
2009-05-06 12:10:27 +02:00
|
|
|
{
|
2009-11-30 17:31:27 +01:00
|
|
|
if (nrhs < 5)
|
|
|
|
mexErrMsgTxt("Must have at least 5 input parameters.");
|
|
|
|
if (nlhs == 0)
|
|
|
|
mexErrMsgTxt("Must have at least 1 output parameter.");
|
2009-12-16 18:18:38 +01:00
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
const mxArray *dr = prhs[0];
|
|
|
|
const int check_flag = (int) mxGetScalar(prhs[1]);
|
|
|
|
const mxArray *M_ = prhs[2];
|
2009-11-30 17:31:27 +01:00
|
|
|
const mxArray *options_ = prhs[3];
|
|
|
|
const mxArray *oo_ = prhs[4];
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
mxArray *mFname = mxGetField(M_, 0, "fname");
|
|
|
|
if (!mxIsChar(mFname))
|
2009-12-16 18:18:38 +01:00
|
|
|
mexErrMsgTxt("Input must be of type char.");
|
2009-11-30 17:31:27 +01:00
|
|
|
string fName = mxArrayToString(mFname);
|
|
|
|
const mxArray *mexExt = prhs[5];
|
|
|
|
string dfExt = mxArrayToString(mexExt); //Dynamic file extension, e.g.".dll" or .mexw32;
|
2009-05-27 16:28:23 +02:00
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
int kOrder;
|
2009-05-27 16:28:23 +02:00
|
|
|
mxArray *mxFldp = mxGetField(options_, 0, "order");
|
2009-05-06 12:10:27 +02:00
|
|
|
if (mxIsNumeric(mxFldp))
|
2009-05-27 16:28:23 +02:00
|
|
|
kOrder = (int) mxGetScalar(mxFldp);
|
2009-05-06 12:10:27 +02:00
|
|
|
else
|
|
|
|
kOrder = 1;
|
2009-12-16 18:18:38 +01:00
|
|
|
|
2009-11-30 17:31:27 +01:00
|
|
|
if (kOrder == 1 && nlhs != 1)
|
|
|
|
mexErrMsgTxt("k_order_perturbation at order 1 requires exactly 1 argument in output");
|
|
|
|
else if (kOrder > 1 && nlhs != kOrder+1)
|
|
|
|
mexErrMsgTxt("k_order_perturbation at order > 1 requires exactly order + 1 argument in output");
|
2009-12-16 18:18:38 +01:00
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
double qz_criterium = 1+1e-6;
|
2009-05-27 16:28:23 +02:00
|
|
|
mxFldp = mxGetField(options_, 0, "qz_criterium");
|
2009-05-06 12:10:27 +02:00
|
|
|
if (mxIsNumeric(mxFldp))
|
2009-05-27 16:28:23 +02:00
|
|
|
qz_criterium = (double) mxGetScalar(mxFldp);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(M_, 0, "params");
|
|
|
|
double *dparams = (double *) mxGetData(mxFldp);
|
|
|
|
int npar = (int) mxGetM(mxFldp);
|
|
|
|
Vector *modParams = new Vector(dparams, npar);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(M_, 0, "Sigma_e");
|
2009-05-06 12:10:27 +02:00
|
|
|
dparams = (double *) mxGetData(mxFldp);
|
2009-05-27 16:28:23 +02:00
|
|
|
npar = (int) mxGetN(mxFldp);
|
|
|
|
TwoDMatrix *vCov = new TwoDMatrix(npar, npar, dparams);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(dr, 0, "ys"); // and not in order of dr.order_var
|
2009-05-06 12:10:27 +02:00
|
|
|
dparams = (double *) mxGetData(mxFldp);
|
2009-05-27 16:28:23 +02:00
|
|
|
const int nSteady = (int) mxGetM(mxFldp);
|
|
|
|
Vector *ySteady = new Vector(dparams, nSteady);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(dr, 0, "nstatic");
|
|
|
|
const int nStat = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(dr, 0, "npred");
|
|
|
|
int nPred = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(dr, 0, "nspred");
|
|
|
|
const int nsPred = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(dr, 0, "nboth");
|
|
|
|
const int nBoth = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(dr, 0, "nfwrd");
|
|
|
|
const int nForw = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(dr, 0, "nsfwrd");
|
|
|
|
const int nsForw = (int) mxGetScalar(mxFldp);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(M_, 0, "exo_nbr");
|
|
|
|
const int nExog = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(M_, 0, "endo_nbr");
|
|
|
|
const int nEndo = (int) mxGetScalar(mxFldp);
|
|
|
|
mxFldp = mxGetField(M_, 0, "param_nbr");
|
|
|
|
const int nPar = (int) mxGetScalar(mxFldp);
|
2009-05-06 12:10:27 +02:00
|
|
|
// it_ should be set to M_.maximum_lag
|
2009-05-27 16:28:23 +02:00
|
|
|
mxFldp = mxGetField(M_, 0, "maximum_lag");
|
2009-08-24 18:01:25 +02:00
|
|
|
const int nMax_lag = (int) mxGetScalar(mxFldp);
|
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
nPred -= nBoth; // correct nPred for nBoth.
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
mxFldp = mxGetField(dr, 0, "order_var");
|
2009-05-06 12:10:27 +02:00
|
|
|
dparams = (double *) mxGetData(mxFldp);
|
2009-05-27 16:28:23 +02:00
|
|
|
npar = (int) mxGetM(mxFldp);
|
2009-12-16 18:18:38 +01:00
|
|
|
if (npar != nEndo) //(nPar != npar)
|
|
|
|
mexErrMsgTxt("Incorrect number of input var_order vars.");
|
2009-11-30 17:31:27 +01:00
|
|
|
vector<int> *var_order_vp = (new vector<int>(nEndo));
|
2009-05-27 16:28:23 +02:00
|
|
|
for (int v = 0; v < nEndo; v++)
|
2009-12-16 18:18:38 +01:00
|
|
|
(*var_order_vp)[v] = (int)(*(dparams++));
|
2009-05-27 16:28:23 +02:00
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
// the lag, current and lead blocks of the jacobian respectively
|
2009-05-27 16:28:23 +02:00
|
|
|
mxFldp = mxGetField(M_, 0, "lead_lag_incidence");
|
2009-05-06 12:10:27 +02:00
|
|
|
dparams = (double *) mxGetData(mxFldp);
|
2009-05-27 16:28:23 +02:00
|
|
|
npar = (int) mxGetN(mxFldp);
|
|
|
|
int nrows = (int) mxGetM(mxFldp);
|
2009-11-29 21:50:39 +01:00
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
TwoDMatrix *llincidence = new TwoDMatrix(nrows, npar, dparams);
|
|
|
|
if (npar != nEndo)
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Incorrect length of lead lag incidences: ncol=%d != nEndo=%d.", npar, nEndo);
|
2009-08-24 18:01:25 +02:00
|
|
|
|
2009-12-16 18:18:38 +01:00
|
|
|
//get NNZH =NNZD(2) = the total number of non-zero Hessian elements
|
2009-08-24 18:01:25 +02:00
|
|
|
mxFldp = mxGetField(M_, 0, "NNZDerivatives");
|
|
|
|
dparams = (double *) mxGetData(mxFldp);
|
2009-12-16 18:18:38 +01:00
|
|
|
Vector *NNZD = new Vector(dparams, (int) mxGetM(mxFldp));
|
2009-08-24 18:01:25 +02:00
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
const int jcols = nExog+nEndo+nsPred+nsForw; // Num of Jacobian columns
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
mxFldp = mxGetField(M_, 0, "var_order_endo_names");
|
|
|
|
const int nendo = (int) mxGetM(mxFldp);
|
|
|
|
const int widthEndo = (int) mxGetN(mxFldp);
|
|
|
|
const char **endoNamesMX = DynareMxArrayToString(mxFldp, nendo, widthEndo);
|
|
|
|
|
|
|
|
mxFldp = mxGetField(M_, 0, "exo_names");
|
|
|
|
const int nexo = (int) mxGetM(mxFldp);
|
|
|
|
const int widthExog = (int) mxGetN(mxFldp);
|
|
|
|
const char **exoNamesMX = DynareMxArrayToString(mxFldp, nexo, widthExog);
|
|
|
|
|
2009-12-16 18:18:38 +01:00
|
|
|
if ((nEndo != nendo) || (nExog != nexo)) //(nPar != npar)
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgTxt("Incorrect number of input parameters.");
|
2009-05-27 16:28:23 +02:00
|
|
|
|
2009-05-06 12:10:27 +02:00
|
|
|
/* Fetch time index */
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
const int nSteps = 0; // Dynare++ solving steps, for time being default to 0 = deterministic steady state
|
|
|
|
const double sstol = 1.e-13; //NL solver tolerance from
|
|
|
|
|
|
|
|
THREAD_GROUP::max_parallel_threads = 2; //params.num_threads;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// make journal name and journal
|
|
|
|
std::string jName(fName); //params.basename);
|
|
|
|
jName += ".jnl";
|
|
|
|
Journal journal(jName.c_str());
|
|
|
|
DynamicModelDLL dynamicDLL(fName, nEndo, jcols, nMax_lag, nExog, dfExt);
|
|
|
|
|
|
|
|
// intiate tensor library
|
|
|
|
tls.init(kOrder, nStat+2*nPred+3*nBoth+2*nForw+nExog);
|
|
|
|
|
|
|
|
// make KordpDynare object
|
|
|
|
KordpDynare dynare(endoNamesMX, nEndo, exoNamesMX, nExog, nPar, // paramNames,
|
|
|
|
ySteady, vCov, modParams, nStat, nPred, nForw, nBoth,
|
2009-12-16 18:18:38 +01:00
|
|
|
jcols, NNZD, nSteps, kOrder, journal, dynamicDLL,
|
2009-06-30 09:33:40 +02:00
|
|
|
sstol, var_order_vp, llincidence, qz_criterium);
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
// construct main K-order approximation class
|
2009-12-16 18:18:38 +01:00
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
Approximation app(dynare, journal, nSteps, false, qz_criterium);
|
|
|
|
// run stochastic steady
|
|
|
|
app.walkStochSteady();
|
|
|
|
|
|
|
|
ConstTwoDMatrix ss(app.getSS());
|
|
|
|
// open mat file
|
|
|
|
std::string matfile(fName); //(params.basename);
|
|
|
|
matfile += ".mat";
|
|
|
|
FILE *matfd = NULL;
|
|
|
|
if (NULL == (matfd = fopen(matfile.c_str(), "wb")))
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Couldn't open %s for writing.", matfile.c_str());
|
2009-05-27 16:28:23 +02:00
|
|
|
|
2009-11-30 17:31:27 +01:00
|
|
|
std::string ss_matrix_name(fName);
|
2009-05-27 16:28:23 +02:00
|
|
|
ss_matrix_name += "_steady_states";
|
|
|
|
ss.writeMat4(matfd, ss_matrix_name.c_str());
|
|
|
|
|
|
|
|
// write the folded decision rule to the Mat-4 file
|
2009-11-30 17:31:27 +01:00
|
|
|
app.getFoldDecisionRule().writeMat4(matfd, fName.c_str()); //params.prefix);
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
fclose(matfd);
|
|
|
|
|
|
|
|
/* Write derivative outputs into memory map */
|
|
|
|
map<string, ConstTwoDMatrix> mm;
|
2009-09-23 15:14:05 +02:00
|
|
|
app.getFoldDecisionRule().writeMMap(mm, string());
|
2009-05-27 16:28:23 +02:00
|
|
|
|
|
|
|
// get latest ysteady
|
|
|
|
double *dYsteady = (dynare.getSteady().base());
|
|
|
|
ySteady = (Vector *)(&dynare.getSteady());
|
|
|
|
|
|
|
|
// developement of the output.
|
|
|
|
double *dgy, *dgu, *ysteady;
|
|
|
|
int nb_row_x;
|
|
|
|
|
|
|
|
ysteady = NULL;
|
2009-11-29 21:50:39 +01:00
|
|
|
if (kOrder == 1)
|
2009-05-27 16:28:23 +02:00
|
|
|
{
|
|
|
|
/* Set the output pointer to the output matrix ysteady. */
|
2009-12-16 18:18:38 +01:00
|
|
|
map<string, ConstTwoDMatrix>::const_iterator cit = mm.begin();
|
|
|
|
++cit;
|
2009-11-29 21:50:39 +01:00
|
|
|
plhs[0] = mxCreateDoubleMatrix((*cit).second.numRows(), (*cit).second.numCols(), mxREAL);
|
2010-02-08 16:58:24 +01:00
|
|
|
|
|
|
|
// Copy Dynare++ matrix into MATLAB matrix
|
|
|
|
const ConstVector &vec = (*cit).second.getData();
|
|
|
|
assert(vec.skip() == 1);
|
|
|
|
memcpy(mxGetPr(plhs[0]), vec.base(), vec.length() * sizeof(double));
|
2009-05-27 16:28:23 +02:00
|
|
|
}
|
2009-11-29 21:50:39 +01:00
|
|
|
if (kOrder >= 2)
|
2009-05-27 16:28:23 +02:00
|
|
|
{
|
2009-11-29 21:50:39 +01:00
|
|
|
int ii = 0;
|
2009-05-27 16:28:23 +02:00
|
|
|
for (map<string, ConstTwoDMatrix>::const_iterator cit = mm.begin();
|
|
|
|
((cit != mm.end()) && (ii < nlhs)); ++cit)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plhs[ii] = mxCreateDoubleMatrix((*cit).second.numRows(), (*cit).second.numCols(), mxREAL);
|
2010-02-08 16:58:24 +01:00
|
|
|
|
|
|
|
// Copy Dynare++ matrix into MATLAB matrix
|
|
|
|
const ConstVector &vec = (*cit).second.getData();
|
|
|
|
assert(vec.skip() == 1);
|
|
|
|
memcpy(mxGetPr(plhs[ii]), vec.base(), vec.length() * sizeof(double));
|
|
|
|
|
2009-05-27 16:28:23 +02:00
|
|
|
++ii;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-06 12:10:27 +02:00
|
|
|
}
|
2009-05-27 16:28:23 +02:00
|
|
|
catch (const KordException &e)
|
2009-05-06 12:10:27 +02:00
|
|
|
{
|
2009-05-27 16:28:23 +02:00
|
|
|
e.print();
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Caught Kord exception: %s", e.get_message());
|
2009-05-06 12:10:27 +02:00
|
|
|
}
|
2009-05-27 16:28:23 +02:00
|
|
|
catch (const TLException &e)
|
|
|
|
{
|
|
|
|
e.print();
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Caught TL exception");
|
2009-05-06 12:10:27 +02:00
|
|
|
}
|
2009-05-27 16:28:23 +02:00
|
|
|
catch (SylvException &e)
|
|
|
|
{
|
|
|
|
e.printMessage();
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Caught Sylv exception");
|
2009-05-06 12:10:27 +02:00
|
|
|
}
|
2009-05-27 16:28:23 +02:00
|
|
|
catch (const DynareException &e)
|
|
|
|
{
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Caught KordDynare exception: %s", e.message());
|
2009-05-06 12:10:27 +02:00
|
|
|
}
|
2009-05-27 16:28:23 +02:00
|
|
|
catch (const ogu::Exception &e)
|
|
|
|
{
|
2009-11-30 17:31:27 +01:00
|
|
|
mexErrMsgIdAndTxt("dynare:k_order_perturbation", "Caught general exception: %s", e.message());
|
|
|
|
}
|
|
|
|
} // end of mexFunction()
|
|
|
|
} // end of extern C
|
2009-11-29 21:50:39 +01:00
|
|
|
|
2009-08-24 18:01:25 +02:00
|
|
|
#endif // ifdef MATLAB_MEX_FILE to exclude mexFunction for other applications
|