Hello all,
I am sure this error has come across the board before, but could not find it through searching. I am using the borland 5.5 compiler along with a program called admodel builder to run non-linear regression models. When converting my base template file which looks like this:
into a cpp and then trying to compile my file I get an error saying:Code:DATA_SECTION init_int nobs; init_matrix data(1,nobs,1,2) vector SSB(1,nobs); vector R(1,nobs); PARAMETER_SECTION init_number a; init_number b; vector pred_R(1,nobs) objective_function_value f; PRELIMINARY_CALCS_SECTION // get the data out of the columns of the data matrix SSB=column(data,1); R=column(data,2); PROCEDURE_SECTION pred_R=((a*S)/(1+b*S)); f=regression(R,pred_R);
"operator/ not implemented in type dvar_vector for arguments of the same type in function model_parameters::user function()"
it is referring to a problem with my division (/) operator in my function? The resulting cpp file looks like this:
Does anyone know how to fix this error. I've read that I can define my operator as friendly somehow and that may work but I don't know where to insert that into the cpp file.Code:#include <admodel.h> #include <bh.htp> model_data::model_data(void) { nobs.allocate("nobs"); data.allocate(1,nobs,1,2,"data"); SSB.allocate(1,nobs); R.allocate(1,nobs); } model_parameters::model_parameters(int sz,int argc,char * argv[]) : ad_comm(argc,argv), model_data() , function_minimizer(sz) { initializationfunction(); a.allocate("a"); b.allocate("b"); pred_R.allocate(1,nobs,"pred_R"); #ifndef NO_AD_INITIALIZE pred_R.initialize(); #endif f.allocate("f"); } void model_parameters::preliminary_calculations(void) { // get the data out of the columns of the data matrix SSB=column(data,1); R=column(data,2); } void model_parameters::userfunction(void) { pred_R=((a*S)/(1+b*S)); f=regression(R,pred_R); } model_data::~model_data() {} model_parameters::~model_parameters() {} void model_parameters::report(void){} void model_parameters::final_calcs(void){} void model_parameters::set_runtime(void){} #ifdef _BORLANDC_ extern unsigned _stklen=10000U; #endif #ifdef __ZTC__ extern unsigned int _stack=10000U; #endif long int arrmblsize=0; int main(int argc,char * argv[]) { gradient_structure::set_NO_DERIVATIVES(); gradient_structure::set_YES_SAVE_VARIABLES_VALUES(); #if defined(__GNUDOS__) || defined(DOS386) || defined(__DPMI32__) || \ defined(__MSVC32__) if (!arrmblsize) arrmblsize=150000; #else if (!arrmblsize) arrmblsize=25000; #endif model_parameters mp(arrmblsize,argc,argv); mp.iprint=10; mp.preliminary_calculations(); mp.computations(argc,argv); return 0; }
Thanks for any help offered.
Mako



LinkBack URL
About LinkBacks


