ADMB Documentation  11.1.2448
 All Classes Files Functions Variables Typedefs Friends Defines
mod_prof.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: mod_prof.cpp 1942 2014-04-28 22:22:45Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00007 #include <admodel.h>
00008 
00009  int likeprof_params::num_likeprof_params=0;
00010  likeprof_params * likeprof_params::likeprofptr[500]; // this should be
00011                                                  // a resizeable array
00012 
00013   likeprof_params::likeprof_params(void)
00014   {
00015     stepsize=0.5;
00016     stepnumber=8;
00017   }
00018 
00019   void likeprof_params::add_to_list(void)
00020   {
00021     likeprofptr[num_likeprof_params++]= this; // this is the list of
00022                                          // likelihood profile objects
00023   }
00024 
00025   param_likeprof_number::param_likeprof_number() : param_stddev_number() ,
00026     likeprof_params()
00027   {
00028     sigma=0.0;
00029     likeprof_params::add_to_list();
00030     // stddev_params::add_to_list(); // don't think we need this here
00031   }
00032 
00033   int param_likeprof_number::size_count(void)
00034   {
00035     return 1;
00036   }
00037 
00038 /*
00039         void param_likeprof_number::set_dependent_variables(void)
00040         {
00041                 #ifndef __ZTC__
00042                 dvariable(*this) << dvariable(*this);
00043                 #else
00044                 *this << *this;
00045                 #endif
00046         }
00047 */
00048 
00049   void param_likeprof_number::allocate(const char * _s)
00050   {
00051     named_dvariable::allocate(_s);
00052     likeprof_params::allocate();
00053   }
00054 
00055   const char * param_likeprof_number::label(void)
00056   {
00057     return model_name_tag::label().mychar();
00058   }
00059 
00060 param_likeprof_number& param_likeprof_number::operator=(const prevariable& v)
00061         {
00062                 this->param_stddev_number::operator = (v);
00063                 return *this;
00064         }
00065 
00066 param_likeprof_number& param_likeprof_number::operator=(const double v)
00067         {
00068                 this->param_stddev_number::operator = (v);
00069                 return *this;
00070         }
00071 
00072         // for now only do likelihood profiles for numbers
00073   /*
00074   int likeprof_params::num_likeprof_calc(void)
00075   {
00076     int nvar=0;
00077     for (int i=0;i<num_likeprof_params;i++)
00078     {
00079       nvar+= (likeprofptr[i])->size_count();
00080     }
00081     return nvar;
00082   }
00083 
00084   int param_likeprof_vector::size_count(void)
00085   {
00086     return ::size_count(*this);
00087   }
00088 
00089   param_likeprof_vector::param_likeprof_vector(void) : named_dvar_vector() ,
00090     likeprof_params()
00091   {
00092     add_to_list();
00093   }
00094 
00095   void param_likeprof_vector::allocate(int imin,int imax,const char * s)
00096   {
00097     named_dvar_vector::allocate(imin,imax,s);
00098     likeprof_params::allocate();
00099   }
00100 
00101   void param_likeprof_vector::set_dependent_variables(void)
00102   {
00103     dvar_vector(*this) << dvar_vector(*this);
00104   }
00105 
00106   param_likeprof_matrix::param_likeprof_matrix() : named_dvar_matrix() ,
00107     likeprof_params()
00108   {
00109     add_to_list();
00110   }
00111 
00112   int param_likeprof_matrix::size_count(void)
00113   {
00114     return ::size_count(*this);
00115   }
00116 
00117   void param_likeprof_matrix::allocate(int rmin,int rmax,int cmin,int cmax,
00118     const char * s)
00119   {
00120     named_dvar_matrix::allocate(rmin,rmax,cmin,cmax,s);
00121     likeprof_params::allocate();
00122   }
00123 
00124   void param_likeprof_matrix::set_dependent_variables(void)
00125   {
00126     dvar_matrix(*this) << dvar_matrix(*this);
00127   }
00128 
00129   const char * param_likeprof_vector::label(void)
00130   {
00131     return model_name_tag::label();
00132   }
00133 
00134   const char * param_likeprof_matrix::label(void)
00135   {
00136     return model_name_tag::label();
00137   }
00138 */