k-order perturbation: cosmetic change related to mxGetPr/mxGetData

time-shift
Sébastien Villemot 2011-05-20 10:59:35 +02:00
parent f5b35df24f
commit 5fa666e448
2 changed files with 10 additions and 10 deletions

View File

@ -40,10 +40,10 @@ DynamicModelMFile::eval(const Vector &y, const Vector &x, const Vector &modParam
prhs[3] = mxCreateDoubleMatrix(ySteady.length(), 1, mxREAL);
prhs[4] = mxCreateDoubleScalar(1.0);
memcpy((void *) (mxGetPr(prhs[0])), (void *) y.base(), y.length()*sizeof(double));
memcpy((void *) (mxGetPr(prhs[1])), (void *) x.base(), x.length()*sizeof(double));
memcpy((void *) (mxGetPr(prhs[2])), (void *) modParams.base(), modParams.length()*sizeof(double));
memcpy((void *) (mxGetPr(prhs[3])), (void *) ySteady.base(), ySteady.length()*sizeof(double));
memcpy(mxGetData(prhs[0]), (void *) y.base(), y.length()*sizeof(double));
memcpy(mxGetData(prhs[1]), (void *) x.base(), x.length()*sizeof(double));
memcpy(mxGetData(prhs[2]), (void *) modParams.base(), modParams.length()*sizeof(double));
memcpy(mxGetData(prhs[3]), (void *) ySteady.base(), ySteady.length()*sizeof(double));
int retVal = mexCallMATLAB(nlhs_dynamic, plhs, nrhs_dynamic, prhs, DynamicMFilename.c_str());
if (retVal != 0)

View File

@ -103,21 +103,21 @@ extern "C" {
qz_criterium = (double) mxGetScalar(mxFldp);
mxFldp = mxGetField(M_, 0, "params");
double *dparams = (double *) mxGetData(mxFldp);
double *dparams = mxGetPr(mxFldp);
int npar = (int) mxGetM(mxFldp);
Vector modParams(dparams, npar);
if (!modParams.isFinite())
DYN_MEX_FUNC_ERR_MSG_TXT("The parameters vector contains NaN or Inf");
mxFldp = mxGetField(M_, 0, "Sigma_e");
dparams = (double *) mxGetData(mxFldp);
dparams = mxGetPr(mxFldp);
npar = (int) mxGetN(mxFldp);
TwoDMatrix vCov(npar, npar, dparams);
if (!vCov.isFinite())
DYN_MEX_FUNC_ERR_MSG_TXT("The covariance matrix of shocks contains NaN or Inf");
mxFldp = mxGetField(dr, 0, "ys"); // and not in order of dr.order_var
dparams = (double *) mxGetData(mxFldp);
dparams = mxGetPr(mxFldp);
const int nSteady = (int) mxGetM(mxFldp);
Vector ySteady(dparams, nSteady);
if (!ySteady.isFinite())
@ -146,7 +146,7 @@ extern "C" {
nPred -= nBoth; // correct nPred for nBoth.
mxFldp = mxGetField(dr, 0, "order_var");
dparams = (double *) mxGetData(mxFldp);
dparams = mxGetPr(mxFldp);
npar = (int) mxGetM(mxFldp);
if (npar != nEndo)
DYN_MEX_FUNC_ERR_MSG_TXT("Incorrect number of input var_order vars.");
@ -157,7 +157,7 @@ extern "C" {
// the lag, current and lead blocks of the jacobian respectively
mxFldp = mxGetField(M_, 0, "lead_lag_incidence");
dparams = (double *) mxGetData(mxFldp);
dparams = mxGetPr(mxFldp);
npar = (int) mxGetN(mxFldp);
int nrows = (int) mxGetM(mxFldp);
@ -170,7 +170,7 @@ extern "C" {
}
//get NNZH =NNZD(2) = the total number of non-zero Hessian elements
mxFldp = mxGetField(M_, 0, "NNZDerivatives");
dparams = (double *) mxGetData(mxFldp);
dparams = mxGetPr(mxFldp);
Vector NNZD(dparams, (int) mxGetM(mxFldp));
if (NNZD[kOrder-1] == -1)
DYN_MEX_FUNC_ERR_MSG_TXT("The derivatives were not computed for the required order. Make sure that you used the right order option inside the stoch_simul command");