welcome to nls2C Site Plan

The main programme for nls2C

 

You can use a provided main programme,-- which process the estimation, print some of the results, and, optionnally, write the results and data into a file (see the functions of the standard executable-command) -- or write the calling programme yourself.

Your own main programme

At the head of your calling program, insert:
#include "nls2C.h"
This insertion makes all the subroutines declarations for you.

Then, call the subroutines of the package.

As guide, see the source of the standard main programme or one of the examples.

A frequent use: access data in the model-evaluation programmes

When, to calculate the model, you need variables not in the argument-list of the programmes which evaluate the model, i.e calcf_, calcv_ or calcodes_, process as in this example:

  1. Declare the variables in the head of the main calling programme:
    double unevariable=0 ;
    
    unevariable is a then a global variable.

  2. In the calcf_ programme, declare and use them, as here:
    extern double unevariable ;
    
    short int calcf_(nbt, nbg, nbl, nbc, t, g, x, f, df, le, ie)
          short int nbt, nbg, nbl, nbc;
          double *t, *g, **x, *f, **df;
          short int *le, *ie;
    {
    short int i;
    double res;
    double a[2], da[2][3];
    ECRTRACE("calcf");
    
     printf("\n In calcf_ unevariable= %g\n", unevariable);
     unevariable++;
    ...
    
    In this example, the value of unevariable is incremented at each iteration.

Retour au début

 


© INRA, 2001-