From c72978497220687840aeb15247d9d11df6d49896 Mon Sep 17 00:00:00 2001 From: johnoel Date: Tue, 13 Feb 2024 15:48:21 -1000 Subject: [PATCH] Again silence warnings... --- src/df1b2-separable/df1b2chkder.cpp | 6 +++--- src/df1b2-separable/df1b2f13.cpp | 6 +++--- src/df1b2-separable/df1b2lme.cpp | 26 ++++++++++--------------- src/df1b2-separable/df1b2lp7.cpp | 4 ++-- src/df1b2-separable/df1b2lp8.cpp | 30 ++++++++++++++--------------- 5 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/df1b2-separable/df1b2chkder.cpp b/src/df1b2-separable/df1b2chkder.cpp index 54e7d0b64..335b898c7 100644 --- a/src/df1b2-separable/df1b2chkder.cpp +++ b/src/df1b2-separable/df1b2chkder.cpp @@ -438,9 +438,9 @@ dvector laplace_approximation_calculator:: #ifdef DEBUG assert(nvar <= INT_MAX); #endif - 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/df1b2-separable/df1b2f13.cpp b/src/df1b2-separable/df1b2f13.cpp index 4b30bd414..7a32b432c 100644 --- a/src/df1b2-separable/df1b2f13.cpp +++ b/src/df1b2-separable/df1b2f13.cpp @@ -542,9 +542,9 @@ void fixed_smartlist::read_file(void) { //rewind the file off_t pos=lseek(fp,0L,SEEK_SET); - char buffer[50000]; + char local_buffer[50000]; int offset=0; - fixed_list_entry * b= (fixed_list_entry*) &(buffer[0]); + fixed_list_entry * b= (fixed_list_entry*) &(local_buffer[0]); cout << b << endl; ssize_t nw = 0; do @@ -553,7 +553,7 @@ void fixed_smartlist::read_file(void) nw = ::read(fp,&nbytes,sizeof(unsigned int)); if (nw != -1) { - nw = ::read(fp, buffer + offset, (size_t)nbytes); + nw = ::read(fp, local_buffer + offset, (size_t)nbytes); if (nw != -1) { offset+=nbytes; diff --git a/src/df1b2-separable/df1b2lme.cpp b/src/df1b2-separable/df1b2lme.cpp index dda558711..3935016ba 100644 --- a/src/df1b2-separable/df1b2lme.cpp +++ b/src/df1b2-separable/df1b2lme.cpp @@ -41,11 +41,11 @@ void laplace_approximation_calculator::get_hessian_components_banded_lme ad_exit(1); } df1b2_gradlist::set_no_derivatives(); - int nvar=initial_params::nvarcalc_all(); - dvector x(1,nvar); + int local_nvar=initial_params::nvarcalc_all(); + dvector x(1,local_nvar); initial_params::xinit_all(x); initial_df1b2params::reset_all(x); - for (int i=1;i<=nvar;i++) y(i)=x(i); + for (int i=1;i<=local_nvar;i++) y(i)=x(i); step=get_newton_raphson_info_banded(pfmin); *tmpHess=Hess; } @@ -78,11 +78,11 @@ void laplace_approximation_calculator::get_hessian_components_banded_lme } df1b2_gradlist::set_no_derivatives(); - int nvar=initial_params::nvarcalc_all(); - dvector x(1,nvar); + int local_nvar=initial_params::nvarcalc_all(); + dvector x(1,local_nvar); initial_params::xinit_all(x); initial_df1b2params::reset_all(x); - for (int i=1;i<=nvar;i++) y(i)=x(i); + for (int i=1;i<=local_nvar;i++) y(i)=x(i); step=get_newton_raphson_info_banded(pfmin); switch(hesstype) @@ -202,7 +202,7 @@ dvector laplace_approximation_calculator::banded_calculations_lme dvariable tmp=0.0; dvariable sgn; - dvector step=value(solve(vHess,g,tmp,sgn)); + dvector local_step=value(solve(vHess,g,tmp,sgn)); if (value(sgn)<=0) { cerr << "sgn sucks" << endl; @@ -213,7 +213,7 @@ dvector laplace_approximation_calculator::banded_calculations_lme dvector g1(1,nv); ld=0.5*tmp; gradcalc(nv,g1); - uhat-=step; + uhat-=local_step; initial_params::set_active_only_random_effects(); double maxg=max(fabs(get_gradient_lme(uhat,pfmin))); @@ -251,10 +251,7 @@ dvector laplace_approximation_calculator::get_gradient_lme objective_function_value::fun_without_pen=value(vf); vf+=pen; -#if (__cplusplus >= 201703L) - [[maybe_unused]] -#endif - double f = value(vf); + [[maybe_unused]] double f = value(vf); gradcalc(usize, g); return g; } @@ -281,10 +278,7 @@ dvector laplace_approximation_calculator::get_gradient_lme objective_function_value::fun_without_pen=value(vf); vf+=pen; -#if (__cplusplus >= 201703L) - [[maybe_unused]] -#endif - double f = value(vf); + [[maybe_unused]] double f = value(vf); gradcalc(usize, g); return g; } diff --git a/src/df1b2-separable/df1b2lp7.cpp b/src/df1b2-separable/df1b2lp7.cpp index 4b7d8395f..b7de975b3 100644 --- a/src/df1b2-separable/df1b2lp7.cpp +++ b/src/df1b2-separable/df1b2lp7.cpp @@ -171,7 +171,7 @@ void laplace_approximation_calculator:: } else { - dcompressed_triplet * vsparse_triplet_adjoint = + dcompressed_triplet * local_vsparse_triplet_adjoint = pmin->lapprox->vsparse_triplet_adjoint; for (int i=1;i<=num_local_re;i++) { @@ -192,7 +192,7 @@ void laplace_approximation_calculator:: // +=locy(i2).u_bar[j2-1]; sparse_count_adjoint++; locy(i2).get_u_bar_tilde()[j2-1]= - (*vsparse_triplet_adjoint) + (*local_vsparse_triplet_adjoint) ((*sparse_iterator)(sparse_count_adjoint)); } } diff --git a/src/df1b2-separable/df1b2lp8.cpp b/src/df1b2-separable/df1b2lp8.cpp index d6b637853..ced45ed22 100644 --- a/src/df1b2-separable/df1b2lp8.cpp +++ b/src/df1b2-separable/df1b2lp8.cpp @@ -209,8 +209,8 @@ void laplace_approximation_calculator::generate_antithetical_rvs() { M(i)=M(i)/norm(M(i)); } - int nvar=(samplesize-1)*n; - independent_variables xx(1,nvar); + int local_nvar=(samplesize-1)*n; + independent_variables xx(1,local_nvar); ii=0; for (int i=2;i<=samplesize;i++) { @@ -220,33 +220,33 @@ void laplace_approximation_calculator::generate_antithetical_rvs() } } - fmmt1 fmc(nvar,5); - //fmm fmc(nvar,5); - fmc.noprintx=1; - fmc.iprint = defaults::iprint; - fmc.maxfn=2500; - fmc.crit=1.e-6; + fmmt1 local_fmc(local_nvar,5); + //fmm fmc(local_nvar,5); + local_fmc.noprintx=1; + local_fmc.iprint = defaults::iprint; + local_fmc.maxfn=2500; + local_fmc.crit=1.e-6; double f; double fbest=1.e+50;; - dvector g(1,nvar); - dvector gbest(1,nvar); - dvector xbest(1,nvar); + dvector g(1,local_nvar); + dvector gbest(1,local_nvar); + dvector xbest(1,local_nvar); gbest.fill_seqadd(1.e+50,0.); { - while (fmc.ireturn>=0) + while (local_fmc.ireturn>=0) { //int badflag=0; - fmc.fmin(f,xx,g); - if (fmc.ihang) + local_fmc.fmin(f,xx,g); + if (local_fmc.ihang) { //int hang_flag=fmc.ihang; //double maxg=max(g); //double ccrit=fmc.crit; //int current_ifn=fmc.ifn; } - if (fmc.ireturn>0) + if (local_fmc.ireturn>0) { f=fcomp1(xx,dist,samplesize,n,g,M); if (f < fbest)