From 5fa666e44858bf632be88b4dcb08ea8657a37a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 20 May 2011 10:59:35 +0200 Subject: [PATCH] k-order perturbation: cosmetic change related to mxGetPr/mxGetData --- mex/sources/k_order_perturbation/dynamic_m.cc | 8 ++++---- .../k_order_perturbation/k_order_perturbation.cc | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mex/sources/k_order_perturbation/dynamic_m.cc b/mex/sources/k_order_perturbation/dynamic_m.cc index 2970f7761..eb5fc69fd 100644 --- a/mex/sources/k_order_perturbation/dynamic_m.cc +++ b/mex/sources/k_order_perturbation/dynamic_m.cc @@ -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) diff --git a/mex/sources/k_order_perturbation/k_order_perturbation.cc b/mex/sources/k_order_perturbation/k_order_perturbation.cc index 8cfd3c532..b53e8bb97 100644 --- a/mex/sources/k_order_perturbation/k_order_perturbation.cc +++ b/mex/sources/k_order_perturbation/k_order_perturbation.cc @@ -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");