Skip to content

Commit

Permalink
More warning fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 15, 2024
1 parent 00a882d commit 7416481
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/linad99/conjprod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,20 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
}
#endif
dvector& p = (dvector&)_p;
dvector& gg = (dvector&)_gg;
dvector& local_gg = (dvector&)_gg;
int n = static_cast<int>(p.size());
dvector& xi=*(this->xi);
dvector& h=*(this->h);
dvector& g=*(this->g);
double& fp=this->fp;
dvector& ptr_h = *(this->h);
dvector& ptr_g = *(this->g);
double& ptr_fp = this->fp;
//int& its=this->its;
//int& J=this->J;
if (this->frp_flag > 0) this->ifn++;

if (ireturn >= 3)
{
{
derch(fret, p , gg, n, ireturn);
derch(fret, p , local_gg, n, ireturn);
}
return;
}
Expand All @@ -183,9 +183,9 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
#endif

int con_flag = 1;
for (int jj=gg.indexmin();jj<=gg.indexmax();jj++)
for (int jj=local_gg.indexmin();jj<=local_gg.indexmax();jj++)
{
if (fabs(gg(jj)) > crit)
if (fabs(local_gg(jj)) > crit)
{
con_flag=0;
break;
Expand All @@ -202,15 +202,15 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
printf("%d variables; iteration %ld; function evaluation %ld\n",
n, iter, ifn);
printf("Function value %le; maximum gradient component mag %le\n",
fret, max(fabs(gg)) );
fmmdisp(p, gg, n, this->scroll_flag); //fmc);
fret, max(fabs(local_gg)) );
fmmdisp(p, local_gg, n, this->scroll_flag); //fmc);
}
}
return;
}
fbest=fret;
*xbest=p;
*gbest=gg;
*gbest=local_gg;
}
}

Expand Down Expand Up @@ -239,11 +239,11 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)

fbest=fret;
*xbest=p;
*gbest=gg;
*gbest=local_gg;

this->frp_flag=0;
this->ireturn=0;
xi=gg;
xi=local_gg;
this->fp=fret;
//(*dfunc)(p,xi);

Expand All @@ -266,8 +266,8 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
{
for (int local_j=1;local_j<=n;local_j++)
{
g[local_j] = -xi[local_j];
xi[local_j]=h[local_j]=g[local_j];
ptr_g[local_j] = -xi[local_j];
xi[local_j]=ptr_h[local_j]=ptr_g[local_j];
}
}

Expand All @@ -290,7 +290,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
{
ireturn = 3;
{
derch(fret, p , gg, n, ireturn);
derch(fret, p , local_gg, n, ireturn);
}
return;
}
Expand All @@ -313,7 +313,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
}
}
p=*xbest;
gg=*gbest;
local_gg=*gbest;
return;
}
else
Expand All @@ -323,7 +323,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
}
}
{
mylinmin(fret,fp,p,-1.*(g),*this);
mylinmin(fret,ptr_fp,p,-1.*(ptr_g),*this);
}
if (this->lin_flag ==0) goto label10;

Expand All @@ -339,7 +339,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
//this->extf=fcomp( *(this->extx),*(this->extg) );
this->extf=fret;
*(this->extx)=p;
*(this->extg)=gg;
*(this->extg)=local_gg;
goto label5;
label10:

Expand Down Expand Up @@ -367,7 +367,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
}
}
p=*xbest;
gg=*gbest;
local_gg=*gbest;
return;
}

Expand Down Expand Up @@ -419,7 +419,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
fmmdisp(*xbest, *gbest, n, this->scroll_flag); //fmc);
}
p=*xbest;
gg=*gbest;
local_gg=*gbest;
this->ireturn=-1;
return;
}
Expand All @@ -446,7 +446,7 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
label3000:
this->frp_flag=0;
this->ireturn=0;
xi=gg;
xi=local_gg;
this->fp=fret;

//fp=fcomp(p,xi);
Expand All @@ -455,9 +455,9 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
{
for (int local_j=1;local_j<=n;local_j++)
{
this->gg += g[local_j]*g[local_j];
this->gg += ptr_g[local_j]*ptr_g[local_j];
/* dgg += xi[local_j]*xi[local_j]; */
this->dgg += (xi[local_j]+g[local_j])*xi[local_j];
this->dgg += (xi[local_j]+ptr_g[local_j])*xi[local_j];
}
}
if (this->gg == 0.0)
Expand All @@ -469,8 +469,8 @@ void fmmc::fmin(const double& fret, const dvector& _p, const dvector& _gg)
{
for (int local_j=1;local_j<=n;local_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];
ptr_g[local_j] = -xi[local_j]; // g seems to hold the negative gradient
xi[local_j]=ptr_h[local_j]=ptr_g[local_j]+this->gam*ptr_h[local_j];
}
}
// if (this->iter <= ITMAX) goto label1000;
Expand Down

0 comments on commit 7416481

Please sign in to comment.