Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include <admodel.h>
00008
00009 int stddev_params::num_stddev_params=0;
00010 int stddev_params::num_stddev_number_params=0;
00011
00012
00013 stddev_params* stddev_params::stddev_number_ptr[150];
00014
00015 stddev_params* stddev_params::stddevptr[150];
00016
00017 void stddev_params::add_to_list(void)
00018 {
00019 if (num_stddev_params>=150)
00020 {
00021 cerr << "This version of ADMB only supports " << num_stddev_params
00022 << " stddev_params." << endl;
00023 exit(1);
00024 }
00025 stddevptr[num_stddev_params++]= this;
00026 }
00027
00028 void stddev_params::add_to_gui_list(void)
00029 {
00030 if (num_stddev_number_params>=150)
00031 {
00032 cerr << "This version of ADMB only supports " << num_stddev_params
00033 << " stddev_params." << endl;
00034 exit(1);
00035 }
00036 stddev_number_ptr[num_stddev_number_params++]= this;
00037 }
00038
00039 ivector stddev_params::copy_all_number_offsets(void)
00040 {
00041 int ndv=stddev_params::num_stddev_number_calc();
00042 ivector no(1,ndv);
00043 for (int i=0;i<ndv;i++)
00044 {
00045 no(i+1)=stddev_number_ptr[i]->getindex();
00046 }
00047 return no;
00048 }
00049
00050
00051 int stddev_params::num_stddev_calc(void)
00052 {
00053 int nvar=0;
00054 for (int i=0;i<num_stddev_params;i++)
00055 {
00056 nvar+= (stddevptr[i])->size_count();
00057 }
00058 return nvar;
00059 }
00060
00061 void stddev_params::setindex(int _index){;}
00062 int stddev_params::getindex(void){return 0;}
00063
00064 int param_stddev_number::getindex(void)
00065 {
00066 return index;
00067 }
00068 void param_stddev_number::setindex(int _index)
00069 {
00070 index=_index;
00071 }
00072
00073 void stddev_params::get_stddev_number_offset(void)
00074 {
00075 int offset=1;
00076 int ii=0;
00077 for (int i=0;i<num_stddev_params;i++)
00078 {
00079 if (stddevptr[i]==stddev_number_ptr[ii])
00080 {
00081 stddev_number_ptr[ii]->setindex(offset);
00082 if (++ii>=num_stddev_number_params) break;
00083 }
00084 offset+= (stddevptr[i])->size_count();
00085 }
00086 }
00087
00088 int stddev_params::num_stddev_number_calc(void)
00089 {
00090 return stddev_params::num_stddev_number_params;
00091 }
00092
00096 param_stddev_number::param_stddev_number():
00097 named_dvariable(),
00098 stddev_params(),
00099 sd(0)
00100 {
00101 add_to_list();
00102 add_to_gui_list();
00103 setindex(0);
00104 }
00105
00106 int param_stddev_number::size_count(void)
00107 {
00108 return 1;
00109 }
00110
00111 void param_stddev_number::set_dependent_variables(void)
00112 {
00113 #ifndef __ZTC__
00114 dvariable(*this) << dvariable(*this);
00115 #else
00116 *this << *this;
00117 #endif
00118 }
00119
00120
00121 void param_stddev_number::allocate(const char * _s)
00122 {
00123 named_dvariable::allocate(_s);
00124 stddev_params::allocate();
00125 }
00126
00127 int param_stddev_vector::size_count(void)
00128 {
00129 return ::size_count(*this);
00130 }
00131
00132 param_stddev_vector::param_stddev_vector(void) : named_dvar_vector() ,
00133 stddev_params()
00134 {
00135 add_to_list();
00136 }
00137
00138 void param_stddev_vector::allocate(int imin,int imax,const char * s)
00139 {
00140 sd.allocate(imin,imax);
00141 named_dvar_vector::allocate(imin,imax,s);
00142 stddev_params::allocate();
00143 }
00144
00145 void param_stddev_vector::set_dependent_variables(void)
00146 {
00147 dvar_vector(*this) << dvar_vector(*this);
00148 }
00149
00150 param_stddev_matrix::param_stddev_matrix() : named_dvar_matrix() ,
00151 stddev_params()
00152 {
00153 add_to_list();
00154 }
00155
00156 int param_stddev_matrix::size_count(void)
00157 {
00158 return ::size_count(*this);
00159 }
00160
00161 void param_stddev_matrix::allocate(int rmin,int rmax,int cmin,int cmax,
00162 const char * s)
00163 {
00164 sd.allocate(rmin,rmax,cmin,cmax);
00165 named_dvar_matrix::allocate(rmin,rmax,cmin,cmax,s);
00166 stddev_params::allocate();
00167 }
00168
00169 void param_stddev_matrix::set_dependent_variables(void)
00170 {
00171 dvar_matrix(*this) << dvar_matrix(*this);
00172 }
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 const char * param_stddev_vector::label(void)
00200 {
00201 return model_name_tag::label().mychar();
00202 }
00203
00204 const char * param_stddev_number::label(void)
00205 {
00206 return model_name_tag::label().mychar();
00207 }
00208
00209 const char * param_stddev_matrix::label(void)
00210 {
00211 return model_name_tag::label().mychar();
00212 }
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238