From 556ef4f9a32787777c28ab054e406ce4ceb6306b Mon Sep 17 00:00:00 2001 From: johnoel Date: Wed, 14 Feb 2024 12:23:57 -1000 Subject: [PATCH] More quiet warnings... --- src/df1b2-separable/df1b2lp6.cpp | 6 +++--- src/linad99/conjprod.cpp | 20 ++++++++++---------- src/linad99/df13fun.cpp | 10 +++++----- src/nh99/lmnewton.cpp | 4 ++-- src/nh99/nuts.cpp | 8 ++++---- src/nh99/randeff.cpp | 16 ++++++++-------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/df1b2-separable/df1b2lp6.cpp b/src/df1b2-separable/df1b2lp6.cpp index 3b0095cc2..1957c906a 100644 --- a/src/df1b2-separable/df1b2lp6.cpp +++ b/src/df1b2-separable/df1b2lp6.cpp @@ -609,9 +609,9 @@ dvector laplace_approximation_calculator::banded_calculations } if (initial_df1b2params::separable_flag) { - dvector scale(1,(int)nvar); // need to get scale from somewhere - /*int check=*/initial_params::stddev_scale(scale,x); - dvector sscale=scale(1,Dux(1).indexmax()); + dvector local_scale(1,(int)nvar); // need to get scale from somewhere + /*int check=*/initial_params::stddev_scale(local_scale,x); + dvector sscale=local_scale(1,Dux(1).indexmax()); for (i=1;i<=usize;i++) { Dux(i)=elem_prod(Dux(i),sscale); diff --git a/src/linad99/conjprod.cpp b/src/linad99/conjprod.cpp index 65690a3a9..abf415a02 100644 --- a/src/linad99/conjprod.cpp +++ b/src/linad99/conjprod.cpp @@ -264,10 +264,10 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg) } { - for (int j=1;j<=n;j++) + for (int local_j=1;local_j<=n;local_j++) { - g[j] = -xi[j]; - xi[j]=h[j]=g[j]; + g[local_j] = -xi[local_j]; + xi[local_j]=h[local_j]=g[local_j]; } } @@ -453,11 +453,11 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg) this->dgg=this->gg=0.0; { - for (int j=1;j<=n;j++) + for (int local_j=1;local_j<=n;local_j++) { - this->gg += g[j]*g[j]; -/* dgg += xi[j]*xi[j]; */ - this->dgg += (xi[j]+g[j])*xi[j]; + this->gg += g[local_j]*g[local_j]; +/* dgg += xi[local_j]*xi[local_j]; */ + this->dgg += (xi[local_j]+g[local_j])*xi[local_j]; } } if (this->gg == 0.0) @@ -467,10 +467,10 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg) } this->gam=this->dgg/this->gg; { - for (int j=1;j<=n;j++) + for (int local_j=1;local_j<=n;local_j++) { - g[j] = -xi[j]; // g seems to hold the negative gradient - xi[j]=h[j]=g[j]+this->gam*h[j]; + g[local_j] = -xi[local_j]; // g seems to hold the negative gradient + xi[local_j]=h[local_j]=g[local_j]+this->gam*h[local_j]; } } // if (this->iter <= ITMAX) goto label1000; diff --git a/src/linad99/df13fun.cpp b/src/linad99/df13fun.cpp index 23fa94960..e0c4e9095 100644 --- a/src/linad99/df13fun.cpp +++ b/src/linad99/df13fun.cpp @@ -965,15 +965,15 @@ df1_three_matrix choleski_decomp(const df1_three_matrix& MM) * Description not yet available. * \param */ -dvariable& dvariable::operator = (const df1_three_variable& v) +dvariable& dvariable::operator = (const df1_three_variable& _v) { const prevariable * px=df1_three_variable::ind_var[0]; const prevariable * py=df1_three_variable::ind_var[1]; const prevariable * pz=df1_three_variable::ind_var[2]; - double dfx= *v.get_u_x(); - double dfy= *v.get_u_y(); - double dfz= *v.get_u_z(); - value(*this)=*v.get_u(); + double dfx = *_v.get_u_x(); + double dfy = *_v.get_u_y(); + double dfz = *_v.get_u_z(); + value(*this) = *_v.get_u(); gradient_structure::GRAD_STACK1->set_gradient_stack(default_evaluation3ind, &(value(*this)),&(value(*px)),dfx,&(value(*py)),dfy,&(value(*pz)), diff --git a/src/nh99/lmnewton.cpp b/src/nh99/lmnewton.cpp index f4ad5b5e2..15bde8fa9 100644 --- a/src/nh99/lmnewton.cpp +++ b/src/nh99/lmnewton.cpp @@ -224,7 +224,7 @@ void function_minimizer::limited_memory_quasi_newton( void function_minimizer::limited_memory_quasi_newton (double& f, const independent_variables& _x, int m, int noprintx, - int maxfn, double crit) + int _maxfn, double crit) { independent_variables& x = (independent_variables&) _x; if (m<=0) @@ -353,7 +353,7 @@ void function_minimizer::limited_memory_quasi_newton goto L50; } ++icall; - if (icall > maxfn) + if (icall > _maxfn) { goto L50; } diff --git a/src/nh99/nuts.cpp b/src/nh99/nuts.cpp index 4f02eacd6..5456112c0 100644 --- a/src/nh99/nuts.cpp +++ b/src/nh99/nuts.cpp @@ -546,9 +546,9 @@ void function_minimizer::nuts_mcmc_routine(int nmcmc,int iseed0, [[maybe_unused] independent_variables _parsaveprime(1,nvar); // These are used inside NUTS by reference - int _nalphaprime, _nprime, _nfevals; - double _alphaprime; - bool _sprime, _divergent; + int _nalphaprime = 0; + double _alphaprime = 0.0; + bool _sprime; int ndivergent=0; // # divergences post-warmup int nsamples=0; // total samples, not always nmcmc if duration option used // Declare some local variables used below. @@ -591,7 +591,7 @@ void function_minimizer::nuts_mcmc_routine(int nmcmc,int iseed0, [[maybe_unused] epsvec(1)=eps; epsbar(1)=eps; Hbar(1)=0; } // Generate single NUTS trajectory by repeatedly doubling build_tree - _nprime=0; _divergent=0; _nfevals=0; + int _nprime=0; bool _divergent=0; int _nfevals=0; n=1; s=1; j=0; // Reset global ones to initial point of this trajectory thetaminus_end=theta; thetaplus_end=theta; thetaprime=theta; diff --git a/src/nh99/randeff.cpp b/src/nh99/randeff.cpp index d78520466..6469d432e 100644 --- a/src/nh99/randeff.cpp +++ b/src/nh99/randeff.cpp @@ -82,23 +82,23 @@ dvariable function_minimizer::random_effects_maximization(const dvar_vector& _x) } gradient_structure::set_YES_DERIVATIVES(); // set convergence criterion for this phase - dvector convergence_criteria; - if (!(!convergence_criteria)) + dvector local_convergence_criteria; + if (!(!local_convergence_criteria)) { - int ind=min(convergence_criteria.indexmax(), + int ind=min(local_convergence_criteria.indexmax(), initial_params::current_phase); - crit=convergence_criteria(ind); + crit=local_convergence_criteria(ind); } if (!ISZERO(_crit)) { crit = _crit; } - dvector maximum_function_evaluations; - if (!(!maximum_function_evaluations) && !maxfn_option) + dvector local_maximum_function_evaluations; + if (!(!local_maximum_function_evaluations) && !maxfn_option) { - int ind=min(maximum_function_evaluations.indexmax(), + int ind=min(local_maximum_function_evaluations.indexmax(), initial_params::current_phase); - maxfn= (int) maximum_function_evaluations(ind); + maxfn= (int) local_maximum_function_evaluations(ind); } dvariable vf=0.0;