[..] La fonction [scl] nevronxscl

Code
 int nevronx_xpl(){
   scltracefa(§, ƒ, );
   scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), temps_char(0));

   int ichk, ierr=-1;
   int vn = (int)107, vi;
   double dvn = (double)vn;
   // Dyadic correction
   vn=(int)pow(2, round(ln(dvn)/ln(2))); dvn=(double)vn;
   double dtechn=round(pow(2, 10));
   int techn=(int)dtechn, techi;
   double fe = 1;

   //---------------------------------------------------------------------
   //[>RANDN]
   //---------------------------------------------------------------------
   int seed=0; double sigma=1;
   double *sr=new double[vn], *sj=new double[vn];
   randn(vn, seed, sigma, sr, sj); //🎲
   double csr, srmoy=0, srvar=0;
   for (vi=0;vi<vn;vi++){
     csr=sr[vi]; srmoy+=csr;
     sj[vi] = 0; // real signal ⚠️
   }
   // Noise mean
   srmoy/=dvn;
   // Noise variance estimation
   for (vi=0;vi<vn;vi++){ csr=sr[vi]-srmoy; srvar+=csr*csr; } srvar/=dvn;
   scltracefc("srvar: %lf\n", srvar);

   double *freq=new double[techn], *spsd=new double[techn];
   ichk = periodogramme(vn, sr, sj, techn, fe, freq, spsd);
   double spsdmean = 0;
   for(techi=0;techi<techn;techi++){
     spsdmean += pow(10, spsd[techi]/10);
   } spsdmean /= dtechn;
   scltracefc("spsdmean: %lf [dB(W/Hz)]\n", 10*log10(spsdmean));
   scltracefc("srvar   : %lf [dB]\n", 10*log10(srvar));
   //---------------------------------------------------------------------
   //[<RANDN]
   //---------------------------------------------------------------------

   // Cut-off frequencies
   int ten=3;
   double dten=(double)ten, tc=dten/fe, stc=(tc);
   double fchz=1/(2*tc), freqc=fchz/fe;
   // Excess bandwidth
   double α = 0.2;

   double *b=new double[2401];
   double *fsr=new double[vn], *fsj=new double[vn],
       *z=newtab<double>(vn, 0);

   // Theoretical frequency response (-40 [dB] threshold)
   double ff = (1-α)/(2*tc) +
       α/(π*tc)*cos-1(2*pow(10,-40/10)-1);
   double fd=-ff;
   int fn=1001, fi; double *f = newtablin(fn, fd, ff);
   double *H=new double[fn], cH;
   racosinrusf(f, fn, tc, α, H);
   for(fi=0;fi<fn;fi++){
     cH = H[fi]; f[fi]=f[fi]/fe;
     // Correction de la variance du bruit
     H[fi] = 10*log10(srvar*cH*cH);
   }

   double spsdc = 10*log10(srvar*stc*stc/2);

   double a0 = 1;
   //---------------------------------------------------------------------
   //[>FILTER & SPECTRUM]
   //---------------------------------------------------------------------
   int tsn=10, bn=2*ten*tsn+1;
   racosinrusz(ten, tsn, α, bn, b);
   scltracefc("Square root raised cosine filter (tap %d)\n", bn);
   scltracefc("  b: ");
   tracetab<double>(std::cout, bn, b);
   /*std::cout<<std::endl;*/ scltracef("\n");
   /* Initialisation du registre : */ inittab(vn, 0, z);
   filtrz(vn, sr, 1, &a0, bn, b, fsr, z);
   double *f10spsd=newtab<double>(techn, 0);
   ichk = periodogramme(vn, fsr, sj, techn, fe, freq, f10spsd);
   //---------------------------------------------------------------------
   //[<FILTER & SPECTRUM]
   //---------------------------------------------------------------------


   int an=bn, en=1;
   int chn=2;
   int nrn[2]; nrn[0]=an;               nrn[1]=en;
   int nlt[2]; nlt[0]=SCL_NLTYPE_LINR;  nlt[1]=SCL_NLTYPE_LINR;
   double η = 0.15E-6;

   int sbln=(vn-an)/en, sbli;
   double **xr=new double*[sbln], **xj=new double*[sbln], *cx;
   double **zr=new double*[sbln], **zj=new double*[sbln], *cz;
   double **yr=new double*[sbln], **yj=new double*[sbln], *cy;
   double *fxr=new double[vn],    *fxj=new double[vn]; // signal sortie réseau
   for(sbli=0;sbli<sbln;sbli++){
     cx=&sr[sbli*en];       xr[sbli]  =cx;
     cx=&sj[sbli*en];       xj[sbli]  =cx;
     cz=&fsr[an-1+sbli*en]; zr[sbli]  =cz;
     cz=&fsj[an-1+sbli*en]; zj[sbli]  =cz;
     cy=&fxr[an-1+sbli*en]; yr[sbli]=cy;
     cy=&fxj[an-1+sbli*en]; yj[sbli]=cy;
   }

   // Poids synaptiques
   double ***wr = new double**[chn];
   wr[0] = newmat<double>(an, 1);
   wr[1] = newmat<double>(en, an);
   double ***wj = new double**[chn];
   wj[0] = newmat<double>(an, 1);
   wj[1] = newmat<double>(en, an);

   int itrn=10;
   nevronx(chn, &nrn[0], &nlt[0], sbln, xr, xj, zr, zj,
       itrn, εrd, η, 0, yr, yj, wr, wj);
   scltracefc("  wr[1][1]: ");
   tracetab<double>(std::cout, an, wr[1][0]);
   scltracef("\n");

   // Spectre du signal de sortie du réseau
   double *fxpsd=newtab<double>(techn, 0);
   ichk = periodogramme(vn, fxr, fxj, techn, fe, freq, fxpsd);
   //legend += ";Ron " + num_str<double>(bn);


   scl::string_c imgname=scl::string_c(ƒ)+"-filtr.svg",
       imgpath="./srt/"+imgname;
   scl::string_c legend = "No filt.;Tap " + num_str<double>(bn) +
       ";Cut-off 3;Theory";

   ichk = graf_dis(imgpath.c_str(), techn, freq, spsd,
       "curve", techn, freq, f10spsd,
       "curve", 1, &freqc, &spsdc,
       "curve", fn, f, H,
       "linespec", "-p;-r;ad;-a",
       "legend", legend.c_str(),
       "grid", "on", "legcorn", "urp",
       "title", "Square root raised cosine filtering",
       "subtitlex", imgname.c_str(), "linespeca", "-a",
       "xlabel", "$f/f_e$", "ylabel", "$[dB_{W/Hz}]$",
       /*"aymin", (spsdmean-40.0), */);
   if (ichk<0){
     std::cerr << "[<" << § << "." << ƒ << ">] "
         "graf_dis() error!" << std::endl;
     scltracefe(§, ƒ, );
     return ierr;
   } ierr--;

   imgname.clear(); imgname=scl::string_c(ƒ)+"-ronx.svg",
   imgpath.clear(); imgpath="./srt/"+imgname;
   legend.clear();
   legend = "No filt.;Ron " + num_str<double>(bn) +
       ";Cut-off 3;Theory";

   ichk = graf_dis(imgpath.c_str(), techn, freq, spsd,
       "curve", techn, freq, fxpsd,
       "curve", 1, &freqc, &spsdc,
       "curve", fn, f, H,
       "linespec", "-c;-m;ad;-a",
       "legend", legend.c_str(),
       "grid", "on", "legcorn", "urp",
       "title", "Square root raised cosine filtering",
       "subtitlex", imgname.c_str(), "linespeca", "-a",
       "xlabel", "$f/f_e$", "ylabel", "$[dB_{W/Hz}]$",
       /*"aymin", (spsdmean-40.0), */);
   if (ichk<0){
     std::cerr << "[<" << § << "." << ƒ << ">] "
         "graf_dis() error!" << std::endl;
     scltracefe(§, ƒ, );
     return ierr;
   } ierr--;

   //---------------------------------------------------------------------
   //[>LIBÈRE MÉMOIRE]
   //---------------------------------------------------------------------
   delete[] sr;      sr=;      delete[] sj;     sj=;
   delete[] freq;    freq=;    delete[] spsd;   spsd=;
   delete[] b;       b=;       delete[] fsr;     fsr=;
   delete[] z;       z=;       delete[] f10spsd; f10spsd=;
   imgname.clear(); imgpath.clear(); legend.clear();
   //---------------------------------------------------------------------
   //[<LIBÈRE MÉMOIRE]
   //---------------------------------------------------------------------

   scltracefe(§, ƒ, );
   return 0;
 }
 /* ƒ décorée par 🔬 le 01-04-2024 16:34:38 */
Sortie
        [>..\xpl\src\sclronx.xpl.cpp.nevronx_xpl]
          scl-24.04 (gwin64) : 01-04-2024 16:34:38

          srvar: 0.999451
          spsdmean: -0.002383 [dB(W/Hz)]
          srvar   : -0.002383 [dB]
          Square root raised cosine filter (tap 61)
            b: { -0.00233367, -0.000532338, 0.00253009, 0.00257563, -0.00105884, -0.00382373, -0.00168368, 0.00298196, 0.00386428, -0.000674018, -0.00448717, -0.00159697, 0.00457981, 0.00443397, -0.00412913, -0.0098014, -0.00124956, 0.0146236, 0.0157952, -0.00734474, -0.031871, -0.0217841, 0.0256009, 0.0607692, 0.0268967, -0.0662504, -0.121755, -0.0303376, 0.216911, 0.489993, 0.608901, 0.489993, 0.216911, -0.0303376, -0.121755, -0.0662504, 0.0268967, 0.0607692, 0.0256009, -0.0217841, -0.031871, -0.00734474, 0.0157952, 0.0146236, -0.00124956, -0.0098014, -0.00412913, 0.00443397, 0.00457981, -0.00159697, -0.00448717, -0.000674018, 0.00386428, 0.00298196, -0.00168368, -0.00382373, -0.00105884, 0.00257563, 0.00253009, -0.000532338, -0.00233367 }
          [<..\src\sclronx.c.nevronx>] Iteration 0/10 Error 0.992799
          [<..\src\sclronx.c.nevronx>] Iteration 1/10 Error 0.255218
          [<..\src\sclronx.c.nevronx>] Iteration 2/10 Error 0.065630
          [<..\src\sclronx.c.nevronx>] Iteration 3/10 Error 0.016883
          [<..\src\sclronx.c.nevronx>] Iteration 4/10 Error 0.004344
          [<..\src\sclronx.c.nevronx>] Iteration 5/10 Error 0.001118
          [<..\src\sclronx.c.nevronx>] Iteration 6/10 Error 0.000288
          [<..\src\sclronx.c.nevronx>] Iteration 7/10 Error 0.000074
          [<..\src\sclronx.c.nevronx>] Iteration 8/10 Error 0.000019
          [<..\src\sclronx.c.nevronx>] Iteration 9/10 Error 0.000005
            wr[1][1]: { -0.00233366, -0.000532363, 0.00253008, 0.00257559, -0.00105885, -0.00382372, -0.00168369, 0.00298197, 0.00386423, -0.00067403, -0.00448723, -0.00159699, 0.00457978, 0.00443396, -0.00412915, -0.00980144, -0.00124952, 0.0146237, 0.0157952, -0.00734472, -0.031871, -0.0217841, 0.0256009, 0.0607691, 0.0268967, -0.0662503, -0.121754, -0.0303375, 0.216911, 0.489993, 0.6089, 0.489993, 0.216911, -0.0303375, -0.121754, -0.0662503, 0.0268967, 0.0607691, 0.0256009, -0.0217841, -0.031871, -0.0073447, 0.0157952, 0.0146236, -0.00124954, -0.00980139, -0.00412912, 0.00443398, 0.00457979, -0.00159699, -0.0044872, -0.000674076, 0.00386423, 0.00298195, -0.00168364, -0.00382368, -0.00105883, 0.00257566, 0.00253007, -0.00053236, -0.00233368 }

           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
           <<                END OF DISLIN / VERSION 11.3.2                <<
           <<  Date    : 01.04.2024  Time    : 16:35:40  Pageformat: DA4L  <<
           <<  Vectors : 4192        Warnings: 0         Fileformat:  SVG  <<
           <<  Metafile: ./srt/nevronx_xpl-filtr.svg                       <<
           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
           <<                END OF DISLIN / VERSION 11.3.2                <<
           <<  Date    : 01.04.2024  Time    : 16:35:40  Pageformat: DA4L  <<
           <<  Vectors : 4192        Warnings: 0         Fileformat:  SVG  <<
           <<  Metafile: ./srt/nevronx_xpl-ronx.svg                        <<
           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        [<..\xpl\src\sclronx.xpl.cpp.nevronx_xpl]