ADMB Documentation  11.1.2192
 All Classes Files Functions Variables Typedefs Friends Defines
nvarcall.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: nvarcall.cpp 1967 2014-04-30 23:36:04Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <admodel.h>
00012 
00017   int initial_params::nvarcalc_all()
00018   {
00019     int nvar=0;
00020     for (int i=0;i<num_initial_params;i++)
00021     {
00022       nvar+= (varsptr[i])->size_count();
00023     }
00024     return nvar;
00025   }
00026 
00031   void initial_params::xinit_all(const dvector& _x)
00032   {
00033     dvector& x=(dvector&) _x;
00034     int ii=1;
00035     for (int i=0;i<num_initial_params;i++)
00036     {
00037       (varsptr[i])->set_value_inv(x,ii);
00038     }
00039   }
00040 
00045   dvariable initial_params::reset_all(const dvar_vector& x,const dvector& __pen)
00046   {
00047     dvector& _pen=(dvector&) __pen;
00048     int ii=1;
00049     dvariable pen=0.0;
00050     dvariable pen1;
00051     for (int i=0;i<num_initial_params;i++)
00052     {
00053       (varsptr[i])->set_value(x,ii,pen1);
00054       _pen(ii-1)=value(pen1);
00055       pen+=pen1;
00056     }
00057     return pen;
00058   }