Borland 5.5 compiler problem!

This is a discussion on Borland 5.5 compiler problem! within the C++ Programming forums, part of the General Programming Boards category; Hello all, I am sure this error has come across the board before, but could not find it through searching. ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    2

    Borland 5.5 compiler problem!

    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:

    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);
    into a cpp and then trying to compile my file I get an error saying:

    "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:

    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;
    }
    
    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.

    Thanks for any help offered.

    Mako
    Last edited by Mako11; 03-14-2005 at 02:35 PM.

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Lightbulb Overload the '/' operator.

    Are a & b objects?

    These lines indicate that a & b are objects:
    a.allocate("a");
    b.allocate("b");

    C++ does not know how to divide one object by another, so you have to overload the operator.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    2
    How would I overload the / operator? I know there are may tutorials online but I can't figure out where or what I would insert into my cpp file. Can someone help me? Thanks,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dev-C++ compiler problem
    By GrasshopperEsq in forum C++ Programming
    Replies: 19
    Last Post: 05-08-2008, 03:35 AM
  2. Compiler Problem
    By sitestem in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2004, 04:48 PM
  3. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  4. Problem with compiler
    By knight543 in forum C++ Programming
    Replies: 4
    Last Post: 02-09-2002, 09:16 PM
  5. Please help me with this compiler problem
    By incognito in forum C++ Programming
    Replies: 1
    Last Post: 01-05-2002, 05:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21