[ADMB Users] Question about vectors

bigA jaguar.smart at gmail.com
Thu Nov 27 12:19:30 PST 2014


Hi Users,

I have a few questions about vectors.
First, was there a conscious decision by ADMB to start counting at 1 rather
than 0?
The second is perhaps a historical question. I know the stl was probably
not around when AUTODIF was written, were the datatypes based on another
C++ library? Most array's can be accessed by square brackets, what
protection is given to the user by using parenthesis?

Thanks,
Aaron

Below is a FINAL_SECTION I put on the simple example.

 for(int i=1; i<nobs;i++){cout<<i<<"\t";} // write out the index
  cout<<"\n"<<endl; //give a bit of space
 for(int i=1; i<nobs;i++){cout<<pred_Y[i]<<"\t";}// write out vector of
predicted Y's
   cout<<"\n"<<endl;// space

 for(int i=1; i<4;i++){ //counting from 1 works
   cout<<pred_Y[i]<<endl; //square brackets
   cout<<pred_Y(i)<<endl;// parenthesis
   }

 for(int i=0; i<4;i++){// counting from zero doesn't work
   cout<<pred_Y[i]<<endl;
   cout<<pred_Y(i)<<endl;
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141127/377af664/attachment.html>


More information about the Users mailing list