L'étude de cas ir5_iascl

 Code
 int ir5_ia(){
   scltracefa(__FILE__, __FUNCTION__, NULL);
   scltracefc("scl-%s (%s) : %s\n", sclver(), sclsec(), temps_char(0));

   // http://recherche.telecom-bretagne.eu/iono/ir5_publication.php
   std::string datname="ir5.dat", datpath="./don/sul/"+datname;

   int ir5an, ir5mois;
   double cir5, cjj;
   char ir5op; // statut observation/prevision

   std::vector<double> ir5a, ir5o, ir5p, jja, jjo, jjp;

   // Jour Julien CNES 1er jan 1950 0h
   double jj_dis = date_jj(1950, 1, 1, 0, 0, 0.0, 1);

   FILE *fid = fopen(datpath.c_str(), "rt");
   while(!feof(fid)){
     fscanf(fid, "%d %d %lf %c", &ir5an, &ir5mois, &cir5, &ir5op);
     fgetc(fid); // on passe la fin de ligne
     //scltracefc("%d;%d;%lf;'%c'\n", ir5an, ir5mois, ir5val, ir5op);
     cjj = date_jj(ir5an, ir5mois, 1, 0, 0, 0.0, 1) - jj_dis;

     if(ir5op=='O'){      ir5o.push_back(cir5); jjo.push_back(cjj); }
     else if(ir5op=='P'){ ir5p.push_back(cir5); jjp.push_back(cjj); }
   }
   fclose(fid); fid=NULL;
   //---------------------------------------------------------------------
   datname.clear(); datname="ir5_archive.dat";
   datpath.clear(); datpath="./don/sul/"+datname;

   fid = fopen(datpath.c_str(), "rt");
   while(!feof(fid)){
     fscanf(fid, "%d %d %lf %c", &ir5an, &ir5mois, &cir5, &ir5op);
     fgetc(fid); // on passe la fin de ligne
     //scltracefc("%d;%d;%lf;'%c'\n", ir5an, ir5mois, ir5val, ir5op);
     cjj = date_jj(ir5an, ir5mois, 1, 0, 0, 0.0, 1) - jj_dis;

     ir5a.push_back(cir5); jja.push_back(cjj);
   }
   fclose(fid); fid=NULL;

   int o5n=(int)ir5o.size(), o5i, p5n=(int)ir5p.size(),
       a5n=(int)ir5a.size(), a5i;

   double ir5e=-DBL_MAX;
   cir5=max<double>(o5n, &ir5o[0]); if(ir5e<cir5){ ir5e = cir5; }
   cir5=max<double>(p5n, &ir5p[0]); if(ir5e<cir5){ ir5e = cir5; }
   cir5=max<double>(a5n, &ir5a[0]); if(ir5e<cir5){ ir5e = cir5; }
   double ir5r = (ir5e-0.0)*10.0/100.0/2.0;

   int xn=o5n+a5n, xi;
   double *x=new double[xn], *t=new double[xn];
   for(a5i=0,xi=a5n-1;a5i<a5n;a5i++,xi--){
     x[xi]=ir5a[a5i]/ir5e;  t[xi]=jja[a5i];
   }
   for(o5i=0,xi=a5n  ;o5i<o5n;o5i++,xi++){
     x[xi]=ir5o[o5i]/ir5e; t[xi]=jjo[o5i];
   }

   int an=40, cn=23, en=6;
   int chn=3;
   int nrn[3]; nrn[0]=an; nrn[1]=cn; nrn[2]=en;
   int nlt[3]; nlt[0]=0;  nlt[1]=1;  nlt[2]=1;
   double eta = 0.015;

   int sbln=(xn-an)/en, sbli;
   double **xr=new double*[sbln], *cx;
   double **zr=new double*[sbln], *cz;
   double **yr_0=new double*[sbln], **yr_1=new double*[sbln],
       **yr_4=new double*[sbln], *cy;
   double *y_0=new double[xn], *y_1=new double[xn], *y_4=new double[xn];
   for(sbli=0;sbli<sbln;sbli++){
     cx=&x[sbli*en];      xr[sbli]  =cx;
     cz=&x[an+sbli*en];   zr[sbli]  =cz;
     cy=&y_0[an+sbli*en]; yr_0[sbli]=cy;
     cy=&y_1[an+sbli*en]; yr_1[sbli]=cy;
     cy=&y_4[an+sbli*en]; yr_4[sbli]=cy;
   }
   double **xj=newmat<double>(sbln, an, 0.0);
   double **zj=newmat<double>(sbln, en, 0.0);
   double **yj=newmat<double>(sbln, en, 0.0);

   int itrn=1;
   nevronx(chn, &nrn[0], &nlt[0], sbln, xr, xj, zr, zj,
       itrn, DBL_EPSILON, eta, 0.0, yr_0, yj);
   std::string legend = "Itération x"+num_str<int>(itrn);

   itrn=10;
   nevronx(chn, &nrn[0], &nlt[0], sbln, xr, xj, zr, zj,
       itrn, DBL_EPSILON, eta, 0.0, yr_1, yj);
   legend += ";Itération x"+num_str<int>(itrn);

   itrn=10000;
   nevronx(chn, &nrn[0], &nlt[0], sbln, xr, xj, zr, zj,
       itrn, DBL_EPSILON, eta, 0.0, yr_4, yj);
   legend += ";Itération x"+num_str<int>(itrn);

   for(xi=0;xi<xn;xi++){
     y_0[xi]*=ir5e; y_1[xi]*=ir5e; y_4[xi]*=ir5e;
   }

   //---------------------------------------------------------------------
   std::string imgname=std::string(__FUNCTION__)+".svg",
       imgpath="./srt/"+imgname;

   graf_dis(imgpath.c_str(), o5n, &jjo[0], &ir5o[0],
       "curve", p5n, &jjp[0], &ir5p[0],
       "curve", a5n, &jja[0], &ir5a[0],
       "curve", 1, &jjo[o5n-1], &ir5o[o5n-1],
       "curve", 1, &jjp[p5n-1], &ir5p[p5n-1],
       "grid", "on",
       "subtitlex",
       "http://recherche.telecom-bretagne.eu/iono/ir5_publication.php",
       "linespec", "-l;-r;-l;h+;h+", "dataxis", "x",
       "legend", "Observation;Prédiction",
       "legcorn", "ula", "title", "Évolution de l'indice IR5",
       "axmax", (jjp[p5n-1]+11*12*30.5),
       "aymin", 0.0-ir5r, "aymax", ir5e+ir5r,
       "markersize", 20, "linespeca", "-a", NULL);

   //---------------------------------------------------------------------
   imgname.clear(); imgname=std::string(__FUNCTION__)+"-drnr-y.svg";
   imgpath.clear(); imgpath="./srt/"+imgname;

   graf_dis(imgpath.c_str(), xn, t, y_0,
       "curve", xn, t, y_1, "curve", xn, t, y_4,
       "grid", "on", "linespec", "-c;-m;-u", "dataxis", "x",
       "legend", legend.c_str(), "legcorn", "ula",
       "title", "Dernières sorties d'apprentissage Sigmoïde",
       "axmax", (jjp[p5n-1]+11*12*30.5),
       "aymin", 0.0-ir5r, "aymax", ir5e+ir5r,
       "linespeca", "-a", NULL);

   //---------------------------------------------------------------------
   //[>LIBR. MEMOIRE]
   //---------------------------------------------------------------------
   imgpath.clear(); imgname.clear(); legend.clear();
   deletemat<double>(sbln, &yj);
   deletemat<double>(sbln, &zj);
   deletemat<double>(sbln, &xj);
   delete[] y_4; y_4=NULL;   delete[] y_1; y_1=NULL;
   delete[] y_0; y_0=NULL;
   delete[] yr_4; yr_4=NULL; delete[] yr_1; yr_1=NULL;
   delete[] yr_0; yr_0=NULL;
   delete[] zr; zr=NULL;     delete[] xr; xr=NULL;
   delete[] t; t=NULL;       delete[] x; x=NULL;
   jjp.clear();  jjo.clear();  jja.clear();
   ir5p.clear(); ir5o.clear(); ir5a.clear();
   datpath.clear(); datname.clear();
   //---------------------------------------------------------------------
   //[<LIBR. MEMOIRE]
   //---------------------------------------------------------------------

   scltracefe(__FILE__, __FUNCTION__, NULL);
   return 0;
 }
 Sortie
      [>..\xpl\src\scl.ia.cpp.ir5_ia]
        scl-21.03 (gwin64) : 2021-03-28 00:25:02

         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         <<                END OF DISLIN / VERSION 11.2.1                <<
         <<  Date    : 28.03.2021  Time    : 00:25:48  Pageformat: DA4L  <<
         <<  Vectors : 4174        Warnings: 1         Fileformat:  SVG  <<
         <<  Metafile: ./srt/ir5_ia.svg                                  <<
         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         <<                END OF DISLIN / VERSION 11.2.1                <<
         <<  Date    : 28.03.2021  Time    : 00:25:48  Pageformat: DA4L  <<
         <<  Vectors : 10647       Warnings: 1         Fileformat:  SVG  <<
         <<  Metafile: ./srt/ir5_ia-drnr-y.svg                           <<
         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

      [<..\xpl\src\scl.ia.cpp.ir5_ia]