Index: Singular/LIB/presolve.lib
===================================================================
--- Singular/LIB/presolve.lib	(revision 224d153b4a430841dbc33e16788c163dbc00c5ca)
+++ Singular/LIB/presolve.lib	(revision 3ea5cee1504eb5dced1aa095461b2eafa2c20a37)
@@ -1,6 +1,4 @@
 ///////////////////////////////////////////////////////////////////////////////
-//changed GMG 20.5.09: degreepart, linearpart, elimpart
-///////////////////////////////////////////////////////////////////////////////
-version="$Id: presolve.lib,v 1.33 2009-05-25 09:47:39 Singular Exp $";
+version="$Id: presolve.lib,v 1.34 2009-05-29 09:26:48 Singular Exp $";
 category="Symbolic-numerical solving";
 info="
@@ -94,7 +92,4 @@
           (default: v = 1,...,1)
          _[2]: remaining generators of id
-NOTE:    if id is of type int/number/poly it is converted to ideal, if id is
-         of type intmat/matrix/vector to module and then the corresponding
-         generators are computed
 EXAMPLE: example degreepart; shows an example
 "
@@ -149,5 +144,4 @@
          _[1]: generators of id of total degree <= 1
          _[2]: remaining generators of id
-NOTE:    all variables have degree 1 (independent of ordering of basering)
 EXAMPLE: example linearpart; shows an example
 "
@@ -185,6 +179,6 @@
 "
 {
-   int ii,n,k,ringchange;
-   string o;
+   int ii,n,k;
+   string o, newo;
    intvec getoption = option(get);
    option(redSB);
@@ -200,5 +194,5 @@
    if ( n < nvars(BAS) )
    {
-      rest = maxi[n+1..nvars(BAS)];     //variables which are not substituted
+      rest = maxi[n+1..nvars(BAS)];
    }
    attrib(rest,"isSB",1);
@@ -211,11 +205,9 @@
    //## gmg, gendert 9/2008: interred sehr lange z.B. bei Leonard1 in normal,
    //daher interred ersetzt durch: std nur auf linearpart angewendet
-   //Wechsel zu dp Ordnung (da Lin affin linear)
-
-//--------------- replace ordering different from dp by dp -------------------
-   o = "dp("+string(n)+")";
-   if( ! find(ordstr(BAS),o) or find(ordstr(BAS),"a") )
-   {
-      ringchange = 1;                         //remember change of ring
+   //Ordnung muss global sein, sonst egal (da Lin affin linear)
+
+//--------------- replace ordering by dp if it is not global -----------------
+   if ( ord_test(BAS) <= 0 )
+   {
       intvec V;
       V[n]=0; V=V+1;                          //weights for dp ordering
@@ -238,5 +230,5 @@
       lin = lin,id1;
       lin = std(lin);
-      id = simplify(NF(id,lin),2);   //instead of subst, (### is faster)
+      id = simplify(NF(id,lin),2);   //instead of subst
       id1 = linearpart(id)[1];
    }
@@ -283,5 +275,5 @@
 //------------------ go back to original ring end return  ---------------------
 
-   if ( ringchange  )                   //i.e there was a ring change
+   if ( ord_test(BAS) <= 0  )           //i.e there was a ring change
    {
       setring BAS;
@@ -355,10 +347,9 @@
 
    list L = elimlinearpart(i,n);
+   if ( e == 0 )
+   {
+       return(L);
+   }
    ideal lin, eva, sub, neva, phi = L[1], L[2], L[3], L[4], L[5];
-   if ( e == 0 )
-   {
-       return(L);
-   }
-
 //-------- direct substitution of variables if possible and if e!=0 -----------
 // first find terms lin1 in lin of pure degree 1 in each polynomial of lin
@@ -391,5 +382,5 @@
 -z ergibt ich auch i[2]-z*i[3] mit option(redThrough)
 statt interred kann man hier auch NF(i,i[3])+i[3] verwenden
-hier lifert elimpart(i) 2 Substitutionen (x,y) elimpart(interred(i))
+hier liefert elimpart(i) 2 Substitutionen (x,y) elimpart(interred(i))
 aber 3 (x,y,z)
 Da interred oder NF aber die Laenge der polys vergroessern kann, nicht gemacht
@@ -430,5 +421,5 @@
    //kin = polys of lin which contained a pure degree 1 part.
    kin = simplify(kin,2);
-   l = size(kin);                      //l != 0 since lin1 != 0
+   l = ncols(kin);                    //l != 0 since lin1 != 0
    poly p,kip,vip, cand;
    int count=1;
@@ -441,11 +432,6 @@
             {
                p = kin[kk]/var(ii);
-               //if ( deg(p) == 0 )
-               //old test, does not work if some var has deg 0
-               //geaendert Mai 09 gmg
-
-               if( p!=0 & p == jet(p,0) )
-                   //this means that kin[kk]= p*var(ii) + h,
-                   //with p=const !=0 and h not depending on var(ii)
+               if ( deg(p) == 0 )  //this means that kin[kk]= p*var(ii) + h,
+                                   //with p=const and h not depending on var(ii)
                {
                   //we look for the shortest candidate to substitute var(ii)
@@ -462,9 +448,9 @@
                   }
                 }
-            }
+            }     
             if ( cand != 0 )
             {
                   p = cand/var(ii);
-                  kip = cand/p;     //normalized polynomial of kin w.r.t var(ii)
+                  kip = cand/p;      //normalized polynomial of kin w.r.t var(ii)
                   eva = eva+var(ii); //var(ii) added to list of elimin. vars
                   neva[ii] = 0;
