Global reindentation of MEX sources

parent 22ab507c
......@@ -187,9 +187,9 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
pY = mxDuplicateArray(prhs[5]);
start = mxGetScalar(prhs[6]);
/*Defining the initials values*/
n = mxGetN(pT); // Number of state variables.
pp = mxGetM(pY); // Maximum number of observed variables.
smpl = mxGetN(pY); // Sample size. ;
n = mxGetN(pT); // Number of state variables.
pp = mxGetM(pY); // Maximum number of observed variables.
smpl = mxGetN(pY); // Sample size. ;
mfd = mxGetPr(prhs[7]);
kalman_tol = mxGetScalar(prhs[8]);
riccati_tol = mxGetScalar(prhs[9]);
......@@ -204,9 +204,9 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
P = mxGetPr(pP);
Y = mxGetPr(pY);
n = mxGetN(pT); // Number of state variables.
pp = mxGetM(pY); // Maximum number of observed variables.
smpl = mxGetN(pY); // Sample size. ;
n = mxGetN(pT); // Number of state variables.
pp = mxGetM(pY); // Maximum number of observed variables.
smpl = mxGetN(pY); // Sample size. ;
n_state = n - pure_obs;
/*mexPrintf("T\n");
......@@ -224,27 +224,27 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
for (int i = 0; i < n; i++)
i_nz_state_var[i] = nz_state_var[i];
pa = mxCreateDoubleMatrix(n, 1, mxREAL); // State vector.
pa = mxCreateDoubleMatrix(n, 1, mxREAL); // State vector.
a = mxGetPr(pa);
tmp_a = std::make_unique<double[]>(n);
dF = 0.0; // det(F).
dF = 0.0; // det(F).
p_tmp1 = mxCreateDoubleMatrix(n, n_shocks, mxREAL);
tmp1 = mxGetPr(p_tmp1);
t = 0; // Initialization of the time index.
plik = mxCreateDoubleMatrix(smpl, 1, mxREAL);
t = 0; // Initialization of the time index.
plik = mxCreateDoubleMatrix(smpl, 1, mxREAL);
lik = mxGetPr(plik);
Inf = mxGetInf();
LIK = 0.0; // Default value of the log likelihood.
notsteady = true; // Steady state flag.
F_singular = true;
Inf = mxGetInf();
LIK = 0.0; // Default value of the log likelihood.
notsteady = true; // Steady state flag.
F_singular = true;
v_pp = std::make_unique<double[]>(pp);
v_n = std::make_unique<double[]>(n);
mf = std::make_unique<int[]>(pp);
for (int i = 0; i < pp; i++)
mf[i] = mfd[i] - 1;
/*compute QQ = R*Q*transpose(R)*/ // Variance of R times the vector of structural innovations.;
/*compute QQ = R*Q*transpose(R)*/ // Variance of R times the vector of structural innovations.;
// tmp = R * Q;
for (int i = 0; i < n; i++)
for (int j = 0; j < n_shocks; j++)
......@@ -270,9 +270,9 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
pv = mxCreateDoubleMatrix(pp, 1, mxREAL);
v = mxGetPr(pv);
pF = mxCreateDoubleMatrix(pp, pp, mxREAL);
pF = mxCreateDoubleMatrix(pp, pp, mxREAL);
F = mxGetPr(pF);
piF = mxCreateDoubleMatrix(pp, pp, mxREAL);
piF = mxCreateDoubleMatrix(pp, pp, mxREAL);
iF = mxGetPr(piF);
lw = pp * 4;
w = std::make_unique<double[]>(lw);
......@@ -316,7 +316,7 @@ BlockKalmanFilter::block_kalman_filter_ss()
{
//v = Y(:,t)-a(mf);
for (int i = 0; i < pp; i++)
v[i] = Y[i + t * pp] - a[mf[i]];
v[i] = Y[i + t * pp] - a[mf[i]];
//a = T*(a+K*v);
for (int i = pure_obs; i < n; i++)
......@@ -375,7 +375,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
for (auto i = d_index.begin(); i != d_index.end(); i++)
{
//mexPrintf("i_i=%d, omp_get_max_threads()=%d\n",i_i,omp_get_max_threads());
v[i_i] = Y[*i + t * pp] - a[mf[*i]];
v[i_i] = Y[*i + t * pp] - a[mf[*i]];
i_i++;
}
......@@ -404,7 +404,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
//v = Y(:,t) - a(mf)
for (int i = 0; i < pp; i++)
v[i] = Y[i + t * pp] - a[mf[i]];
v[i] = Y[i + t * pp] - a[mf[i]];
//F = P(mf,mf) + H;
if (H_size == 1)
......@@ -432,10 +432,10 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
mexPrintf("dgecon failure with error %d\n", static_cast<int>(info));
if (rcond < kalman_tol)
if (not_all_abs_F_bellow_crit(F, size_d_index * size_d_index, kalman_tol)) //~all(abs(F(:))<kalman_tol)
if (not_all_abs_F_bellow_crit(F, size_d_index * size_d_index, kalman_tol)) //~all(abs(F(:))<kalman_tol)
{
mexPrintf("error: F singular\n");
LIK = Inf;
LIK = Inf;
if (nlhs == 3)
for (int i = t; i < smpl; i++)
lik[i] = Inf;
......@@ -466,7 +466,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
int j1 = j - pure_obs;
int j1_n_state = j1 * n_state - pure_obs;
for (int k = pure_obs; k < i_nz_state_var[i]; k++)
tmp[i + j1 * n ] += T[i + k * n] * P[k + j1_n_state];
tmp[i + j1 * n] += T[i + k * n] * P[k + j1_n_state];
}
std::fill_n(P, 0, n * n);
......@@ -492,7 +492,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
F_singular = false;
//dF = det(F);
dF = det(iF, size_d_index, ipiv.get());
dF = det(iF, size_d_index, ipiv.get());
//iF = inv(F);
//int lwork = 4/*2*/* pp;
......@@ -518,7 +518,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
LIK += lik[t];
if (missing_observations)
//K = P(:,mf)*iF;
//K = P(:,mf)*iF;
#pragma omp parallel for shared(P_mf)
for (int i = 0; i < n; i++)
{
......@@ -597,7 +597,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
unsigned int k = i * n + j;
P_t_t1[j * n + i] = P_t_t1[k] = P[k] - K_P[k];
}
double one = 1.0;
double one = 1.0;
double zero = 0.0;
std::copy_n(QQ, n * n, P);
blas_int n_b = n;
......@@ -631,7 +631,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[])
}
mexPrintf("CudaBLAS\n");
mexEvalString("drawnow;");
double one = 1.0;
double one = 1.0;
double zero = 0.0;
cublasStatus_t status;
cublasHandle_t handle;
......
......@@ -103,11 +103,11 @@ public:
inline double
erf(double x) const
{
const double a1 = -1.26551223, a2 = 1.00002368,
a3 = 0.37409196, a4 = 0.09678418,
a5 = -0.18628806, a6 = 0.27886807,
a7 = -1.13520398, a8 = 1.48851587,
a9 = -0.82215223, a10 = 0.17087277;
const double a1 = -1.26551223, a2 = 1.00002368,
a3 = 0.37409196, a4 = 0.09678418,
a5 = -0.18628806, a6 = 0.27886807,
a7 = -1.13520398, a8 = 1.48851587,
a9 = -0.82215223, a10 = 0.17087277;
double v = 1;
double z = abs(x);
if (z <= 0)
......@@ -152,7 +152,7 @@ using namespace std;
const int NO_ERROR_ON_EXIT = 0;
const int ERROR_ON_EXIT = 1;
typedef vector<pair<Tags, void * > > code_liste_type;
typedef vector<pair<Tags, void * >> code_liste_type;
typedef code_liste_type::const_iterator it_code_type;
class GeneralExceptionHandling
......@@ -271,7 +271,7 @@ struct s_plan
{
string var, exo;
int var_num, exo_num;
vector<pair<int, double> > per_value;
vector<pair<int, double>> per_value;
vector<double> value;
};
......@@ -310,7 +310,7 @@ public:
vector<mxArray *> jacobian_block, jacobian_other_endo_block, jacobian_exo_block, jacobian_det_exo_block;
map<unsigned int, double> TEF;
map<pair<unsigned int, unsigned int>, double > TEFD;
map<pair<unsigned int, pair<unsigned int, unsigned int> >, double > TEFDD;
map<pair<unsigned int, pair<unsigned int, unsigned int>>, double > TEFDD;
ExpressionType EQN_type;
it_code_type it_code_expr;
......@@ -319,7 +319,7 @@ public:
size_t /*unsigned int*/ endo_name_length, exo_name_length, param_name_length;
unsigned int EQN_equation, EQN_block, EQN_block_number;
unsigned int EQN_dvar1, EQN_dvar2, EQN_dvar3;
vector<pair<string, pair<SymbolType, unsigned int> > > Variable_list;
vector<pair<string, pair<SymbolType, unsigned int>>> Variable_list;
inline
ErrorMsg()
......@@ -955,7 +955,7 @@ public:
Stack.pop();
if (compute)
{
x[it_+lag+var*nb_row_x] = Stackf.top();
x[it_+lag+var*nb_row_x] = Stackf.top();
Stackf.pop();
}
break;
......@@ -1036,7 +1036,7 @@ public:
Stack.pop();
if (compute)
{
x[var] = Stackf.top();
x[var] = Stackf.top();
Stackf.pop();
}
break;
......@@ -2134,7 +2134,7 @@ public:
#ifdef DEBUG
double rr = Stackf.top();
mexPrintf("rr=%f\n", rr);
map<pair<unsigned int, pair<unsigned int, unsigned int> >, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
map<pair<unsigned int, pair<unsigned int, unsigned int>>, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
mexPrintf("FSTP TEFDD[make_pair(indx, make_pair(row, col))]=%f done\n", it->second);
mexEvalString("drawnow;");
#endif
......@@ -2157,13 +2157,13 @@ public:
#ifdef DEBUG
mexPrintf("FLDTEFD\n");
mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size());
map<pair<unsigned int, pair<unsigned int, unsigned int> >, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
map<pair<unsigned int, pair<unsigned int, unsigned int>>, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
mexPrintf("FLD TEFD[make_pair(indx, make_pair(row, col))]=%f done\n", it->second);
mexEvalString("drawnow;");
#endif
if (compute)
{
map<pair<unsigned int, pair<unsigned int, unsigned int> >, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
map<pair<unsigned int, pair<unsigned int, unsigned int>>, double>::const_iterator it = TEFDD.find(make_pair(indx, make_pair(row-1, col-1)));
Stackf.push(it->second);
}
tmp_out.str("");
......
......@@ -36,7 +36,7 @@ Evaluate::Evaluate()
}
Evaluate::Evaluate(const int y_size_arg, const int y_kmin_arg, const int y_kmax_arg, const bool print_it_arg, const bool steady_state_arg, const int periods_arg, const int minimal_solving_periods_arg, const double slowc_arg) :
print_it(print_it_arg), minimal_solving_periods(minimal_solving_periods_arg)
print_it(print_it_arg), minimal_solving_periods(minimal_solving_periods_arg)
{
symbol_table_endo_nbr = 0;
Block_List_Max_Lag = 0;
......@@ -45,7 +45,7 @@ Evaluate::Evaluate(const int y_size_arg, const int y_kmin_arg, const int y_kmax_
block = -1;
y_size = y_size_arg;
y_kmin = y_kmin_arg;
y_kmax = y_kmax_arg;
y_kmax = y_kmax_arg;
periods = periods_arg;
steady_state = steady_state_arg;
slowc = slowc_arg;
......@@ -545,7 +545,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
case SymbolType::exogenous:
var = static_cast<FSTPV_ *>(it_code->second)->get_pos();
lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag();
x[it_+lag+var*nb_row_x] = Stack.top();
x[it_+lag+var*nb_row_x] = Stack.top();
#ifdef DEBUG
tmp_out << "=>";
mexPrintf(" x[%d, %d](%f)=%s\n", it_+lag, var, x[it_+lag+var*nb_row_x], tmp_out.str().c_str());
......@@ -591,7 +591,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
case SymbolType::exogenous:
case SymbolType::exogenousDet:
var = static_cast<FSTPSV_ *>(it_code->second)->get_pos();
x[var] = Stack.top();
x[var] = Stack.top();
#ifdef DEBUG
tmp_out << "=>";
mexPrintf(" x[%d, %d](%f)=%s\n", it_+lag, var, x[var], tmp_out.str().c_str());
......
......@@ -73,7 +73,7 @@ protected:
vector<Block_contain_type> Block_Contain;
int size;
int *index_vara;
int *index_vara;
bool print_it, forward;
int minimal_solving_periods;
......
......@@ -606,13 +606,13 @@ Interpreter::check_for_controlled_exo_validity(FBEGINBLOCK_ *fb, vector<s_plan>
vector<int> endogenous = fb->get_endogenous();
for (vector<s_plan>::iterator it = sconstrained_extended_path.begin(); it != sconstrained_extended_path.end(); it++)
{
if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) && (find(exogenous.begin(), exogenous.end(), it->var_num) == exogenous.end()))
if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) && (find(exogenous.begin(), exogenous.end(), it->var_num) == exogenous.end()))
{
ostringstream tmp;
tmp << "\n the conditional forecast involving as constrained variable " << get_variable(SymbolType::endogenous, it->exo_num) << " and as endogenized exogenous " << get_variable(SymbolType::exogenous, it->var_num) << " that do not appear in block=" << Block_Count+1 << ")\n You should not use block in model options\n";
throw FatalExceptionHandling(tmp.str());
}
else if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) && (find(exogenous.begin(), exogenous.end(), it->var_num) != exogenous.end()) && ((fb->get_type() == EVALUATE_FORWARD) || (fb->get_type() != EVALUATE_BACKWARD)))
else if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) && (find(exogenous.begin(), exogenous.end(), it->var_num) != exogenous.end()) && ((fb->get_type() == EVALUATE_FORWARD) || (fb->get_type() != EVALUATE_BACKWARD)))
{
ostringstream tmp;
tmp << "\n the conditional forecast cannot be implemented for the block=" << Block_Count+1 << ") that has to be evaluated instead to be solved\n You should not use block in model options\n";
......@@ -921,9 +921,9 @@ Interpreter::extended_path(string file_name, string bin_basename, bool evaluate,
MainLoop(bin_basename, code, evaluate, block, true, true, sconstrained_extended_path, vector_table_conditional_local);
for (int j = 0; j < y_size; j++)
{
y_save[j + (t + y_kmin) * y_size] = y[ j + (y_kmin) * y_size];
y_save[j + (t + y_kmin) * y_size] = y[j + y_kmin * y_size];
if (y_kmin > 0)
y[j ] = y[ j + (y_kmin) * y_size];
y[j] = y[j + y_kmin * y_size];
}
for (int j = 0; j < col_x; j++)
{
......@@ -951,7 +951,7 @@ Interpreter::extended_path(string file_name, string bin_basename, bool evaluate,
y_save[j + (k + y_kmin) * y_size] = y[ j + ( k - (nb_periods-1) + y_kmin) * y_size];
}*/
for (int i = 0; i < y_size * col_y; i++)
y[i] = y_save[i];
y[i] = y_save[i];
for (int j = 0; j < col_x * nb_row_x; j++)
x[j] = x_save[j];
if (Init_Code->second)
......
......@@ -63,7 +63,7 @@ NonZeroElem *
Mem_Mngr::mxMalloc_NZE()
{
long unsigned int i;
if (!Chunk_Stack.empty()) /*An unused block of memory available inside the heap*/
if (!Chunk_Stack.empty()) /*An unused block of memory available inside the heap*/
{
NonZeroElem *p1 = Chunk_Stack.back();
Chunk_Stack.pop_back();
......@@ -74,23 +74,23 @@ Mem_Mngr::mxMalloc_NZE()
i = CHUNK_heap_pos++;
return (NZE_Mem_add[i]);
}
else /*We have to allocate extra memory space*/
else /*We have to allocate extra memory space*/
{
CHUNK_SIZE += CHUNK_BLCK_SIZE;
Nb_CHUNK++;
NZE_Mem = static_cast<NonZeroElem *>(mxMalloc(CHUNK_BLCK_SIZE*sizeof(NonZeroElem))); /*The block of memory allocated*/
NZE_Mem = static_cast<NonZeroElem *>(mxMalloc(CHUNK_BLCK_SIZE*sizeof(NonZeroElem))); /*The block of memory allocated*/
error_msg.test_mxMalloc(NZE_Mem, __LINE__, __FILE__, __func__, CHUNK_BLCK_SIZE*sizeof(NonZeroElem));
NZE_Mem_Allocated.push_back(NZE_Mem);
if (!NZE_Mem)
mexPrintf("Not enough memory available\n");
if (NZE_Mem_add)
{
NZE_Mem_add = static_cast<NonZeroElem **>(mxRealloc(NZE_Mem_add, CHUNK_SIZE*sizeof(NonZeroElem *))); /*We have to redefine the size of pointer on the memory*/
NZE_Mem_add = static_cast<NonZeroElem **>(mxRealloc(NZE_Mem_add, CHUNK_SIZE*sizeof(NonZeroElem *))); /*We have to redefine the size of pointer on the memory*/
error_msg.test_mxMalloc(NZE_Mem_add, __LINE__, __FILE__, __func__, CHUNK_SIZE*sizeof(NonZeroElem *));
}
else
{
NZE_Mem_add = static_cast<NonZeroElem **>(mxMalloc(CHUNK_SIZE*sizeof(NonZeroElem *))); /*We have to define the size of pointer on the memory*/
NZE_Mem_add = static_cast<NonZeroElem **>(mxMalloc(CHUNK_SIZE*sizeof(NonZeroElem *))); /*We have to define the size of pointer on the memory*/
error_msg.test_mxMalloc(NZE_Mem_add, __LINE__, __FILE__, __func__, CHUNK_SIZE*sizeof(NonZeroElem *));
}
......
......@@ -60,7 +60,7 @@ private:
NonZeroElem *NZE_Mem;
vector<NonZeroElem *> NZE_Mem_Allocated;
int swp_f_b;
fstream SaveCode_swp;
fstream SaveCode_swp;
string filename_mem;
};
......
This diff is collapsed.
......@@ -86,7 +86,7 @@ struct t_save_op_s
int first, second;
};
const int IFLD = 0;
const int IFLD = 0;
const int IFDIV = 1;
const int IFLESS = 2;
const int IFSUB = 3;
......@@ -122,7 +122,7 @@ public:
double g0, gp0, glambda2;
int try_at_iteration;
int find_exo_num(vector<s_plan> sconstrained_extended_path, int value);
int find_int_date(vector<pair<int, double> > per_value, int value);
int find_int_date(vector<pair<int, double>> per_value, int value);
private:
void Init_GE(int periods, int y_kmin, int y_kmax, int Size, map<pair<pair<int, int>, int>, int> &IM);
......@@ -140,14 +140,14 @@ private:
bool golden(double ax, double bx, double cx, double tol, double solve_tolf, double *xmin);
void Solve_ByteCode_Symbolic_Sparse_GaussianElimination(int Size, bool symbolic, int Block_number);
bool Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, int it_);
void Solve_Matlab_Relaxation(mxArray *A_m, mxArray *b_m, unsigned int Size, double slowc_l, bool is_two_boundaries, int it_);
void Solve_Matlab_Relaxation(mxArray *A_m, mxArray *b_m, unsigned int Size, double slowc_l, bool is_two_boundaries, int it_);
void Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double slowc_l, bool is_two_boundaries, int it_);
void Print_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, int n);
void Printfull_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n);
void PrintM(int n, double *Ax, mwIndex *Ap, mwIndex *Ai);
void Solve_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double slowc_l, bool is_two_boundaries, int it_);
void Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_, vector_table_conditional_local_type vector_table_conditional_local);
void Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_);
void Solve_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double slowc_l, bool is_two_boundaries, int it_);
void Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_, vector_table_conditional_local_type vector_table_conditional_local);
void Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_);
void End_Matlab_LU_UMFPack();
#ifdef CUDA
......@@ -155,7 +155,7 @@ private:
int *Ai, double *Ax, int *Ap, double *x0, double *b, double *A_tild, int *A_tild_i, int *A_tild_p,
cusparseSolveAnalysisInfo_t infoL, cusparseSolveAnalysisInfo_t infoU,
cusparseMatDescr_t descrL, cusparseMatDescr_t descrU, int preconditioner);
int Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild, int *Ai_tild, double *A_tild, double *b, double *x0, int n, int Size, double slowc_l, bool is_two_boundaries, int it_, int nnz, int nnz_tild, int preconditioner, int max_iterations, int block);
int Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild, int *Ai_tild, double *A_tild, double *b, double *x0, int n, int Size, double slowc_l, bool is_two_boundaries, int it_, int nnz, int nnz_tild, int preconditioner, int max_iterations, int block);
#endif
void Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double slowc, int block, bool is_two_boundaries, int it_, mxArray *x0_m);
void Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, double slowc, int block, bool is_two_boundaries, int it_, mxArray *x0_m, int precond);
......@@ -164,7 +164,7 @@ private:
bool solve_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size, const int iter);
void solve_non_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size);
string preconditioner_print_out(string s, int preconditioner, bool ss);
bool compare(int *save_op, int *save_opa, int *save_opaa, int beg_t, int periods, long int nop4, int Size
bool compare(int *save_op, int *save_opa, int *save_opaa, int beg_t, int periods, long int nop4, int Size
#ifdef PROFILER
, long int *ndiv, long int *nsub
#endif
......
......@@ -208,7 +208,7 @@ GPU_Test_and_Info(cublasHandle_t *cublas_handle, cusparseHandle_t *cusparse_hand
mexPrintf("> Driver version:\n");
int cuda_version;
cuda_error = cudaDriverGetVersion(&cuda_version);
if (cuda_error != cudaSuccess)
if (cuda_error != cudaSuccess)
{
ostringstream tmp;
tmp << " cudaGetVersion has failed\n";
......@@ -297,7 +297,7 @@ Get_Arguments_and_global_variables(int nrhs,
col_y = mxGetN(prhs[i]);
break;
case 1:
*xd = mxGetPr(prhs[i]);
*xd = mxGetPr(prhs[i]);
row_x = mxGetM(prhs[i]);
col_x = mxGetN(prhs[i]);
break;
......@@ -349,7 +349,7 @@ Get_Arguments_and_global_variables(int nrhs,
pos = pos1 + 1;
else
pos += 5;
block = atoi(Get_Argument(prhs[i]).substr(pos, string::npos).c_str())-1;
block = atoi(Get_Argument(prhs[i]).substr(pos, string::npos).c_str())-1;
}
else if (Get_Argument(prhs[i]).substr(0, 13) == "extended_path")
{
......@@ -369,7 +369,7 @@ Get_Arguments_and_global_variables(int nrhs,
pos = pos1 + 1;
else
pos += 6;
*pfplan_struct_name = deblank(Get_Argument(prhs[i]).substr(pos, string::npos));
*pfplan_struct_name = deblank(Get_Argument(prhs[i]).substr(pos, string::npos));
}
else if (Get_Argument(prhs[i]).substr(0, 4) == "plan")
{
......@@ -378,7 +378,7 @@ Get_Arguments_and_global_variables(int nrhs,
pos = pos1 + 1;
else
pos += 4;
*plan_struct_name = deblank(Get_Argument(prhs[i]).substr(pos, string::npos));
*plan_struct_name = deblank(Get_Argument(prhs[i]).substr(pos, string::npos));
}
else
{
......@@ -582,7 +582,7 @@ main(int nrhs, const char *prhs[])
int nb_controlled = 0;
mxArray *options_cond_fcst_ = mxGetField(extended_path_struct, 0, "options_cond_fcst_");
mxArray *controlled_varexo = NULL;
if (options_cond_fcst_ != NULL)
if (options_cond_fcst_ != NULL)
{
controlled_varexo = mxGetField(options_cond_fcst_, 0, "controlled_varexo");
nb_controlled = mxGetM(controlled_varexo) * mxGetN(controlled_varexo);
......@@ -704,7 +704,7 @@ main(int nrhs, const char *prhs[])
string tmp = "Can not allocated memory to store the date_str in the extended path descriptor";
DYN_MEX_FUNC_ERR_MSG_TXT(tmp.c_str());
}
dates.push_back(string(buf));//string(Dates[i]);
dates.push_back(string(buf)); //string(Dates[i]);
mxFree(buf);
}
}
......@@ -726,7 +726,7 @@ main(int nrhs, const char *prhs[])
mxArray *tmp = mxGetField(plan_struct, i, "exo");
if (tmp)
{
char name [100];
char name[100];
mxGetString(tmp, name, 100);
splan[i].var = name;
SymbolType variable_type = SymbolType::endogenous;
......@@ -744,7 +744,7 @@ main(int nrhs, const char *prhs[])
tmp = mxGetField(plan_struct, i, "var");
if (tmp)
{
char name [100];
char name[100];
mxGetString(tmp, name, 100);
splan[i].exo = name;
SymbolType variable_type;
......@@ -778,7 +778,7 @@ main(int nrhs, const char *prhs[])
mexPrintf(" plan fliping var=%s (%d) exo=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num, it->exo.c_str(), it->exo_num);
else
mexPrintf(" plan shocks on var=%s for the following periods and with the following values:\n", it->var.c_str());
for (vector<pair<int, double> >::iterator it1 = it->per_value.begin(); it1 != it->per_value.end(); it1++)
for (vector<pair<int, double>>::iterator it1 = it->per_value.begin(); it1 != it->per_value.end(); it1++)
{
mexPrintf(" %3d %10.5f\n", it1->first, it1->second);
}
......@@ -804,7 +804,7 @@ main(int nrhs, const char *prhs[])
mxArray *tmp = mxGetField(pfplan_struct, i, "var");
if (tmp)
{
char name [100];
char name[100];
mxGetString(tmp, name, 100);
spfplan[i].var = name;
SymbolType variable_type = SymbolType::endogenous;
......@@ -822,7 +822,7 @@ main(int nrhs, const char *prhs[])
tmp = mxGetField(pfplan_struct, i, "exo");
if (tmp)
{
char name [100];
char name[100];
mxGetString(tmp, name, 100);
spfplan[i].exo = name;
SymbolType variable_type;
......@@ -856,7 +856,7 @@ main(int nrhs, const char *prhs[])
mexPrintf(" plan flipping var=%s (%d) exo=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num, it->exo.c_str(), it->exo_num);
else
mexPrintf(" plan shocks on var=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num);
for (vector<pair<int, double> >::iterator it1 = it->per_value.begin(); it1 != it->per_value.end(); it1++)
for (vector<pair<int, double>>::iterator it1 = it->per_value.begin(); it1 != it->per_value.end(); it1++)
{
mexPrintf(" %3d %10.5f\n", it1->first, it1->second);
}
......@@ -1067,7 +1067,7 @@ main(int nrhs, const char *prhs[])
}
for (i = 0; i < row_y*col_y; i++)
{
y[i] = double (yd[i]);
y[i] = double (yd[i]);
ya[i] = double (yd[i]);
}
size_t y_size = row_y;
......
......@@ -347,7 +347,7 @@ read_struct(FILE *fid)
fscanf(fid, "%d", &size_2);
vector<string> fieldnames;
vector<mxArray *> v_Array;
vector<vector<mxArray * > > vv_Array;
vector<vector<mxArray * >> vv_Array;
for (unsigned int j = 0; j < size_1 * size_2; j++)
{
for (unsigned int i = 0; i < nfields; i++)
......
......@@ -41,27 +41,27 @@ typedef unsigned int mwSize;
enum mxData_type
{
mxREAL,
mxCOMPLEX
mxREAL,
mxCOMPLEX
};
enum mxArray_type
{
mxDOUBLE_CLASS = 0,
mxSINGLE_CLASS = 1,
mxLOGICAL_CLASS = 2,
mxCHAR_CLASS = 3,
mxSPARSE_CLASS = 4,
mxSTRUCT_CLASS = 5,
mxCELL_CLASS = 6,
mxFUNCTION_CLASS = 7,
mxUINT8_CLASS = 8,
mxINT16_CLASS = 9,
mxUINT16_CLASS = 10,
mxINT32_CLASS = 11,
mxUINT32_CLASS = 12,
mxINT64_CLASS = 13,
mxUINT64_CLASS = 14
mxDOUBLE_CLASS = 0,
mxSINGLE_CLASS = 1,
mxLOGICAL_CLASS = 2,
mxCHAR_CLASS = 3,
mxSPARSE_CLASS = 4,
mxSTRUCT_CLASS = 5,
mxCELL_CLASS = 6,
mxFUNCTION_CLASS = 7,
mxUINT8_CLASS = 8,
mxINT16_CLASS = 9,
mxUINT16_CLASS = 10,
mxINT32_CLASS = 11,
mxUINT32_CLASS = 12,
mxINT64_CLASS = 13,
mxUINT64_CLASS = 14
};
class mxArray_tag
......@@ -73,7 +73,7 @@ public:
double *data;
mxArray_type type;
vector<string> field_name;
vector<vector<mxArray_tag *> > field_array;
vector<vector<mxArray_tag *>> field_array;
mxArray_tag();
};
......
......@@ -29,7 +29,9 @@ class DynamicModelAC
protected:
int ntt; // Size of vector of temporary terms
public:
DynamicModelAC(int ntt_arg) : ntt{ntt_arg} {};
DynamicModelAC(int ntt_arg) : ntt{ntt_arg}
{
};
virtual ~DynamicModelAC() = default;
virtual void eval(const Vector &y, const Vector &x, const Vector &params, const Vector &ySteady,
Vector &residual, std::vector<TwoDMatrix> &md) = 0;
......
......@@ -35,7 +35,7 @@
#include "dynamic_abstract_class.hh"
using dynamic_tt_fct = void (*)(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, double *T);
using dynamic_deriv_fct = voi