Commit f1c8ec60 authored by Sébastien Villemot's avatar Sébastien Villemot

Remove various compilation warnings

parent 555fc986
......@@ -289,7 +289,7 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
iw = (lapack_int*)mxMalloc(pp * sizeof(lapack_int));
ipiv = (lapack_int*)mxMalloc(pp * sizeof(lapack_int));
info = 0;
#ifdef BLAS || CUBLAS
#if defined(BLAS) || defined(CUBLAS)
p_tmp = mxCreateDoubleMatrix(n, n, mxREAL);
*tmp = mxGetPr(p_tmp);
p_P_t_t1 = mxCreateDoubleMatrix(n, n, mxREAL);
......
......@@ -381,7 +381,7 @@ public:
size_t n = Variable_list.size();
int i = 0;
bool notfound = true;
while (notfound && i < n)
while (notfound && i < (int) n)
{
if (variable_name == Variable_list[i].first)
{
......
......@@ -1608,7 +1608,6 @@ Evaluate::evaluate_complete(const bool no_derivatives)
void
Evaluate::compute_complete_2b(const bool no_derivatives, double *_res1, double *_res2, double *_max_res, int *_max_res_idx)
{
bool result;
res1 = 0;
*_res1 = 0;
*_res2 = 0;
......
......@@ -487,8 +487,6 @@ Interpreter::simulate_a_block()
res1 = 0;
max_res = 0;
max_res_idx = 0;
double res1_, res2_, max_res_;
int max_res_idx_;
memcpy(y_save, y, y_size*sizeof(double)*(periods+y_kmax+y_kmin));
compute_complete_2b(false, &res1, &res2, &max_res, &max_res_idx);
......@@ -523,8 +521,6 @@ Interpreter::simulate_a_block()
res1 = 0;
res2 = 0;
max_res = 0; max_res_idx = 0;
double res1_, res2_, max_res_;
int max_res_idx_;
compute_complete_2b(false, &res1, &res2, &max_res, &max_res_idx);
end_code = it_code;
......
......@@ -1568,7 +1568,7 @@ PrintM(int n, double* Ax, mwIndex *Ap, mwIndex *Ai)
int k = 0;
for (int i = 0; i< n; i++)
{
for (int j = Ap[i]; j < Ap[i + 1]; j++)
for (int j = Ap[i]; j < (int) Ap[i + 1]; j++)
{
int row = Ai[j];
A[row *n + i] = Ax[j];
......@@ -2430,7 +2430,7 @@ dynSparseMatrix::substract_A_B(mxArray *A_m, mxArray *B_m)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < n_A; j++)
for (int j = 0; j < (int) n_A; j++)
for (unsigned int i = 0; i < m_A; i++)
{
size_t index = j*m_A+i;
......@@ -3157,7 +3157,7 @@ dynSparseMatrix::Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, d
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i+Size*y_kmin];
double yy = -(res[i] + y[eq]);
......@@ -3168,7 +3168,7 @@ dynSparseMatrix::Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, d
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i];
double yy = -(res[i] + y[eq+it_*y_size]);
......@@ -4073,7 +4073,7 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
mexWarnMsgTxt(tmp.str().c_str());
return 4;*/
/* /**Apply the permutation matrices (P and Q) to the b vector of system to solve :
/* Apply the permutation matrices (P and Q) to the b vector of system to solve :
b_tild = P-1 . b = P' . b */
/*cudaChk(cudaMalloc((void**)&b_tild, n * sizeof(double)), " in Solve_Cuda_BiCGStab, can't allocate b_tild on the graphic card\n");
cusparseChk(cusparseDcsrmv(cusparse_handle, CUSPARSE_OPERATION_TRANSPOSE,
......@@ -4661,7 +4661,7 @@ dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i+Size*y_kmin];
double yy = -(res[i] + y[eq]);
......@@ -4672,7 +4672,7 @@ dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i];
double yy = -(res[i] + y[eq+it_*y_size]);
......@@ -4870,7 +4870,7 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i+Size*y_kmin];
double yy = -(res[i] + y[eq]);
......@@ -4881,7 +4881,7 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++)
for (int i = 0; i < (int) n; i++)
{
int eq = index_vara[i];
double yy = -(res[i] + y[eq+it_*y_size]);
......
......@@ -224,7 +224,7 @@ GPU_close(cublasHandle_t cublas_handle, cusparseHandle_t cusparse_handle, cuspar
string
deblank(string x)
{
for(int i = 0; i < x.length(); i++)
for(int i = 0; i < (int) x.length(); i++)
if (x[i] == ' ')
x.erase(i--, 1);
return x;
......@@ -316,28 +316,28 @@ Get_Arguments_and_global_variables(int nrhs,
else
{
;
if ((pos = Get_Argument(prhs[i]).find("block")) != (int) string::npos)
if ((pos = Get_Argument(prhs[i]).find("block")) != string::npos)
{
size_t pos1 = Get_Argument(prhs[i]).find("=", pos+5);
if (pos1 != (int) string::npos)
if (pos1 != string::npos)
pos = pos1 + 1;
else
pos += 5;
block = atoi(Get_Argument(prhs[i]).substr(pos, string::npos).c_str())-1;
}
else if ((pos = Get_Argument(prhs[i]).find("pfplan")) != (int) string::npos)
else if ((pos = Get_Argument(prhs[i]).find("pfplan")) != string::npos)
{
size_t pos1 = Get_Argument(prhs[i]).find("=", pos+6);
if (pos1 != (int) string::npos)
if (pos1 != string::npos)
pos = pos1 + 1;
else
pos += 6;
*pfplan_struct_name = deblank(Get_Argument(prhs[i]).substr(pos, string::npos));
}
else if ((pos = Get_Argument(prhs[i]).find("plan")) != (int) string::npos)
else if ((pos = Get_Argument(prhs[i]).find("plan")) != string::npos)
{
size_t pos1 = Get_Argument(prhs[i]).find("=", pos+4);
if (pos1 != (int) string::npos)
if (pos1 != string::npos)
pos = pos1 + 1;
else
pos += 4;
......@@ -405,7 +405,7 @@ main(int nrhs, const char *prhs[])
char *plhs[1];
load_global((char *) prhs[1]);
#endif
mxArray *plan_struct = NULL, *pfplan_struct = NULL;
mxArray *pfplan_struct = NULL;
size_t i, row_y = 0, col_y = 0, row_x = 0, col_x = 0, nb_row_xd = 0;
size_t steady_row_y, steady_col_y;
int y_kmin = 0, y_kmax = 0, y_decal = 0;
......@@ -473,7 +473,7 @@ main(int nrhs, const char *prhs[])
}
size_t n_plan = mxGetN(plan_struct);
splan.resize(n_plan);
for (int i = 0; i < n_plan; i++)
for (int i = 0; i < (int) n_plan; i++)
{
splan[i].var = "";
splan[i].exo = "";
......@@ -519,11 +519,11 @@ main(int nrhs, const char *prhs[])
size_t num_shocks = mxGetM(tmp);
(splan[i]).per_value.resize(num_shocks);
double * per_value = mxGetPr(tmp);
for (int j = 0; j < num_shocks; j++)
for (int j = 0; j < (int) num_shocks; j++)
(splan[i]).per_value[j] = make_pair(ceil(per_value[j]), per_value[j + num_shocks]);
}
}
int i;
int i = 0;
for (vector<s_plan>::iterator it = splan.begin(); it != splan.end(); it++)
{
mexPrintf("----------------------------------------------------------------------------------------------------\n");
......@@ -551,7 +551,7 @@ main(int nrhs, const char *prhs[])
}
size_t n_plan = mxGetN(pfplan_struct);
spfplan.resize(n_plan);
for (int i = 0; i < n_plan; i++)
for (int i = 0; i < (int) n_plan; i++)
{
spfplan[i].var = "";
spfplan[i].exo = "";
......@@ -597,11 +597,11 @@ main(int nrhs, const char *prhs[])
size_t num_shocks = mxGetM(tmp);
double * per_value = mxGetPr(tmp);
(spfplan[i]).per_value.resize(num_shocks);
for (int j = 0; j < num_shocks; j++)
for (int j = 0; j < (int) num_shocks; j++)
spfplan[i].per_value[j] = make_pair(ceil(per_value[j]), per_value[j+ num_shocks]);
}
}
int i;
int i = 0;
for (vector<s_plan>::iterator it = spfplan.begin(); it != spfplan.end(); it++)
{
mexPrintf("----------------------------------------------------------------------------------------------------\n");
......
......@@ -60,8 +60,6 @@ public:
const Mat1 &Q, const Matrix &H, const Vec2 &deepParams,
VectorView &vll, MatrixView &detrendedDataView, size_t start, size_t period)
{
double lik = INFINITY;
if (period == 0) // initialise all KF matrices
initKalmanFilter.initialize(steadyState, deepParams, R, Q, RQRt, T, Pstar, Pinf,
dataView, detrendedDataView);
......
/*
* Copyright (C) 2009-2010 Dynare Team
* Copyright (C) 2009-2013 Dynare Team
*
* This file is part of Dynare.
*
......@@ -54,4 +54,6 @@ Prior::constructPrior(pShape shape, double mean, double standard, double lower_b
case Inv_gamma_2:
return new InvGamma2_Prior(mean, standard, lower_bound, upper_bound, fhp, shp);
}
std::cerr << "Unreacheable point" << std::endl;
exit(EXIT_FAILURE);
}
......@@ -501,7 +501,7 @@ sampleMHMC(LogPosteriorDensity &lpd, RandomWalkMetropolisHastings &rwmh,
matClose(drawmat);
#else
printf(" MH: Computing Metropolis-Hastings (chain %d/%d): %3.f \b%% done, acceptance rate: %3.f \b%%\r", b, nBlocks, 100 * j/nruns(b-1), 100 * sux / j);
printf(" MH: Computing Metropolis-Hastings (chain %ld/%ld): %3.f \b%% done, acceptance rate: %3.f \b%%\r", b, nBlocks, 100 * j/nruns(b-1), 100 * sux / j);
// % Now I save the simulations
// save draw 2 mat file ([MhDirectoryName '/' ModelName '_mh' int2str(NewFile(b)) '_blck' int2str(b) '.mat'],'x2','logpo2');
ssFName.clear();
......@@ -716,7 +716,6 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data,
bool noconstant = (bool) *mxGetPr(mxGetField(options_, 0, "noconstant"));
// Allocate LogPosteriorDensity object
int info;
LogPosteriorDensity lpd(basename, epd, n_endo, n_exo, zeta_fwrd, zeta_back, zeta_mixed, zeta_static,
qz_criterium, varobs, riccati_tol, lyapunov_tol, noconstant);
......
......@@ -124,8 +124,6 @@ logposterior(VEC1 &estParams, const MatrixConstView &data,
size_t n_endo = (size_t) *mxGetPr(mxGetField(M_, 0, "endo_nbr"));
size_t n_exo = (size_t) *mxGetPr(mxGetField(M_, 0, "exo_nbr"));
size_t n_param = (size_t) *mxGetPr(mxGetField(M_, 0, "param_nbr"));
size_t n_estParams = estParams.getSize();
std::vector<size_t> zeta_fwrd, zeta_back, zeta_mixed, zeta_static;
const mxArray *lli_mx = mxGetField(M_, 0, "lead_lag_incidence");
......
/*
* Copyright (C) 2008-2011 Dynare Team
* Copyright (C) 2008-2013 Dynare Team
*
* This file is part of Dynare.
*
......@@ -46,8 +46,8 @@ KordpDynare::KordpDynare(const vector<string> &endo, int num_endo,
nYs(npred + nboth), nYss(nboth + nforw), nY(num_endo), nJcols(jcols), NNZD(nnzd), nSteps(nsteps),
nOrder(norder), journal(jr), ySteady(ysteady), params(inParams), vCov(vcov),
md(1), dnl(*this, endo), denl(*this, exo), dsnl(*this, dnl, denl), ss_tol(sstol), varOrder(var_order),
ll_Incidence(llincidence), qz_criterium(criterium), dynamicModelFile(dynamicModelFile_arg), g1p(NULL),
g2p(NULL), g3p(NULL)
ll_Incidence(llincidence), qz_criterium(criterium), g1p(NULL),
g2p(NULL), g3p(NULL), dynamicModelFile(dynamicModelFile_arg)
{
ReorderDynareJacobianIndices();
......@@ -68,8 +68,8 @@ KordpDynare::KordpDynare(const vector<string> &endo, int num_endo,
nYs(npred + nboth), nYss(nboth + nforw), nY(num_endo), nJcols(jcols), NNZD(nnzd), nSteps(nsteps),
nOrder(norder), journal(jr), ySteady(ysteady), params(inParams), vCov(vcov),
md(1), dnl(*this, endo), denl(*this, exo), dsnl(*this, dnl, denl), ss_tol(sstol), varOrder(var_order),
ll_Incidence(llincidence), qz_criterium(criterium), dynamicModelFile(dynamicModelFile_arg),
g1p(g1_arg), g2p(g2_arg), g3p(g3_arg)
ll_Incidence(llincidence), qz_criterium(criterium),
g1p(g1_arg), g2p(g2_arg), g3p(g3_arg), dynamicModelFile(dynamicModelFile_arg)
{
ReorderDynareJacobianIndices();
......
......@@ -93,7 +93,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
// Check the type of the input arguments and get the size of the matrices.
mwSize n = mxGetM(prhs[0]);
if (n != mxGetN(prhs[0]))
if ((size_t) n != mxGetN(prhs[0]))
{
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The first input argument (T) must be a square matrix!");
}
......@@ -102,7 +102,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The first input argument (T) must be a real matrix!");
}
mwSize q = mxGetM(prhs[1]);
if (q != mxGetN(prhs[1]))
if ((size_t) q != mxGetN(prhs[1]))
{
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The second input argument (QQ) must be a square matrix!");
}
......@@ -115,7 +115,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The size of the second input argument (QQ) must match the size of the first argument (T)!");
}
mwSize p = mxGetN(prhs[2]);
if (mxGetM(prhs[2]) != n)
if (mxGetM(prhs[2]) != (size_t) n)
{
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The number of rows of the third argument (Z) must match the number of rows of the first argument (T)!");
}
......@@ -129,7 +129,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The fourth input argument (H) must be a square matrix!");
}
if (mxGetM(prhs[3]) != p)
if (mxGetM(prhs[3]) != (size_t) p)
{
DYN_MEX_FUNC_ERR_MSG_TXT("kalman_steady_state: The number of rows of the fourth input argument (H) must match the number of rows of the third input argument!");
}
......
......@@ -267,10 +267,10 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexErrMsgTxt("Too many output arguments.");
}
// Get dimensions.
mwSize n = mxGetM(prhs[0]);// Number of states.
mwSize s = mxGetN(prhs[0]);// Number of particles.
mwSize q = mxGetM(prhs[1]);// Number of innovations.
mwSize m = mxGetM(prhs[2]);// Number of elements in the union of states and observed variables.
size_t n = mxGetM(prhs[0]);// Number of states.
size_t s = mxGetN(prhs[0]);// Number of particles.
size_t q = mxGetM(prhs[1]);// Number of innovations.
size_t m = mxGetM(prhs[2]);// Number of elements in the union of states and observed variables.
//mexPrintf("\n s (the number of column of yhat) is equal to %d.", s);
//mexPrintf("\n The number of column of epsilon is %d.", mxGetN(prhs[1]));
// Check the dimensions.
......
Markdown is supported
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