Skip to content

Commit

Permalink
More changes...
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 14, 2024
1 parent 1adf146 commit 3216dba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
26 changes: 13 additions & 13 deletions src/df1b2-separable/df1b2f25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ void df1b2_init_vector::sd_scale(const dvector& _v, [[maybe_unused]] const dvect
if (allocated())
{
int& ii=(int&) _ii;
dvector& v=(dvector&) _v;
dvector& local_v = const_cast<dvector&>(_v);
int mmin=indexmin();
int mmax=indexmax();
for (int i=mmin;i<=mmax;i++)
{
v(ii)=1.;
if (!ISZERO(scalefactor)) v(ii)/=scalefactor;
local_v(ii)=1.;
if (!ISZERO(scalefactor)) local_v(ii)/=scalefactor;
ii++;
}
}
Expand All @@ -110,7 +110,7 @@ void df1b2_init_matrix::sd_scale(const dvector& _v, [[maybe_unused]] const dvect
if (allocated())
{
int& ii=(int&) _ii;
dvector& v=(dvector&) _v;
dvector& local_v = const_cast<dvector&>(_v);
int mmin=indexmin();
int mmax=indexmax();
for (int i=mmin;i<=mmax;i++)
Expand All @@ -121,8 +121,8 @@ void df1b2_init_matrix::sd_scale(const dvector& _v, [[maybe_unused]] const dvect
int cmax=((*this)(i)).indexmax();
for (int j=cmin;j<=cmax;j++)
{
v(ii)=1.;
if (!ISZERO(scalefactor)) v(ii)/=scalefactor;
local_v(ii) = 1.0;
if (!ISZERO(scalefactor)) local_v(ii)/=scalefactor;
ii++;
}
}
Expand All @@ -140,7 +140,7 @@ void df1b2_init_bounded_vector::sd_scale(const dvector& _v,const dvector& x,
if (allocated())
{
int& ii=(int&) _ii;
dvector& v=(dvector&) _v;
dvector& local_v = const_cast<dvector&>(_v);
int mmin=indexmin();
int mmax=indexmax();
double pen=0;
Expand All @@ -149,17 +149,17 @@ void df1b2_init_bounded_vector::sd_scale(const dvector& _v,const dvector& x,
for (int i=mmin;i<=mmax;i++)
{
if (ISZERO(scalefactor))
v(ii)=ndfboundp(x(ii),minb,maxb,pen);
local_v(ii)=ndfboundp(x(ii),minb,maxb,pen);
else
v(ii)=ndfboundp(x(ii)/scalefactor,minb,maxb,pen)/scalefactor;
local_v(ii)=ndfboundp(x(ii)/scalefactor,minb,maxb,pen)/scalefactor;
ii++;
}
}
else
{
for (int i=mmin;i<=mmax;i++)
{
v(ii)=ndfboundp_mc(x(ii),minb,maxb,pen);
local_v(ii)=ndfboundp_mc(x(ii),minb,maxb,pen);
ii++;
}
}
Expand All @@ -176,7 +176,7 @@ void df1b2_init_bounded_matrix::sd_scale(const dvector& _v,const dvector& x,
if (allocated())
{
int& ii=(int&) _ii;
dvector& v=(dvector&) _v;
dvector& local_v = const_cast<dvector&>(_v);
int rmin=indexmin();
int rmax=indexmax();
double pen=0;
Expand All @@ -189,9 +189,9 @@ void df1b2_init_bounded_matrix::sd_scale(const dvector& _v,const dvector& x,
for (int j=cmin;j<=cmax;j++)
{
if (ISZERO(scalefactor))
v(ii)=ndfboundp(x(ii),minb,maxb,pen);
local_v(ii)=ndfboundp(x(ii),minb,maxb,pen);
else
v(ii)=ndfboundp(x(ii)/scalefactor,minb,maxb,pen)/
local_v(ii)=ndfboundp(x(ii)/scalefactor,minb,maxb,pen)/
scalefactor;
ii++;
}
Expand Down
7 changes: 4 additions & 3 deletions src/df1b2-separable/df1b2fnl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,12 @@ funnel_init_df1b2variable::funnel_init_df1b2variable
(const random_effects_bounded_vector_info & _u)
: df1b2variable(newadkl)
{
ADUNCONST(random_effects_bounded_vector_info,u)
df1b2variable& x = (*(u.pv)).df1b2vector::operator () (u.i);
//ADUNCONST(random_effects_bounded_vector_info,u)
random_effects_bounded_vector_info& local_u = const_cast<random_effects_bounded_vector_info&>(_u);
df1b2variable& x = (*(local_u.pv)).df1b2vector::operator () (local_u.i);

type=1;
pointer=u.pv;
pointer=local_u.pv;
ind_index = x.get_ind_index();
if (ind_index<0)
{
Expand Down
7 changes: 4 additions & 3 deletions src/linad99/df13fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,10 @@ init_df1_three_variable::init_df1_three_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

0 comments on commit 3216dba

Please sign in to comment.