[ADMB Users] problem with 2 selection periods in calculating F

Luis Ridao luridao at gmail.com
Tue Jan 4 07:22:48 PST 2011


Hi Steve,

Thanks for your help.
It's working now with:
.................
.................
for(i=1;i<=nyrs;i++)
  {
  if (i<=44)
  {
  F(i)=mfexp(log_fy(i))*mfexp(log_sel1);
  }
  else
  F(i)=mfexp(log_fy(i))*mfexp(log_sel2);
  }
................
................

Thanks again.

Best,
Luis

On Tue, Jan 4, 2011 at 1:37 PM, Steve Martell <s.martell at fisheries.ubc.ca>wrote:

> Based on the error message, it looks like your are trying to use the .sub
> command on a vector.  Is log_fy a vector?  Also, it looks like F is a matrix
> based on the error message, so F(1,44) is pointing to row 1 column 44.
>
> S.
> On 2011-01-04, at 4:09 AM, Luis Ridao wrote:
>
> > ADMB-users,
> >
> > I get an error when calculating F for two different selection periods:
> > The selection periods are from 1961 to 2004 (1:44) and from 2005 to 2009
> (45:49)
> > ........
> >   F(1,44)=outer_prod(mfexp(log_fy.sub(1,44)),mfexp(log_sel1));      //
> LINE 156
> >   F(45,49)=outer_prod(mfexp(log_fy.sub(45,49)),mfexp(log_sel2));  // LINE
> 157
> > ........
> >
> > The compiling fails:
> >
> > sai6109_rm_pt_sr_2sel.cpp: In member function ‘void
> model_parameters::get_mortality_and_survivial_rates()’:
> > sai6109_rm_pt_sr_2sel.cpp:156: error: no match for ‘operator=’ in
> ‘((model_parameters*)this)->model_parameters::F.named_dvar_matrix::<anonymous>.dvar_matrix::operator()(1,
> 44) = outer_prod(const dvar_vector&, const dvar_vector&)(((const
> dvar_vector&)((const dvar_vector*)(& mfexp(const dvar_vector&)()))))’
> > /media/Data/ADMB/include/fvar.hpp:1695: note: candidates are:
> prevariable& prevariable::operator=(const prevariable&)
> > /media/Data/ADMB/include/fvar.hpp:1696: note:
> prevariable& prevariable::operator=(double)
> > sai6109_rm_pt_sr_2sel.cpp:157: error: no match for ‘operator=’ in
> ‘((model_parameters*)this)->model_parameters::F.named_dvar_matrix::<anonymous>.dvar_matrix::operator()(45,
> 49) = outer_prod(const dvar_vector&, const dvar_vector&)(((const
> dvar_vector&)((const dvar_vector*)(& mfexp(const dvar_vector&)()))))’
> > /media/Data/ADMB/include/fvar.hpp:1695: note: candidates are:
> prevariable& prevariable::operator=(const prevariable&)
> > /media/Data/ADMB/include/fvar.hpp:1696: note:
> prevariable& prevariable::operator=(double)
> >
> > Thanks in advance
> > _______________________________________________
> > Users mailing list
> > Users at admb-project.org
> > http://lists.admb-project.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110104/1a46fc04/attachment.html>


More information about the Users mailing list