Skip to content

Commit

Permalink
Quiet more warnings...
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 14, 2024
1 parent 1f0ba98 commit 1adf146
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2chkder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ dvector laplace_approximation_calculator::
quadratic_prior::in_qp_calculations=1;
funnel_init_var::lapprox=this;
df1b2_gradlist::set_no_derivatives();
dvector scale(1,(int)nvar); // need to get scale from somewhere
/*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
/*check=*/initial_params::stddev_scale(local_scale,x);
dvector sscale=local_scale(1,Dux(1).indexmax());

for (i=1;i<=usize;i++)
{
Expand Down
2 changes: 0 additions & 2 deletions src/df1b2-separable/df1b2fn2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ void df1b2variable::initialize(void)
}
#endif
unsigned int local_nvar=((twointsandptr*)ptr)->ptr->nvar;
#if (__cplusplus >= 201703L)
[[maybe_unused]]
#endif
size_t total_bytes=sizeof(df1b2_header)+sizeof(df1b2_header);
initialize(local_nvar);
}
Expand Down
8 changes: 4 additions & 4 deletions src/df1b2-separable/df1b2lp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ dvector laplace_approximation_calculator::block_diagonal_calculations
{
ivector& re_list=(*block_diagonal_re_list)(i);
ivector& fe_list=(*block_diagonal_fe_list)(i);
dmatrix& Dux=(*block_diagonal_Dux)(i);
dmatrix& local_Dux=(*block_diagonal_Dux)(i);
dmatrix& H=(*block_diagonal_hessian)(i);
xxx(re_list,fe_list);
int mmax=re_list.indexmax();
Expand All @@ -206,7 +206,7 @@ dvector laplace_approximation_calculator::block_diagonal_calculations
if (allocated(H))
{
dvector tmp1=solve(H,tmp);
dvector xtmp=tmp1*Dux;
dvector xtmp=tmp1*local_Dux;
for (int j=1;j<=fe_list.indexmax();j++)
{
x_con(fe_list(j))+=xtmp(j);
Expand Down Expand Up @@ -298,7 +298,7 @@ dvector laplace_approximation_calculator::block_diagonal_calculations
{
ivector& re_list=(*block_diagonal_re_list)(i);
ivector& fe_list=(*block_diagonal_fe_list)(i);
dmatrix& Dux=(*block_diagonal_Dux)(i);
dmatrix& local_Dux=(*block_diagonal_Dux)(i);
xxx(re_list,fe_list);
int mmax=re_list.indexmax();
dvector tmp(1,mmax);
Expand All @@ -311,7 +311,7 @@ dvector laplace_approximation_calculator::block_diagonal_calculations
if (allocated(fe_list))
{
dvector tmp1=solve(H,tmp);
dvector xtmp=tmp1*Dux;
dvector xtmp=tmp1*local_Dux;
for (int j=1;j<=fe_list.indexmax();j++)
{
x_con(fe_list(j))+=xtmp(j);
Expand Down
14 changes: 7 additions & 7 deletions src/df1b2-separable/df1b2lp6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ void laplace_approximation_calculator::
}
else if (hesstype==4)
{
dvector step;
dvector local_step;

# if defined(USE_ATLAS)
if (!ad_comm::no_atlas_flag)
{
step=-atlas_solve_spd(Hess,grad,ierr);
local_step=-atlas_solve_spd(Hess,grad,ierr);
}
else
{
dmatrix A=choleski_decomp_positive(Hess,ierr);
if (!ierr)
{
step=-solve(Hess,grad);
local_step=-solve(Hess,grad);
//step=-solve(A*trans(A),grad);
}
}
Expand All @@ -214,7 +214,7 @@ void laplace_approximation_calculator::
dvector temp=solve(*sparse_triplet2,grad,*sparse_symbolic2,ierr);
if (ierr)
{
step=-temp;
local_step=-temp;
}
else
{
Expand Down Expand Up @@ -250,13 +250,13 @@ void laplace_approximation_calculator::
}
else
{
step=-solve(Hess,grad);
local_step=-solve(Hess,grad);
}
# endif
if (pmin->bad_step_flag)
break;
uhat_old=uhat;
uhat+=step;
uhat+=local_step;

double maxg_old=maxg;
maxg=fabs(evaluate_function(uhat,pfmin));
Expand Down Expand Up @@ -742,7 +742,7 @@ void laplace_approximation_calculator::
for (int i=1;i<=num_local_re;i++)
{
int lrei = *plre_indexi;
ivector* plisti = &list(lrei);
plisti = &list(lrei);
int i1 = *(plisti->get_v() + 1) - xsize;
int i2 = *(plisti->get_v() + 2);

Expand Down
10 changes: 5 additions & 5 deletions src/df1b2-separable/dflocmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dvar_vector *
* \param
*/
dvector laplace_approximation_calculator::local_minimization
(dvector& s,dmatrix& H,dvector& grad,double lambda)
(dvector& s,dmatrix& H,dvector& _grad,double lambda)
{
dvector vbest(1,usize);
vbest.initialize();
Expand All @@ -52,7 +52,7 @@ dvector laplace_approximation_calculator::local_minimization
std::ostream& output_stream = get_output_stream();
do
{
dvector v=local_minimization_routine(s,H,grad,lambda);
dvector v=local_minimization_routine(s,H,_grad,lambda);
dvector xx=uhat+v;
double f2=evaluate_function_no_derivatives(xx,pmin);
output_stream << endl << fbest-f2 << endl;
Expand Down Expand Up @@ -95,7 +95,7 @@ dvector laplace_approximation_calculator::local_minimization
* \param
*/
dvector laplace_approximation_calculator::local_minimization_routine
(dvector& s,dmatrix& H,dvector& grad,double lambda)
(dvector& s,dmatrix& H,dvector& _grad,double lambda)
{
double f=0.0;
double fb=1.e+100;
Expand Down Expand Up @@ -124,15 +124,15 @@ dvector laplace_approximation_calculator::local_minimization_routine
dvector z=H*v;
double vHv=v*z;

double gradv=grad*v;
double gradv=_grad*v;
f=lambda*gradv+0.5*lambda*lambda*vHv+ square(ns2-1.0);
//f=0.5*lambda*lambda*s*H*s;
if (f<fb)
{
fb=f;
ub=s;
}
g=lambda*grad/ns -lambda * gradv*s/ns2
g=lambda*_grad/ns -lambda * gradv*s/ns2
+ lambda * lambda * z/ns
- lambda * lambda * vHv*s/ns2 + 4.0*(ns2-1.0)*s;
}
Expand Down
7 changes: 4 additions & 3 deletions src/linad99/df12fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,10 @@ init_df1_two_variable::init_df1_two_variable(const prevariable& _v)
}
else
{
ADUNCONST(prevariable,v)
ind_var[num_ind_var++]=&v;
*get_u() = value(v);
//ADUNCONST(prevariable,v)
prevariable& local_v = const_cast<prevariable&>(_v);
ind_var[num_ind_var++]=&local_v;
*get_u() = value(local_v);
switch(num_ind_var)
{
case 1:
Expand Down
7 changes: 4 additions & 3 deletions src/nh99/output_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void function_minimizer::hess_step(){
dvector gr2(1,nvar); // updated gradients
dvariable nll,nll2; // minimal values
//double maxgrad;
double maxgrad0, mingrad0, maxgrad2, mingrad2;
read_mle_hmc(nvar, mle); // takes MLE from admodel.hes file

// Push the original bounded MLE through the model
Expand All @@ -122,8 +121,10 @@ void function_minimizer::hess_step(){
*objective_function_value::pobjfun=0.0;
userfunction();
gradcalc(nvar,gr0); // initial unbounded gradient
maxgrad0=max(fabs(gr0));
mingrad0=min(fabs(gr0));
double maxgrad0=max(fabs(gr0));
double mingrad0=min(fabs(gr0));
double maxgrad2 = maxgrad0;
double mingrad2 = mingrad0;
nll=*objective_function_value::pobjfun;
adstring_array pars(1,nvar);
pars = get_param_names();
Expand Down

0 comments on commit 1adf146

Please sign in to comment.