MEX files: remove unused variables or values
Automatically detected by clang-tidy using clang-diagnostic-unused-but-set-variable, clang-analyzer-deadcode.DeadStores and clang-diagnostic-unused-const-variable checks.new-samplers
parent
d82eecfd39
commit
8953007440
|
@ -1488,8 +1488,6 @@ Evaluate::evaluateBlock(int it_, int y_kmin, double* __restrict__ y, int y_size,
|
|||
{
|
||||
case ExpressionType::FirstEndoDerivative:
|
||||
eq = static_cast<FSTPG3_*>(*it_code)->get_row();
|
||||
var = static_cast<FSTPG3_*>(*it_code)->get_col();
|
||||
lag = static_cast<FSTPG3_*>(*it_code)->get_lag();
|
||||
pos_col = static_cast<FSTPG3_*>(*it_code)->get_col_pos();
|
||||
#ifdef DEBUG
|
||||
mexPrintf("Endo eq=%d, pos_col=%d, size=%d, jacob=%x\n", eq, pos_col, size, jacob);
|
||||
|
@ -1500,8 +1498,6 @@ Evaluate::evaluateBlock(int it_, int y_kmin, double* __restrict__ y, int y_size,
|
|||
case ExpressionType::FirstExoDerivative:
|
||||
// eq = static_cast<FSTPG3_ *>(*it_code)->get_row();
|
||||
eq = EQN_equation;
|
||||
var = static_cast<FSTPG3_*>(*it_code)->get_col();
|
||||
lag = static_cast<FSTPG3_*>(*it_code)->get_lag();
|
||||
pos_col = static_cast<FSTPG3_*>(*it_code)->get_col_pos();
|
||||
#ifdef DEBUG
|
||||
mexPrintf("Exo eq=%d, pos_col=%d, size=%d\n", eq, pos_col, size);
|
||||
|
@ -1512,8 +1508,6 @@ Evaluate::evaluateBlock(int it_, int y_kmin, double* __restrict__ y, int y_size,
|
|||
case ExpressionType::FirstExodetDerivative:
|
||||
// eq = static_cast<FSTPG3_ *>(*it_code)->get_row();
|
||||
eq = EQN_equation;
|
||||
var = static_cast<FSTPG3_*>(*it_code)->get_col();
|
||||
lag = static_cast<FSTPG3_*>(*it_code)->get_lag();
|
||||
pos_col = static_cast<FSTPG3_*>(*it_code)->get_col_pos();
|
||||
#ifdef DEBUG
|
||||
mexPrintf("Exo det eq=%d, pos_col=%d, size=%d\n", eq, pos_col, size);
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "Interpreter.hh"
|
||||
|
||||
constexpr double BIG = 1.0e+8, SMALL = 1.0e-5;
|
||||
|
||||
Interpreter::Interpreter(Evaluate& evaluator_arg, double* params_arg, double* y_arg, double* ya_arg,
|
||||
double* x_arg, double* steady_y_arg, double* direction_arg, int y_size_arg,
|
||||
int nb_row_x_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
|
||||
|
@ -1894,7 +1892,6 @@ Interpreter::Init_Gaussian_Elimination()
|
|||
NbNZRow[i] = 0;
|
||||
NbNZCol[i] = 0;
|
||||
}
|
||||
int nnz = 0;
|
||||
// pragma omp parallel for ordered private(it4, ti_y_kmin, ti_y_kmax, eq, var, lag)
|
||||
// schedule(dynamic)
|
||||
for (int t = 0; t < periods; t++)
|
||||
|
@ -1909,14 +1906,12 @@ Interpreter::Init_Gaussian_Elimination()
|
|||
if (eq != get<0>(key) + size * t)
|
||||
tmp_b = 0;
|
||||
eq = get<0>(key) + size * t;
|
||||
int lag = get<2>(key);
|
||||
if (var < (periods + y_kmax) * size)
|
||||
{
|
||||
lag = get<2>(key);
|
||||
int lag {get<2>(key)};
|
||||
if (lag <= ti_y_kmax && lag >= ti_y_kmin) /*Build the index for sparse matrix
|
||||
containing the jacobian : u*/
|
||||
{
|
||||
nnz++;
|
||||
var += size * t;
|
||||
NbNZRow[eq]++;
|
||||
NbNZCol[var]++;
|
||||
|
@ -2684,7 +2679,7 @@ Interpreter::compute_complete(bool no_derivatives)
|
|||
pair<bool, double>
|
||||
Interpreter::compute_complete(double lambda)
|
||||
{
|
||||
double res1_ = 0, res2_ = 0, max_res_ = 0;
|
||||
double res2_ = 0, max_res_ = 0;
|
||||
int max_res_idx_ = 0;
|
||||
if (steady_state)
|
||||
{
|
||||
|
@ -2716,7 +2711,6 @@ Interpreter::compute_complete(double lambda)
|
|||
if (compute_complete(true))
|
||||
{
|
||||
res2_ += res2;
|
||||
res1_ += res1;
|
||||
if (max_res > max_res_)
|
||||
{
|
||||
max_res = max_res_;
|
||||
|
@ -3477,61 +3471,45 @@ Interpreter::Solve_ByteCode_Sparse_GaussianElimination()
|
|||
"In Solve_ByteCode_Sparse_GaussianElimination, singular system"};
|
||||
}
|
||||
}
|
||||
double markovitz = 0, markovitz_max = -9e70;
|
||||
if (!one)
|
||||
for (int j = 0; j < l; j++)
|
||||
{
|
||||
if (N_max > 0 && NR[j] > 0)
|
||||
{
|
||||
if (fabs(piv_v[j]) > 0)
|
||||
{
|
||||
if (markowitz_c > 0)
|
||||
markovitz = exp(
|
||||
log(fabs(piv_v[j]) / piv_abs)
|
||||
- markowitz_c
|
||||
* log(static_cast<double>(NR[j]) / static_cast<double>(N_max)));
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
}
|
||||
else
|
||||
markovitz = 0;
|
||||
}
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
if (markovitz > markovitz_max)
|
||||
{
|
||||
piv = piv_v[j];
|
||||
pivj = pivj_v[j]; // Line number
|
||||
pivk = pivk_v[j]; // positi
|
||||
markovitz_max = markovitz;
|
||||
}
|
||||
}
|
||||
{
|
||||
double markovitz = 0, markovitz_max = -9e70;
|
||||
for (int j = 0; j < l; j++)
|
||||
{
|
||||
if (N_max > 0 && NR[j] > 0)
|
||||
{
|
||||
if (fabs(piv_v[j]) > 0)
|
||||
{
|
||||
if (markowitz_c > 0)
|
||||
markovitz = exp(
|
||||
log(fabs(piv_v[j]) / piv_abs)
|
||||
- markowitz_c
|
||||
* log(static_cast<double>(NR[j]) / static_cast<double>(N_max)));
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
}
|
||||
else
|
||||
markovitz = 0;
|
||||
}
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
if (markovitz > markovitz_max)
|
||||
{
|
||||
piv = piv_v[j];
|
||||
pivj = pivj_v[j]; // Line number
|
||||
pivk = pivk_v[j]; // positi
|
||||
markovitz_max = markovitz;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for (int j = 0; j < l; j++)
|
||||
{
|
||||
if (N_max > 0 && NR[j] > 0)
|
||||
{
|
||||
if (fabs(piv_v[j]) > 0)
|
||||
{
|
||||
if (markowitz_c > 0)
|
||||
markovitz = exp(
|
||||
log(fabs(piv_v[j]) / piv_abs)
|
||||
- markowitz_c
|
||||
* log(static_cast<double>(NR[j]) / static_cast<double>(N_max)));
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
}
|
||||
else
|
||||
markovitz = 0;
|
||||
}
|
||||
else
|
||||
markovitz = fabs(piv_v[j]) / piv_abs;
|
||||
if (NR[j] == 1)
|
||||
{
|
||||
piv = piv_v[j];
|
||||
pivj = pivj_v[j]; // Line number
|
||||
pivk = pivk_v[j]; // positi
|
||||
markovitz_max = markovitz;
|
||||
}
|
||||
}
|
||||
pivot[i] = pivj;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2007-2022 Dynare Team
|
||||
* Copyright © 2007-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -106,7 +106,6 @@ sparse_hessian_times_B_kronecker_C(const mwIndex* isparseA, const mwIndex* jspar
|
|||
mwIndex k1 = 0;
|
||||
mwIndex k2 = 0;
|
||||
mwIndex iv = 0;
|
||||
int nz_in_column_ii_of_A = 0;
|
||||
/*
|
||||
** Loop over the rows of B⊗C (column jj).
|
||||
*/
|
||||
|
@ -117,7 +116,6 @@ sparse_hessian_times_B_kronecker_C(const mwIndex* isparseA, const mwIndex* jspar
|
|||
if (k1 < k2) // otherwise column ii of A does not have non zero elements (and there is
|
||||
// nothing to compute).
|
||||
{
|
||||
++nz_in_column_ii_of_A;
|
||||
mwIndex iC = ii % mC;
|
||||
mwIndex iB = ii / mC;
|
||||
double cb = C[jC * mC + iC] * B[jB * mB + iB];
|
||||
|
|
|
@ -144,7 +144,6 @@ FirstOrder::solve(const TwoDMatrix& fd)
|
|||
ConstTwoDMatrix fymins(fd, off, ypart.nys());
|
||||
off += ypart.nys();
|
||||
ConstTwoDMatrix fuzero(fd, off, nu);
|
||||
off += nu;
|
||||
|
||||
// Form matrix D
|
||||
lapack_int n = ypart.ny() + ypart.nboth;
|
||||
|
|
|
@ -89,6 +89,8 @@ mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
|
|||
const mxArray* num_threads_mx = mxGetField(threads_mx, 0, "perfect_foresight_problem");
|
||||
if (!(num_threads_mx && mxIsScalar(num_threads_mx) && mxIsNumeric(num_threads_mx)))
|
||||
mexErrMsgTxt("options_.threads.perfect_foresight_problem should be a numeric scalar");
|
||||
// False positive: num_threads is used in OpemMP pragma
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
|
||||
int num_threads = static_cast<int>(mxGetScalar(num_threads_mx));
|
||||
|
||||
// Check other input and map it to local variables
|
||||
|
|
Loading…
Reference in New Issue