Skip to content

Commit

Permalink
Again silence warnings...
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 14, 2024
1 parent 095e6d0 commit c729784
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 39 deletions.
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2chkder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2f13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
26 changes: 10 additions & 16 deletions src/df1b2-separable/df1b2lme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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)));
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/df1b2-separable/df1b2lp7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand All @@ -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));
}
}
Expand Down
30 changes: 15 additions & 15 deletions src/df1b2-separable/df1b2lp8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand All @@ -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)
Expand Down

0 comments on commit c729784

Please sign in to comment.