about summary refs log tree commit diff
path: root/editor/specialty/pgmabel.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-03-27 03:11:13 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-03-27 03:11:13 +0000
commit6f9d75acb45235a93b1520beec7f96a98bde0412 (patch)
tree903719a5984cd8008cdd079af7a445de271c23e4 /editor/specialty/pgmabel.c
parente15e137ba527ba97c82149ad8c6bed59088d8616 (diff)
downloadnetpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.gz
netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.xz
netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.zip
Release 10.73.39
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4314 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/specialty/pgmabel.c')
-rw-r--r--editor/specialty/pgmabel.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/editor/specialty/pgmabel.c b/editor/specialty/pgmabel.c
index 1764c5d7..386f0535 100644
--- a/editor/specialty/pgmabel.c
+++ b/editor/specialty/pgmabel.c
@@ -100,20 +100,19 @@ abel ( float *y, int N, double *adl)
 {
     register int n;
     double *rho, *rhop;       /* results and new index                       */
-    float  *yp;               /* new indizes for the y-array                 */
 
     MALLOCARRAY(rho, N);
     if( !rho )
         pm_error( "out of memory" );
+    for (n=0 ; n<N ; n++)
+        rho[n] = 0;
+
     rhop = rho;
-    yp  = y;
 
     for (n=0 ; n<N ; n++)
     {
-        *(rhop++) = ((*yp++) - Sum(n,rho,N,adl))/(adl[n*N+n]);
-/*    *(rhop++) = ((*yp++) - Sum(n,rho,N))/(dr(n,n+0.5,N));  old version */
-        if ( *rhop < 0.0 ) *rhop = 0.0;         /*  error correction !       */
-/*   if (n > 2) rhop[n-1] = (rho[n-2]+rho[n-1]+rho[n])/3.0;  stabilization*/
+        rhop[n] = MAX(0, (y[n] - Sum(n,rho,N,adl))/(adl[n*N+n]));
+            /* Clip to 0 for error correction !  */
     }
     for (n=0 ; n<N ; n++)
         {