Changeset f9326d2 in git


Ignore:
Timestamp:
Sep 4, 1997, 9:31:57 AM (27 years ago)
Author:
Wilfred Pohl <pohl@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
72dd6eeaebf0db2fe0f6bd43bfe99cedfbcf38e3
Parents:
9a7a66619e0df89480e6c5daec5c873e32ef749d
Message:
new order for variables: hOrdSupp


git-svn-id: file:///usr/local/Singular/svn/trunk@654 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/hutil.cc

    r9a7a66 rf9326d2  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: hutil.cc,v 1.3 1997-04-02 15:07:03 Singular Exp $ */
     4/* $Id: hutil.cc,v 1.4 1997-09-04 07:31:57 pohl Exp $ */
    55/*
    66* ABSTRACT: Utilities for staircase operations
     
    143143}
    144144
    145 
    146145void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
    147146{
    148147  int  i, i1, j, jj, k, l;
    149148  short  x;
    150   scmon temp;
    151   varset v1;
    152   v1 = (int *)Alloc(Nvar * sizeof(int));
     149  scmon temp, count;
     150  float o, h, g, *v1;
     151
     152  v1 = (float *)Alloc(Nvar * sizeof(float));
    153153  temp = (short *)Alloc(Nstc * sizeof(short));
     154  count = (short *)Alloc(Nstc * sizeof(short));
    154155  for (i = 1; i <= Nvar; i++)
    155156  {
    156157    i1 = var[i];
    157158    *temp = stc[0][i1];
     159    *count = 1;
    158160    jj = 1;
    159161    for (j = 1; j < Nstc; j++)
     
    169171          {
    170172            temp[k] = x;
     173            count[k] = 1;
    171174            jj++;
    172175            break;
     
    175178        else if (x < temp[k])
    176179        {
    177           for (l = jj; l < k; l--)
     180          for (l = jj; l > k; l--)
     181          {
    178182            temp[l] = temp[l-1];
     183            count[l] = count[l-1];
     184          }
    179185          temp[k] = x;
     186          count[k] = 1;
    180187          jj++;
    181188          break;
    182189        }
    183190        else
    184           break;
    185       }
    186     }
    187     jj *= 2;
    188     if (!(*temp))
    189       jj--;
    190     v1[i-1] = jj;
    191   }
     191        {
     192          count[k]++;
     193          break;
     194        }
     195      }
     196    }
     197    h = 0.0;
     198    o = (float)Nstc/(float)jj;
     199    for(j = 0; j < jj; j++)
     200    {
     201       g = (float)count[j];
     202       if (g > o)
     203         g -= o;
     204       else
     205         g = o - g;
     206       if (g > h)
     207         h = g;
     208    }
     209    v1[i-1] = h * (float)jj;
     210  }
     211  Free((ADDRESS)count, Nstc * sizeof(short));
     212  Free((ADDRESS)temp, Nstc * sizeof(short));
    192213  for (i = 1; i < Nvar; i++)
    193214  {
    194215    i1 = var[i+1];
    195     jj = v1[i];
     216    h = v1[i];
    196217    j = 0;
    197218    loop
    198219    {
    199       if (jj > v1[j])
     220      if (h > v1[j])
    200221      {
    201222        for (l = i; l > j; l--)
     
    204225          var[l+1] = var[l];
    205226        }
    206         v1[j] = jj;
     227        v1[j] = h;
    207228        var[j+1] = i1;
    208229        break;
     
    213234    }
    214235  }
    215   Free((ADDRESS)temp, Nstc * sizeof(short));
    216   Free((ADDRESS)v1, Nvar * sizeof(int));
     236  Free((ADDRESS)v1, Nvar * sizeof(float));
    217237}
    218238
Note: See TracChangeset for help on using the changeset viewer.