[ADMB Users] Missing overloaded operators (+=, -=) in random effects
dave fournier
davef at otter-rsch.com
Tue Apr 5 07:47:02 PDT 2011
Easiest thing is to find a similar function such as
df1b2vector& df1b2vector::operator -= (const df1b2vector& _x)
{
ADUNCONST(df1b2vector,x)
check_shape(*this,x,"operator -");
int mmin=x.indexmin();
int mmax=x.indexmax();
for (int i=mmin;i<=mmax;i++)
{
(*this)(i)-=x(i);
}
return *this;
}
and change it to
df1b2vector& df1b2vector::operator -= (const dvector& _x)
{
ADUNCONST(dvector,x)
check_shape(*this,x,"operator -");
int mmin=x.indexmin();
int mmax=x.indexmax();
for (int i=mmin;i<=mmax;i++)
{
(*this)(i)-=x(i);
}
return *this;
}
Note that this is a class member function for df1b2vector
so you need to put it in the class declaration header file as
df1b2vector& operator -= (const dvector& _x);
More information about the Users
mailing list