Changeset 18dd47 in git


Ignore:
Timestamp:
Aug 12, 1997, 4:01:11 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
573ae7acc2dadf68863ca5ee07211c1e9a07b3fb
Parents:
9e76269b6654f6e38d3546d04b318c6693f2f4d9
Message:
* hannes: changed int / into div in
          HNPuiseux.lib finvar.lib general.lib homolog.lib matrix.lib
          poly.lib prim_dec.lib primdec.lib random.lib


git-svn-id: file:///usr/local/Singular/svn/trunk@612 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/finvar.lib

    r9e7626 r18dd47  
    1 // $Header: /exports/cvsroot-2/cvsroot/Singular/LIB/finvar.lib,v 1.3 1997-08-04 14:46:49 Singular Exp $
     1// $Header: /exports/cvsroot-2/cvsroot/Singular/LIB/finvar.lib,v 1.4 1997-08-12 14:01:05 Singular Exp $
    22////////////////////////////////////////////////////////////////////////////////
    33// send bugs and comments to agnes@math.uni-sb.de
     
    958958  { if (i<p^j)                         // finding an upper bound on i
    959959    { for (k=0;k<j-1;k=k+1)
    960       { out=out+((i/p^k)%p)*a^k;       // finding how often p^k is contained in
     960      { out=out+((i div p^k)%p)*a^k;   // finding how often p^k is contained in
    961961      }                                // i
    962       out=out+(i/p^(j-1))*a^(j-1);
     962      out=out+(i div p^(j-1))*a^(j-1);
    963963      if (defined(bool)=voice)
    964964      { return((-1)*out);
     
    988988  for (i=2;i<=m;i=i+1)
    989989  { degvec[i]=deg(Q[i]);
    990     lcm=lcm*degvec[i]/gcd(lcm,degvec[i]); // lcm is now the least common
     990    lcm=lcm*degvec[i] div gcd(lcm,degvec[i]); // lcm is now the least common
    991991  }                                    // multiple of the first i elements of Q
    992992  ideal A(1)=Q;
    993993  for (i=1;i<=m;i=i+1)
    994   { A(1)[i]=(A(1)[i])^(lcm/degvec[i]); // now all elements in A(1) are of the
     994  { A(1)[i]=(A(1)[i])^(lcm div degvec[i]); // now all elements in A(1) are of the
    995995  }                                    // same degree, they are the elements of
    996996                                       // Q raised to a power -
     
    10011001  kill I;
    10021002  if ((n%2)==0)                        // H(1) ought to be of the form:
    1003   { j=int(n)/int(2);                   // 1,0,...,0,0,1,0,...,0
     1003  { j=n div 2;                         // 1,0,...,0,0,1,0,...,0
    10041004  }                                    // 0,0,...,0,1,0,0,...,0
    10051005  else                                 //      .           .
    1006   { j=int(n-1)/int(2);                 //      .           .
     1006  { j=(n-1) div 2;                     //      .           .
    10071007  }                                    //      .           .
    10081008  for (i=1;i<=j;i=i+1)                 // 1,0,...,0,0,0,0,...,0
     
    11431143  { d=d*deg(P[i]);                     // building the product of the degrees of
    11441144  }                                    // primary invariants -
    1145   int bound=d/g;                       // number of secondary invariants
     1145  int bound=d div g;                   // number of secondary invariants
    11461146  if (v)
    11471147  { "  The invariant ring is Cohen-Macaulay.";
    1148     "  We need to find "+string(d)+"/"+string(g)+"="+string(bound)+" secondary invariants.";
     1148    "  We need to find "+string(d)+" div "+string(g)+"="+string(bound)+" secondary invariants.";
    11491149    "";
    11501150  }
  • Singular/LIB/general.lib

    r9e7626 r18dd47  
    1 // $Id: general.lib,v 1.3 1997-07-10 14:02:30 Singular Exp $
     1// $Id: general.lib,v 1.4 1997-08-12 14:01:07 Singular Exp $
    22//system("random",787422842);
    33//(GMG, last modified 22.06.96)
     
    273273      {
    274274         s    = e[m]+u[m+1];
    275          u[m] = s/(m+1);
     275         u[m] = s div (m+1);
    276276         e[m] = s%(m+1);
    277277      }
     
    303303   intvec r,p,B,Prelim;
    304304   string result,prelim;
    305    N = (10*n)/3 + 2;
     305   N = (10*n) div 3 + 2;
    306306   p[N+1]=0; p=p+2; r=p;
    307307   for( i=1; i<=N+1; i=i+1 ) { B[i]=2*i-1; }
     
    317317      {
    318318         r[m] = e%B[m];
    319          q    = e/B[m];
     319         q    = e div B[m];
    320320         e    = q*(m-1)+p[m-1];
    321321      }
    322322      r[1] = e%10;
    323       q    = e/10;
     323      q    = e div 10;
    324324      if( q!=10 and q!=9 )
    325325      {
     
    335335      if( q==10 )
    336336      {
    337          Prelim = (Prelim+1)-((Prelim+1)/10)*10;
     337         Prelim = (Prelim+1)-((Prelim+1) div 10)*10;
    338338         for( m=size(Prelim); m>0; m=m-1)
    339339         {
  • Singular/LIB/matrix.lib

    r9e7626 r18dd47  
    1 // $Id: matrix.lib,v 1.2 1997-04-28 19:27:22 obachman Exp $
     1// $Id: matrix.lib,v 1.3 1997-08-12 14:01:08 Singular Exp $
    22// (GMG/BM, last modified 22.06.96)
    33///////////////////////////////////////////////////////////////////////////////
     
    295295   print(A);
    296296   int n=4;
    297    ideal i = ideal(randommat(1,n*(n-1)/2,maxideal(1),9));
     297   ideal i = ideal(randommat(1,n*(n-1) div 2,maxideal(1),9));
    298298   print(skewmat(n,i));  // skew matrix of generic linear forms
    299299   kill R1;
     
    351351   print(A);
    352352   int n=3;
    353    ideal i = ideal(randommat(1,n*(n+1)/2,maxideal(1),9));
     353   ideal i = ideal(randommat(1,n*(n+1) div 2,maxideal(1),9));
    354354   print(symmat(n,i));  // symmetric matrix of generic linear forms
    355355   kill R1;
  • Singular/LIB/poly.lib

    r9e7626 r18dd47  
    1 // $Id: poly.lib,v 1.6 1997-08-04 15:14:19 Singular Exp $
     1// $Id: poly.lib,v 1.7 1997-08-12 14:01:08 Singular Exp $
    22//system("random",787422842);
    33//(GMG, last modified 22.06.96)
     
    208208      while ( c-jet(c,i) != 0 ) { i = 2*(i+1); }
    209209      int o = i-1;
    210       int u = (d != i)*((i/ 2)-1);
     210      int u = (d != i)*((i div 2)-1);
    211211   //----------------------- "quick search" for maxdeg ------------------------
    212212      while ( (c-jet(c,i)==0)*(c-jet(c,i-1)!=0) == 0)
    213213      {
    214          i = (o+1+u)/ 2;
     214         i = (o+1+u) div 2;
    215215         if (c-jet(c,i)!=0) { u = i+1; }
    216216         else { o = i-1; }
     
    263263         i = -d;
    264264         while ( c == jet(c,i,v) ) { i = 2*(i-1); }
    265          int o = (d != -i)*((i/ 2)+2) - 1;
     265         int o = (d != -i)*((i div 2)+2) - 1;
    266266         int u = i+1;
    267267         int e = -1;
     
    271271         while ( c != jet(c,i,v) ) { i = 2*(i+1); }
    272272         int o = i-1;
    273          int u = (d != i)*((i/ 2)-1);
     273         int u = (d != i)*((i div 2)-1);
    274274         int e = 1;
    275275      }
     
    277277      while ( ( c==jet(c,i,v) )*( c!=jet(c,i-1,v) ) == 0 )
    278278      {
    279          i = (o+e+u)/ 2;
     279         i = (o+e+u) div 2;
    280280         if ( c!=jet(c,i,v) ) { u = i+1; }
    281281         else { o = i-1; }
     
    341341      while ( jet(c,i) == 0 ) { i = 2*(i+1); }
    342342      int o = i-1;
    343       int u = (d != i)*((i/ 2)-1);
     343      int u = (d != i)*((i div 2)-1);
    344344   //----------------------- "quick search" for mindeg ------------------------
    345345      while ( (jet(c,u)==0)*(jet(c,o)!=0) )
    346346      {
    347          i = (o+u)/ 2;
     347         i = (o+u) div 2;
    348348         if (jet(c,i)==0) { u = i+1; }
    349349         else { o = i-1; }
     
    397397         i = -d;
    398398         while ( jet(c,i,v) != 0 ) { i = 2*(i-1); }
    399          int o = (d != -i)*((i/ 2)+2) - 1;
     399         int o = (d != -i)*((i div 2)+2) - 1;
    400400         int u = i+1;
    401401         int e = -1; i=u;
     
    405405         while ( jet(c,i,v) == 0 ) { i = 2*(i+1); }
    406406         int o = i-1;
    407          int u = (d != i)*((i/ 2)-1);
     407         int u = (d != i)*((i div 2)-1);
    408408         int e = 1; i=u;
    409409      }
     
    411411      while ( (jet(c,i-1,v)==0)*(jet(c,i,v)!=0) == 0 )
    412412      {
    413          i = (o+e+u)/ 2;
     413         i = (o+e+u) div 2;
    414414         if (jet(c,i,v)==0) { u = i+1; }
    415415         else { o = i-1; }
  • Singular/LIB/prim_dec.lib

    r9e7626 r18dd47  
    1 // $Id: prim_dec.lib,v 1.3 1997-08-04 15:14:20 Singular Exp $
     1// $Id: prim_dec.lib,v 1.4 1997-08-12 14:01:09 Singular Exp $
    22///////////////////////////////////////////////////////
    33// pseudoprimdec.lib
     
    1616  // If choose=1, the system tries to find an "optimal ordering",
    1717  // which in some cases may considerably speed up the algorithm
    18  
     18
    1919  // You may also may want to try one of the algorithms for
    2020  // minimal associated primes in the the library
     
    2222  // These algorithms are variants of the algorithm
    2323  // of Gianni-Trager-Zacharias
    24  
     24
    2525  prim_dec (ideal I, int choose)
    26  
     26
    2727  // Computes a complete primary decomposition via
    2828  // a variant of the pseudoprimary approach of
    2929  // Shimoyama-Yokoyama.
    3030  // The integer choose must be either 0, 1, 2 or 3.
    31   // If choose=0, min_ass_prim_charsets with the given 
     31  // If choose=0, min_ass_prim_charsets with the given
    3232  // ordering of the variables is used.
    3333  // If choose=1, min_ass_prim_charsets with the "optimized"
     
    4949proc ini_mod(poly p)
    5050{
    51   if (p==0) 
     51  if (p==0)
    5252  {
    5353    return(0);
     
    9090  {
    9191    verbose(notWarnSB);
    92   } 
     92  }
    9393  if(cho==0)
    9494  {
     
    102102///////////////////////////////////////////////////////
    103103// min_ass_prim_charsets0
    104 // input: generators of an ideal PS 
     104// input: generators of an ideal PS
    105105// output: the minimal associated primes of PS
    106106// algorithm: via characteristic sets
     
    111111proc min_ass_prim_charsets0 (ideal PS)
    112112{
    113  
    114   matrix m=char_series(PS);  // We compute an irreducible 
    115                              // characteristic series 
     113
     114  matrix m=char_series(PS);  // We compute an irreducible
     115                             // characteristic series
    116116  int i,j,k;
    117117  list PSI;
     
    123123  // We compute the radical of each ideal in PHI
    124124  ideal I,JS,II;
    125   int sizeJS, sizeII; 
     125  int sizeJS, sizeII;
    126126  for(i=size(PHI);i>=1; i--)
    127127  {
     
    138138       sizeII=0;
    139139       k=0;
    140        while(k<=sizeII)                  // successive saturation 
     140       while(k<=sizeII)                  // successive saturation
    141141       {
    142142         option(returnSB);
     
    156156         sizeJS=sizeII;
    157157       }
    158     }                             
     158    }
    159159    PSI=insert(PSI,JS);
    160160  }
     
    196196///////////////////////////////////////////////////////
    197197// min_ass_prim_charsets1
    198 // input: generators of an ideal PS 
     198// input: generators of an ideal PS
    199199// output: the minimal associated primes of PS
    200200// algorithm: via characteristic sets
     
    211211  execute "ring r="+charstr(oldring)+",("+n+"),dp;";
    212212  ideal PS=imap(oldring,PS);
    213   matrix m=char_series(PS);  // We compute an irreducible 
    214                              // characteristic series 
     213  matrix m=char_series(PS);  // We compute an irreducible
     214                             // characteristic series
    215215  int i,j,k;
    216216  ideal I;
     
    225225     {
    226226       I=I,ini_mod(PHI[i][j]);
    227      } 
     227     }
    228228      I=I[2..ncols(I)];
    229229      ITPHI[i]=I;
     
    235235  // We compute the radical of each ideal in PHI
    236236  ideal I,JS,II;
    237   int sizeJS, sizeII; 
     237  int sizeJS, sizeII;
    238238  for(i=size(PHI);i>=1; i--)
    239239  {
     
    268268         sizeJS=sizeII;
    269269       }
    270     }                             
     270    }
    271271    PSI=insert(PSI,JS);
    272272  }
     
    310310// proc prim_dec
    311311// input:  generators of an ideal I and an integer choose
    312 // If choose=0, min_ass_prim_charsets with the given 
     312// If choose=0, min_ass_prim_charsets with the given
    313313// ordering of the variables is used.
    314314// If choose=1, min_ass_prim_charsets with the "optimized"
     
    317317// If choose=3, minAssPrimes+factorizing Buchberger from primdec.lib is used
    318318// output: a primary decomposition of I, i.e., a list
    319 // of pairs consisting of a standard basis of a primary component 
     319// of pairs consisting of a standard basis of a primary component
    320320// of I and a standard basis of the corresponding associated prime.
    321321// To compute the minimal associated primes of a given ideal
    322322// min_ass_prim_l is called, i.e., the minimal associated primes
    323323// are computed via characteristic sets.
    324 // In the homogeneous case, the performance of the procedure 
    325 // will be improved if I is already given by a minimal set of 
     324// In the homogeneous case, the performance of the procedure
     325// will be improved if I is already given by a minimal set of
    326326// generators. Apply minbase if necessary.
    327327//////////////////////////////////////////////////////////
    328328
    329  
     329
    330330proc prim_dec(ideal I, int choose)
    331331{
     
    338338   {
    339339      verbose(notWarnSB);
    340     } 
     340    }
    341341  ideal H=1; // The intersection of the primary components
    342   list U;    // the leaves of the decomposition tree, i.e., 
    343              // pairs consisting of a primary component of I 
     342  list U;    // the leaves of the decomposition tree, i.e.,
     343             // pairs consisting of a primary component of I
    344344             // and the corresponding associated prime
    345345  list W;    // the non-leaf vertices in the decomposition tree.
    346346             // every entry has 6 components:
    347                 // 1- the vertex itself , i.e., a standard bais of the   
    348                 //    given ideal I (type 1), or a standard basis of a 
    349                 //    pseudo-primary component arising from 
     347                // 1- the vertex itself , i.e., a standard bais of the
     348                //    given ideal I (type 1), or a standard basis of a
     349                //    pseudo-primary component arising from
    350350                //    pseudo-primary decomposition (type 2), or a
    351                 //    standard basis of a remaining component arising from 
     351                //    standard basis of a remaining component arising from
    352352                //    pseudo-primary decomposition or extraction (type 3)
    353353                // 2- the type of the vertex as indicated above
     
    359359                //    basis of a minimal associated prime ideal
    360360                //    of the father of the vertex and the
    361                 //    irreducible factors of the "minimal 
     361                //    irreducible factors of the "minimal
    362362                //    divisor" of the seperator or extractor
    363                 //    corresponding to the prime ideal 
     363                //    corresponding to the prime ideal
    364364                //    as computed by the procedure minsat,
    365                 //    if the vertex is of type 3, or 
     365                //    if the vertex is of type 3, or
    366366                //    the empty list otherwise
    367367  ideal SI=std(I);
    368368  int ncolsSI=ncols(SI);
    369   int ncolsH=1;         
     369  int ncolsH=1;
    370370  W[1]=list(I,1,0,poly(1),ideal(0),list()); // The root of the tree
    371371  int weighted_tree_depth;
     
    376376  list QQ;
    377377  list WI;
    378   ideal Qi,SQ,SRest,fac; 
    379   poly tester; 
    380  
     378  ideal Qi,SQ,SRest,fac;
     379  poly tester;
     380
    381381  while(1)
    382382  {
     
    401401    {
    402402      SQ,SRest,fac=extraction(V[1],V[5]);
    403                         // standard basis of primary component, 
     403                        // standard basis of primary component,
    404404                        // standard basis of remaining component,
    405                         // irreducible factors of 
    406                         // the "minimal divisor" of the extractor 
     405                        // irreducible factors of
     406                        // the "minimal divisor" of the extractor
    407407                        // as computed by the procedure minsat,
    408408      check=0;
     
    429429          for(j=1;j<=ncolsSI;j++)
    430430          {
    431             if(leadexp(H[j])!=leadexp(SI[j])) 
     431            if(leadexp(H[j])!=leadexp(SI[j]))
    432432            {
    433433              check=1;
     
    445445        }
    446446      }
    447       if (SRest[1]!=1)        // the remaining component is not 
     447      if (SRest[1]!=1)        // the remaining component is not
    448448                              // the whole ring
    449449      {
    450         if (rad_con(V[4],SRest)==0) // the new vertex is not the 
     450        if (rad_con(V[4],SRest)==0) // the new vertex is not the
    451451                                    // root of a redundant subtree
    452452        {
     
    457457          VV[5]=ideal(0);
    458458          VV[6]=list(list(V[5],fac));
    459           W=insert(W,VV,size(W)); 
     459          W=insert(W,VV,size(W));
    460460        }
    461461      }
     
    465465      if (V[2]==3) // pseudo_prim_dec_special is needed
    466466      {
    467         QQ,SRest=pseudo_prim_dec_special_charsets(V[1],V[6],choose);
    468                          // QQ = quadruples:
    469                          // standard basis of pseudo-primary component,
    470                          // standard basis of corresponding prime,
    471                          // seperator, irreducible factors of
    472                          // the "minimal divisor" of the seperator
    473                          // as computed by the procedure minsat,
    474                          // SRest=standard basis of remaining component 
    475       }
    476       else     // V is the root, pseudo_prim_dec is needed
    477       {
    478         QQ,SRest=pseudo_prim_dec_charsets(I,SI,choose);
     467        QQ,SRest=pseudo_prim_dec_special_charsets(V[1],V[6],choose);
    479468                         // QQ = quadruples:
    480469                         // standard basis of pseudo-primary component,
    481470                         // standard basis of corresponding prime,
    482471                         // seperator, irreducible factors of
    483                          // the "minimal divisor" of the seperator 
     472                         // the "minimal divisor" of the seperator
    484473                         // as computed by the procedure minsat,
    485                          // SRest=standard basis of remaining component   
    486          
    487       }
    488 //check
     474                         // SRest=standard basis of remaining component
     475      }
     476      else     // V is the root, pseudo_prim_dec is needed
     477      {
     478        QQ,SRest=pseudo_prim_dec_charsets(I,SI,choose);
     479                         // QQ = quadruples:
     480                         // standard basis of pseudo-primary component,
     481                         // standard basis of corresponding prime,
     482                         // seperator, irreducible factors of
     483                         // the "minimal divisor" of the seperator
     484                         // as computed by the procedure minsat,
     485                         // SRest=standard basis of remaining component
     486
     487      }
     488//check
    489489      for(i=size(QQ);i>=1;i--)
    490490      //for(i=1;i<=size(QQ);i++)
    491491      {
    492         tester=QQ[i][3]*V[4]; 
     492        tester=QQ[i][3]*V[4];
    493493        Qi=QQ[i][2];
    494         if(NF(tester,Qi,1)!=0)  // the new vertex is not the 
     494        if(NF(tester,Qi,1)!=0)  // the new vertex is not the
    495495                                // root of a redundant subtree
    496496        {
     
    499499          VV[3]=V[3]+1;
    500500          VV[4]=tester;      // the new tester as computed above
    501           VV[5]=Qi;          // QQ[i][2];           
     501          VV[5]=Qi;          // QQ[i][2];
    502502          VV[6]=list();
    503           W=insert(W,VV,size(W)); 
    504         }
    505       }
    506       if (SRest[1]!=1)        // the remaining component is not 
     503          W=insert(W,VV,size(W));
     504        }
     505      }
     506      if (SRest[1]!=1)        // the remaining component is not
    507507                              // the whole ring
    508508      {
     
    512512          VV[1]=SRest;
    513513          VV[2]=3;
    514           VV[3]=V[3]+2;   
     514          VV[3]=V[3]+2;
    515515          VV[4]=V[4];      // the tester did not change
    516           VV[5]=ideal(0);         
     516          VV[5]=ideal(0);
    517517          WI=list();
    518518          for(i=1;i<=size(QQ);i++)
     
    521521          }
    522522          VV[6]=WI;
    523           W=insert(W,VV,size(W)); 
     523          W=insert(W,VV,size(W));
    524524        }
    525525      }
     
    532532// input: Generators of an arbitrary ideal I, a standard basis SI of I,
    533533// and an integer choo
    534 // If choo=0, min_ass_prim_charsets with the given 
     534// If choo=0, min_ass_prim_charsets with the given
    535535// ordering of the variables is used.
    536536// If choo=1, min_ass_prim_charsets with the "optimized"
     
    539539// If choo=3, minAssPrimes+factorizing Buchberger from primdec.lib is used
    540540// output: a pseudo primary decomposition of I, i.e., a list
    541 // of pseudo primary components together with a standard basis of the 
     541// of pseudo primary components together with a standard basis of the
    542542// remaining component. Each pseudo primary component is
    543543// represented by a quadrupel: A standard basis of the component,
     
    550550
    551551proc pseudo_prim_dec_charsets (ideal I, ideal SI, int choo)
    552 { 
     552{
    553553  list L;          // The list of minimal associated primes,
    554554                   // each one given by a standard basis
     
    566566      {
    567567        L=minAssPrimes(I,1);
    568       } 
     568      }
    569569      for(int i=size(L);i>=1;i=i-1)
    570570        {
    571571          L[i]=std(L[i]);
    572         } 
     572        }
    573573    }
    574574  return (pseudo_prim_dec_i(SI,L));
     
    577577////////////////////////////////////////////////////////////////
    578578// proc pseudo_prim_dec_special_charsets
    579 // input: a standard basis of an ideal I whose radical is the 
    580 // intersection of the radicals of ideals generated by one prime ideal 
     579// input: a standard basis of an ideal I whose radical is the
     580// intersection of the radicals of ideals generated by one prime ideal
    581581// P_i together with one polynomial f_i, the list V6 must be the list of
    582582// pairs (standard basis of P_i, irreducible factors of f_i),
    583583// and an integer choo
    584 // If choo=0, min_ass_prim_charsets with the given 
     584// If choo=0, min_ass_prim_charsets with the given
    585585// ordering of the variables is used.
    586586// If choo=1, min_ass_prim_charsets with the "optimized"
    587587// ordering of the variables is used.
    588 // If choo=2, minAssPrimes from primdec.lib is used 
     588// If choo=2, minAssPrimes from primdec.lib is used
    589589// If choo=3, minAssPrimes+factorizing Buchberger from primdec.lib is used
    590590// output: a pseudo primary decomposition of I, i.e., a list
    591 // of pseudo primary components together with a standard basis of the 
     591// of pseudo primary components together with a standard basis of the
    592592// remaining component. Each pseudo primary component is
    593593// represented by a quadrupel: A standard basis of the component,
     
    631631          {
    632632            m=minAssPrimes(SP,1);
    633           } 
     633          }
    634634          for(j=size(m);j>=1;j=j-1)
    635635            {
    636636              m[j]=std(m[j]);
    637             } 
     637            }
    638638        }
    639639        dimSP=dim(SP);
     
    688688// of the minimal associated primes of I
    689689// output: a pseudo primary decomposition of I, i.e., a list
    690 // of pseudo primary components together with a standard basis of the 
     690// of pseudo primary components together with a standard basis of the
    691691// remaining component. Each pseudo primary component is
    692692// represented by a quadrupel: A standard basis of the component Q_i,
     
    703703                                // the ideal is already pseudo primary
    704704  {
    705     Q=SI,L[1],1;             
     705    Q=SI,L[1],1;
    706706    list QQ;
    707707    QQ[1]=Q;
     
    719719  {
    720720    fac=0;
    721     for(j=1;j<=sizeL;j++)           // compute the seperator sep_i   
     721    for(j=1;j<=sizeL;j++)           // compute the seperator sep_i
    722722                                    // of the i-th component
    723723    {
     
    739739    SQi,f0,f,fac=minsat_ppd(SI,fac);
    740740    I'=I',f;
    741     QP=SQi,L[i],f0,fac;           
     741    QP=SQi,L[i],f0,fac;
    742742             // the quadrupel:
    743743             // a standard basis of Q_i,
    744              // a standard basis of P_i, 
    745              // sep_i, 
     744             // a standard basis of P_i,
     745             // sep_i,
    746746             // irreducible factors of
    747              // the "minimal divisor" of the seperator 
     747             // the "minimal divisor" of the seperator
    748748             //  as computed by the procedure minsat,
    749749    Q[i]=QP;
    750750  }
    751   I'=std(I'); 
    752   return (Q, I'); 
     751  I'=std(I');
     752  return (Q, I');
    753753                   // I' = remaining component
    754754}
     
    757757////////////////////////////////////////////////////////////////
    758758// proc extraction
    759 // input: A standard basis of a pseudo primary ideal I, and a standard 
     759// input: A standard basis of a pseudo primary ideal I, and a standard
    760760// basis of the unique minimal associated prime P of I
    761 // output: an extraction of I, i.e., a standard basis of the primary 
     761// output: an extraction of I, i.e., a standard basis of the primary
    762762// component Q of I with associated prime P, a standard basis of the
    763 // remaining component, and the irreducible factors of the 
     763// remaining component, and the irreducible factors of the
    764764// "minimal divisor" of the extractor as computed by the procedure minsat
    765765////////////////////////////////////////////////////////////////
     
    823823      f=lcm(g);
    824824      newpoly[1]=f;
    825       polys=polys+newpoly; 
    826       newpoly=list(); 
     825      polys=polys+newpoly;
     826      newpoly=list();
    827827    }
    828828    f=polys[1];
     
    841841  {
    842842    f=1;
    843   } 
     843  }
    844844  poly f0,h0; ideal SQ; ideal fac;
    845845  if(f!=1)
    846846  {
    847     SQ,f0,h0,fac=minsat(SI,f);       
    848     return(SQ,std(SI+h0),fac);             
    849              // the tripel 
     847    SQ,f0,h0,fac=minsat(SI,f);
     848    return(SQ,std(SI+h0),fac);
     849             // the tripel
    850850             // a standard basis of Q,
    851              // a standard basis of remaining component, 
     851             // a standard basis of remaining component,
    852852             // irreducible factors of
    853              // the "minimal divisor" of the extractor 
     853             // the "minimal divisor" of the extractor
    854854             // as computed by the procedure minsat
    855855  }
     
    863863// proc minsat
    864864// input:  a standard basis of an ideal I and a polynomial p
    865 // output: a standard basis IS of the saturation of I w.r. to p, 
     865// output: a standard basis IS of the saturation of I w.r. to p,
    866866// the maximal squarefree factor f0 of p,
    867867// the "minimal divisor" f of f0 such that the saturation of
    868 // I w.r. to f equals the saturation of I w.r. to f0 (which is IS), 
     868// I w.r. to f equals the saturation of I w.r. to f0 (which is IS),
    869869// the irreducible factors of f
    870870//////////////////////////////////////////////////////////
     
    884884  ideal iold;
    885885  list quotM;
    886   quotM[1]=SI;   
     886  quotM[1]=SI;
    887887  quotM[2]=fac;
    888   quotM[3]=f0; 
    889   // we deal seperately with the first quotient; 
     888  quotM[3]=f0;
     889  // we deal seperately with the first quotient;
    890890  // factors, which do not contribute to this one,
    891891  // are omitted
     
    903903      quotM=minquot(quotM);
    904904    }
    905   return(quotM[1],f0,f,fac);           // the quadrupel ((I:p),f0,f,                                                    // irr. factors of f)
    906 } 
     905  return(quotM[1],f0,f,fac);           // the quadrupel ((I:p),f0,f, irr. factors of f)
     906}
    907907
    908908/////////////////////////////////////////////////////
    909909// proc minsat_ppd
    910910// input:  a standard basis of an ideal I and a polynomial p
    911 // output: a standard basis IS of the saturation of I w.r. to p, 
     911// output: a standard basis IS of the saturation of I w.r. to p,
    912912// the maximal squarefree factor f0 of p,
    913913// the "minimal divisor" f of f0 such that the saturation of
    914 // I w.r. to f equals the saturation of I w.r. to f0 (which is IS), 
     914// I w.r. to f equals the saturation of I w.r. to f0 (which is IS),
    915915// the irreducible factors of f
    916916//////////////////////////////////////////////////////////
     
    929929  ideal iold;
    930930  list quotM;
    931   quotM[1]=SI;   
     931  quotM[1]=SI;
    932932  quotM[2]=fac;
    933933  quotM[3]=f0;
    934   // we deal seperately with the first quotient; 
     934  // we deal seperately with the first quotient;
    935935  // factors, which do not contribute to this one,
    936936  // are omitted
     
    941941    {
    942942      return(quotM[1],f0,f,fac);
    943     } 
     943    }
    944944  while(special_ideals_equal(iold,quotM[1])==0)
    945945  {
     
    949949    k++;
    950950  }
    951   return(quotM[1],f0,f,fac);           // the quadrupel ((I:p),f0,f,                                                  // irr. factors of f) 
    952 } 
     951  return(quotM[1],f0,f,fac);           // the quadrupel ((I:p),f0,f, irr. factors of f)
     952}
    953953/////////////////////////////////////////////////////////////////
    954954// proc minquot
     
    958958// output: a standard basis of the ideal (I:f0), the irreducible
    959959// factors of the "minimal divisor" f of f0 with (I:f0) = (I:f),
    960 // the "minimal divisor" f 
     960// the "minimal divisor" f
    961961/////////////////////////////////////////////////////////////////
    962962
     
    981981       return(laedi,ideal(1),1);
    982982     }
    983    action=1; 
     983   action=1;
    984984   while(action==1)
    985985   {
     
    995995         {
    996996            if(i!=j)
    997             { 
     997            {
    998998               g=g*fac[j];
    999             }   
     999            }
    10001000         }
    10011001//std
     
    10071007         if(special_ideals_equal(verg,star)==1)
    10081008         {
    1009             f=g; 
     1009            f=g;
    10101010            fac[i]=0;
    10111011            fac=simplify(fac,2);
     
    10181018      }
    10191019   }
    1020    l=star,fac,f; 
    1021    return(l); 
     1020   l=star,fac,f;
     1021   return(l);
    10221022}
    10231023/////////////////////////////////////////////////
  • Singular/LIB/primdec.lib

    r9e7626 r18dd47  
    1 // $Id: primdec.lib,v 1.2 1997-08-04 15:14:21 Singular Exp $
     1// $Id: primdec.lib,v 1.3 1997-08-12 14:01:10 Singular Exp $
    22///////////////////////////////////////////////////////
    33// primdec.lib
     
    1010
    1111  minAssPrimes (ideal I, list choose)
    12   // minimal associated primes 
     12  // minimal associated primes
    1313  // The list choose must be either emty (minAssPrimes(I)) or 1
    1414  // (minAssPrimes(I,1))
    1515  // In the second case the factorizing Buchberger Algorithm is used
    1616  // which in most cases may considerably speed up the algorithm
    17    
     17
    1818  primdec (ideal I)
    19  
     19
    2020  // Computes a complete primary decomposition via
    2121
    2222  radical(ideal I)
    23   //computes the radical of the ideal I 
     23  //computes the radical of the ideal I
    2424
    2525LIB "random.lib";
     
    7676     if(deg(@h[@i])>0)
    7777     {
    78         fac=fac+factorize(@h[@i],1); 
     78        fac=fac+factorize(@h[@i],1);
    7979     }
    8080   }
     
    8383   if(deg(fac[1])>0)
    8484   {
    85       ideal iold;     
     85      ideal iold;
    8686
    8787      for(@i=1;@i<=size(fac);@i++)
     
    130130      if(deg(h[i])>0)
    131131      {
    132          fac=fac+factorize(h[i],1); 
     132         fac=fac+factorize(h[i],1);
    133133      }
    134134   }
     
    137137   {
    138138      l=inew,1;
    139       return(l); 
     139      return(l);
    140140   }
    141141   fac=sort(fac)[1];
     
    144144      f=f*fac[i];
    145145   }
    146    quotM[1]=inew;   
     146   quotM[1]=inew;
    147147   quotM[2]=fac;
    148148   quotM[3]=f;
    149149   f=1;
    150    option(returnSB);   
     150   option(returnSB);
    151151   while(specialIdealsEqual(iold,quotM[1])==0)
    152152   {
     
    162162   l=quotM[1],f;
    163163   return(l);
    164 } 
     164}
    165165
    166166proc quotMin(list tsil)
     
    178178
    179179   action=1;
    180  
     180
    181181   while(action==1)
    182182   {
     
    192192         {
    193193            if(i!=j)
    194             { 
     194            {
    195195               g=g*fac[j];
    196             }   
     196            }
    197197         }
    198198         verg=quotient(laedi,g);
    199199         if(specialIdealsEqual(verg,star)==1)
    200200         {
    201             f=g; 
     201            f=g;
    202202            fac[i]=0;
    203203            fac=simplify(fac,2);
     
    210210      }
    211211   }
    212    l=star,fac,f; 
    213    return(l); 
     212   l=star,fac,f;
     213   return(l);
    214214}
    215215
     
    240240USAGE:   factor(p) p poly
    241241RETURN:  list=;
    242 NOTE:   
     242NOTE:
    243243EXAMPLE: example factor; shows an example
    244244{
    245  
     245
    246246  ideal @i;
    247247  list @l;
     
    344344
    345345proc idealsEqual( ideal k, ideal j)
    346 { 
     346{
    347347   return(stdIdealsEqual(std(k),std(j)));
    348348}
     
    394394USAGE:   testPrimary(pr,k) pr list, k ideal;
    395395RETURN:  int = 1, if the intersection of the ideals in pr is k, 0 if not
    396 NOTE:     
     396NOTE:
    397397EEXAMPLE: example testPrimary ; shows an example
    398398{
    399399   int i;
    400400   ideal j=pr[1];
    401    for (i=2;i<=size(pr)/2;i++)
     401   for (i=2;i<=size(pr) div 2;i++)
    402402   {
    403403       j=intersect(j,pr[2*i-1]);
     
    425425USAGE:   printPrimary(l) l list;
    426426RETURN:  nothing
    427 NOTE:   
     427NOTE:
    428428EXAMPLE: example printPrimary; shows an example
    429429{
     
    438438   }
    439439   int k;
    440    for (k=1;k<=size(l)/2;k=k+1)
     440   for (k=1;k<=size(l) div 2;k=k+1)
    441441   {
    442442      "                                            ";
     
    461461         a sum of it with a linear random combination of the other
    462462         variables
    463 NOTE:   
     463NOTE:
    464464EXAMPLE: example randomLast; shows an example
    465465{
     
    502502
    503503   //the first generator of the prim ideal for the result
    504    ideal prm=p; 
     504   ideal prm=p;
    505505   attrib(prm,"isSB",1);
    506506
     
    523523         m=m-1;
    524524      }
    525       //check whether i[m] =(c*var(n)+h)^e modulo prm for some 
     525      //check whether i[m] =(c*var(n)+h)^e modulo prm for some
    526526      //h in K[var(n+1),...,var(nvars(basering))], c in K
    527527      //if not (0) is returned, else var(n)+h is added to prm
    528      
     528
    529529      e=deg(lead(i[m]));
    530530      t=leadcoef(i[m])*e*var(n)+(i[m]-lead(i[m]))/var(n)^(e-1);
     
    569569   int sl=size(l);
    570570
    571    for(i=1;i<=sl/2;i++)
     571   for(i=1;i<=sl div 2;i++)
    572572   {
    573573      if(sact[2][i]>1)
     
    581581   }
    582582   i=0;
    583    while(i<size(l)/2)
     583   while(i<size(l) div 2)
    584584   {
    585585      i++;
     
    600600         }
    601601         j=0;
    602          if(i<=sl/2)
     602         if(i<=sl div 2)
    603603         {
    604604            j=1;
     
    625625            }
    626626            if(gcdTest(act[1])==1)
    627             { 
     627            {
    628628               for(k=2;k<=r;k++)
    629629               {
    630                   keepprime[size(l)/2+k-1]=interred(keepprime[i]+ideal(act[1][k]));
     630                  keepprime[size(l) div 2+k-1]=interred(keepprime[i]+ideal(act[1][k]));
    631631               }
    632632               keepprime[i]=interred(keepprime[i]+ideal(act[1][1]));
     
    655655               {
    656656                  l[s+2*k-1]=keepresult[k];
    657                   keepprime[s/2+k]=interred(keepresult[k]+ideal(act[1][k]));
     657                  keepprime[s div 2+k]=interred(keepresult[k]+ideal(act[1][k]));
    658658                  if(vdim(keepresult[k])==deg(act[1][k]))
    659659                  {
     
    664664                     l[s+2*k]=ideal(0);
    665665                  }
    666                   if((homog(keepresult[k])==1)||(homog(keepprime[s/2+k])==1))
     666                  if((homog(keepresult[k])==1)||(homog(keepprime[s div 2+k])==1))
    667667                  {
    668668                    l[s+2*k]=maxideal(1);
     
    670670               }
    671671               i--;
    672                break;             
     672               break;
    673673            }
    674674            if(r>=2)
     
    686686                  else
    687687                  {
    688                      l[s+2]=ideal(0); 
     688                     l[s+2]=ideal(0);
    689689                  }
    690                   keepprime[s/2+1]=interred(keepprime[i]+ideal(@f));
    691                   if(homog(keepprime[s/2+1])==1)
     690                  keepprime[s div 2+1]=interred(keepprime[i]+ideal(@f));
     691                  if(homog(keepprime[s div 2+1])==1)
    692692                  {
    693693                     l[s+2]=maxideal(1);
    694694                  }
    695                   keepprime[i]=act[1];               
     695                  keepprime[i]=act[1];
    696696                  l[2*i-1]=act[1];
    697697                  attrib(l[2*i-1],"isSB",1);
     
    700700                     l[2*i]=maxideal(1);
    701701                  }
    702                  
     702
    703703                  i--;
    704704                  break;
     
    712712      return(l);
    713713   }
    714    for(i=1;i<=size(l)/2;i++)
     714   for(i=1;i<=size(l) div 2;i++)
    715715   {
    716716      if((size(l[2*i])==0)&&(specialIdealsEqual(keepprime[i],l[2*i-1])!=1))
    717717      {
    718          keepprime[i]=std(keepprime[i]); 
     718         keepprime[i]=std(keepprime[i]);
    719719         if(homog(keepprime[i])==1)
    720          {     
     720         {
    721721             l[2*i]=maxideal(1);
    722722         }
     
    767767  string @ri;
    768768  poly @f;
    769  
     769
    770770  if (dim(j)>0)
    771771  {
     
    794794       else
    795795       {
    796           @qh[1]=act[1][@k];   
     796          @qh[1]=act[1][@k];
    797797       }
    798798       primary[2*@k-1]=interred(@qh);
     
    814814     }
    815815     if(dim(j)==-1)
    816      { 
     816     {
    817817        primary[1]=ideal(1);
    818818        primary[2]=ideal(1);
     
    824824     return(primary);
    825825  }
    826  
     826
    827827//the first element in the standardbase is factorized
    828828  if(deg(j[1])>0)
     
    879879        primary[1]=std(primary[1],act[1][1]);
    880880     }
    881      
     881
    882882     if((act[2][1]==1)&&(vdim(primary[1])==deg(act[1][1])))
    883883     {
     
    900900
    901901  @k=0;
    902   while(@k<(size(primary)/2))
     902  while(@k<(size(primary) div 2))
    903903  {
    904904    @k++;
     
    915915       phi=@P,jmap;
    916916       jmap[nva]=-(jmap[nva]-2*var(nva));
    917        psi=@P,jmap;   
     917       psi=@P,jmap;
    918918       @qht=primary[2*@k-1];
    919919       @qh=phi(@qht);
     
    944944       kill @Phelp1;
    945945       @qh=clearSB(@qh);
    946        attrib(@qh,"isSB",1);     
     946       attrib(@qh,"isSB",1);
    947947
    948948       @lh=zero_decomp (@qh,psi(ser),@wr);
     
    993993       list @lr=imap(@P,lres);
    994994       ideal @lr1;
    995        
     995
    996996       if(size(@lr)==2)
    997997       {
    998998          @lr[2]=homog(@lr[2],@t);
    999999          @lr1=std(@lr[2]);
    1000           @lvec[2]=hilb(@lr1,1);     
     1000          @lvec[2]=hilb(@lr1,1);
    10011001       }
    10021002       else
    10031003       {
    1004           for(@n=1;@n<=size(@lr)/2;@n++)
     1004          for(@n=1;@n<=size(@lr) div 2;@n++)
    10051005          {
    10061006             if(specialIdealsEqual(@lr[2*@n-1],@lr[2*@n])==1)
     
    10081008                @lr[2*@n-1]=homog(@lr[2*@n-1],@t);
    10091009                @lr1=std(@lr[2*@n-1]);
    1010                 @lvec[2*@n-1]=hilb(@lr1,1); 
    1011                 @lvec[2*@n]=@lvec[2*@n-1]; 
     1010                @lvec[2*@n-1]=hilb(@lr1,1);
     1011                @lvec[2*@n]=@lvec[2*@n-1];
    10121012             }
    10131013             else
     
    10151015                @lr[2*@n-1]=homog(@lr[2*@n-1],@t);
    10161016                @lr1=std(@lr[2*@n-1]);
    1017                 @lvec[2*@n-1]=hilb(@lr1,1); 
     1017                @lvec[2*@n-1]=hilb(@lr1,1);
    10181018                @lr[2*@n]=homog(@lr[2*@n],@t);
    10191019                @lr1=std(@lr[2*@n]);
    1020                 @lvec[2*@n]=hilb(@lr1,1); 
     1020                @lvec[2*@n]=hilb(@lr1,1);
    10211021
    10221022             }
    1023          } 
     1023         }
    10241024       }
    10251025       @ri= "ring @Phelp1 ="
     
    10331033          @lr[2]=std(@lr[2],@lvec[2]);
    10341034          @lr[2]=subst(@lr[2],@t,1);
    1035      
     1035
    10361036       }
    10371037       else
    10381038       {
    1039           for(@n=1;@n<=size(@lr)/2;@n++)
     1039          for(@n=1;@n<=size(@lr) div 2;@n++)
    10401040          {
    10411041             if(specialIdealsEqual(@lr[2*@n-1],@lr[2*@n])==1)
     
    10641064          attrib(lres[@n],"isSB",1);
    10651065       }
    1066        
     1066
    10671067       primary[2*@k-1]=lres[1];
    10681068       primary[2*@k]=lres[2];
    1069        @s=size(primary)/2;
    1070        for(@n=1;@n<=size(lres)/2-1;@n++)
     1069       @s=size(primary) div 2;
     1070       for(@n=1;@n<=size(lres) div 2-1;@n++)
    10711071       {
    10721072         primary[2*@s+2*@n-1]=lres[2*@n+1];
     
    10941094USAGE:   ggt(i); i list of polynomials
    10951095RETURN:  poly = ggt(i[1],...,i[size(i)])
    1096 NOTE:   
     1096NOTE:
    10971097EXAMPLE: example ggt; shows an example
    10981098{
     
    11041104  }
    11051105
    1106  
     1106
    11071107  for (k=2;k<=size(i);k++)
    11081108  {
     
    11681168}
    11691169example
    1170 { 
     1170{
    11711171   "EXAMPLE:"; echo = 2;
    11721172   ring  r =( 0,a,b),(x,y,z),lp;
     
    11821182USAGE:   clearSB(i); i ideal which is SB ordered by monomial ordering
    11831183RETURN:  ideal = minimal SB
    1184 NOTE:   
     1184NOTE:
    11851185EXAMPLE: example clearSB; shows an example
    11861186{
     
    11881188  poly m;
    11891189  int c=size(i);
    1190  
     1190
    11911191  if(size(#)==0)
    11921192  {
     
    11971197        i=ideal(1);
    11981198        return(i);
    1199       }   
     1199      }
    12001200      if(deg(i[j])>0)
    12011201      {
     
    12211221        i=ideal(1);
    12221222        return(i);
    1223       }   
     1223      }
    12241224      if(deg(i[j])>0)
    12251225      {
     
    12361236             {
    12371237                i[j]=0;
    1238                 break; 
     1238                break;
    12391239             }
    12401240           }
     
    12621262                ordstring with the corresponding block ordering,
    12631263                the integer where the independent set starts in the varstring
    1264 NOTE:   
     1264NOTE:
    12651265EXAMPLE: example independentSet; shows an example
    12661266{
     
    12691269   string var1,var2;
    12701270   list v=system("indsetall",j,1);
    1271    
     1271
    12721272   for(n=1;n<=size(v);n++)
    12731273   {
     
    12771277      for(k=1;k<=size(v[n]);k++)
    12781278      {
    1279          if(v[n][k]!=0) 
     1279         if(v[n][k]!=0)
    12801280         {
    12811281            di++;
     
    13291329                ordstring with the corresponding block ordering,
    13301330                the integer where the independent set starts in the varstring
    1331 NOTE:   
     1331NOTE:
    13321332EXAMPLE: example maxIndependentSet; shows an example
    13331333{
     
    13361336   string var1,var2;
    13371337   list v=system("indsetall",j,0);
    1338    
     1338
    13391339   for(n=1;n<=size(v);n++)
    13401340   {
     
    13441344      for(k=1;k<=size(v[n]);k++)
    13451345      {
    1346          if(v[n][k]!=0) 
     1346         if(v[n][k]!=0)
    13471347         {
    13481348            di++;
     
    13941394USAGE:   prepareQuotientring(nnp); nnp int
    13951395RETURN:  string = to define Kvar(nnp+1),...,var(nvars)[..rest ]
    1396 NOTE:   
     1396NOTE:
    13971397EXAMPLE: example independentSet; shows an example
    1398 { 
     1398{
    13991399  ideal @ih,@jh;
    14001400  int npar=npars(basering);
    14011401  int @n;
    1402  
     1402
    14031403  string quotring= "ring quring = ("+charstr(basering);
    14041404  for(@n=nnp+1;@n<=nvars(basering);@n++)
     
    14071407     @ih=@ih+var(@n);
    14081408  }
    1409  
     1409
    14101410  quotring=quotring+"),(var(1)";
    14111411  @jh=@jh+var(1);
     
    14161416  }
    14171417  quotring=quotring+"),lp;";
    1418  
     1418
    14191419  return(quotring);
    14201420
     
    14311431   phi;
    14321432   setring @Q;
    1433    
     1433
    14341434}
    14351435
     
    14391439   int i,j;
    14401440   list lh;
    1441    for(i=1;i<=size(l)/2;i++)
     1441   for(i=1;i<=size(l) div 2;i++)
    14421442   {
    14431443      if(deg(l[2*i-1][1])>0)
     
    14571457         minAssPrimes(i,1); i ideal  (to use also the factorizing Groebner)
    14581458RETURN:  list = the minimal associated prime ideals of i
    1459 NOTE:   
     1459NOTE:
    14601460EXAMPLE: example minAssPrimes; shows an example
    14611461{
     
    14811481   list @pr=facstd(i);
    14821482   option(noredSB);
    1483    int j,k,odim,ndim,count; 
     1483   int j,k,odim,ndim,count;
    14841484   attrib(@pr[1],"isSB",1);
    14851485   if(#[1]==77)
     
    15021502           odim=ndim;
    15031503        }
    1504         if(ndim<odim)     
     1504        if(ndim<odim)
    15051505        {
    15061506           pos[j]=1;
    15071507        }
    1508      } 
     1508     }
    15091509     for(j=1;j<=size(@pr);j++)
    15101510     {
     
    15241524     {
    15251525       @res[j]=decomp(@pr[j],2);
    1526      }     
     1526     }
    15271527   }
    15281528
     
    15541554  for(k=1;k<=size(l);k++)
    15551555  {
    1556      for(j=1;j<=size(l[k])/2;j++)
     1556     for(j=1;j<=size(l[k]) div 2;j++)
    15571557     {
    15581558        if(deg(l[k][2*j][1])!=0)
     
    15901590           {
    15911591              @erg[k]=ideal(1);
    1592               i2=ideal(1); 
    1593            }         
     1592              i2=ideal(1);
     1593           }
    15941594        }
    15951595        if(size(reduce(i2,i1,1))==0)
     
    15981598           {
    15991599              break;
    1600            }         
     1600           }
    16011601        }
    16021602        k++;
     
    16281628proc decomp (ideal i,list #)
    16291629USAGE:   decomp(i); i ideal  (for primary decomposition)   (resp.
    1630          decomp(i,1);        (for the minimal associated primes) )         
     1630         decomp(i,1);        (for the minimal associated primes) )
    16311631RETURN:  list = list of primary ideals and their associated primes
    16321632         (at even positions in the list)
     
    16411641  ideal peek=i;
    16421642  ideal ser,tras;
    1643  
     1643
    16441644  int @aa=timer;
    1645  
     1645
    16461646  homo=homog(i);
    16471647  if(size(#)>0)
     
    16811681     intvec @hilb=hilb(tras,1);
    16821682  }
    1683  
     1683
    16841684  //----------------------------------------------------------------
    16851685  //i is the zero-ideal
    16861686  //----------------------------------------------------------------
    1687  
     1687
    16881688  if(size(i)==0)
    16891689  {
     
    16911691     return(primary);
    16921692  }
    1693  
     1693
    16941694  //----------------------------------------------------------------
    16951695  //pass to the lexicographical ordering and compute a standardbasis
     
    16971697
    16981698  execute "ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),lp;";
    1699  
     1699
    17001700  option(redSB);
    17011701  ideal ser=fetch(@P,ser);
    17021702  ideal peek=std(fetch(@P,peek));
    1703   homo=homog(peek); 
    1704    
     1703  homo=homog(peek);
     1704
    17051705  if(homo==1)
    17061706  {
     
    17301730     return(ideal(0));
    17311731  }
    1732  
     1732
    17331733  //----------------------------------------------------------------
    17341734  //  the case of one variable
     
    17811781  //search for a maximal independent set indep,i.e.
    17821782  //look for subring such that the intersection with the ideal is zero
    1783   //j intersected with K[var(indep[3]+1),...,var(nvar] is zero, 
     1783  //j intersected with K[var(indep[3]+1),...,var(nvar] is zero,
    17841784  //indep[1] is the new varstring and indep[2] the string for the block-ordering
    17851785  //------------------------------------------------------------------
     
    17911791  int jdim=dim(@j);
    17921792  list fett;
    1793   int lauf,di; 
     1793  int lauf,di;
    17941794
    17951795  if(@wr!=1)
     
    18141814      indep=maxIndependSet(@j);
    18151815   }
    1816  
     1816
    18171817  ideal jkeep=@j;
    18181818
     
    18571857          ideal @j=std(phi(@j));
    18581858        }
    1859       } 
     1859      }
    18601860     if((deg(@j[1])==0)||(dim(@j)<jdim))
    18611861     {
     
    18771877     //intersected with K[var(1),...,var(nva)] is (j:gh^n)
    18781878     //on the other hand j=(j,gh^n) intersected with (j:gh^n)
    1879  
     1879
    18801880     //------------------------------------------------------------------------------------
    18811881
     
    18841884     //-------------------------------------------------------------------------------------
    18851885
    1886      quotring=prepareQuotientring(nvars(basering)-indep[@m][3]); 
     1886     quotring=prepareQuotientring(nvars(basering)-indep[@m][3]);
    18871887
    18881888     //---------------------------------------------------------------------
     
    18971897
    18981898     kill gnir1;
    1899  
     1899
    19001900     //j is a standardbasis in the quotientring but usually not minimal
    19011901     //here it becomes minimal
     
    19131913        }
    19141914        //the primary decomposition of j*K(var(nnp+1),..,var(nva))[..the rest..]
    1915    
     1915
    19161916        list uprimary= zero_decomp(@j,ser,@wr);
    19171917
     
    19331933     list saturn;
    19341934     ideal hpl;
    1935  
     1935
    19361936     for(@n=1;@n<=size(uprimary);@n++)
    19371937     {
    19381938        hpl=0;
    19391939        for(@n1=1;@n1<=size(uprimary[@n]);@n1++)
    1940         { 
     1940        {
    19411941           hpl=hpl,leadcoef(uprimary[@n][@n1]);
    19421942        }
     
    19481948     //---------------------------------------------------------------------
    19491949     setring gnir;
    1950        
     1950
    19511951     collectprimary=imap(quring,uprimary);
    19521952     lsau=imap(quring,saturn);
    1953      @h=imap(quring,@h); 
     1953     @h=imap(quring,@h);
    19541954
    19551955     kill quring;
     
    19581958     @n2=size(quprimary);
    19591959     @n3=@n2;
    1960    
    1961      for(@n1=1;@n1<=size(collectprimary)/2;@n1++)
     1960
     1961     for(@n1=1;@n1<=size(collectprimary) div 2;@n1++)
    19621962     {
    19631963        if(deg(collectprimary[2*@n1][1])>0)
     
    19701970           quprimary[@n2]=collectprimary[2*@n1];
    19711971        }
    1972      } 
    1973 
    1974      //here the intersection with the polynomialring 
     1972     }
     1973
     1974     //here the intersection with the polynomialring
    19751975     //mentioned above is really computed
    19761976
    1977     for(@n=@n3/2+1;@n<=@n2/2;@n++)
     1977    for(@n=@n3 div 2+1;@n<=@n2 div 2;@n++)
    19781978     {
    19791979        if(specialIdealsEqual(quprimary[2*@n-1],quprimary[2*@n]))
     
    20102010              if(deg(@h[lauf])>0)
    20112011              {
    2012                  fac=fac+factorize(@h[lauf],1); 
     2012                 fac=fac+factorize(@h[lauf],1);
    20132013              }
    20142014           }
     
    20312031              @hilb=hilb(jwork,1);
    20322032        }
    2033        
     2033
    20342034        setring gnir;
    20352035        @j=imap(@Phelp,jwork);
    2036      }   
     2036     }
    20372037  }
    20382038  if((size(quprimary)==0)&&(@wr>0))
     
    20552055           ideal htest=quprimary[1];
    20562056
    2057            for (@n1=2;@n1<=size(quprimary)/2;@n1++)
     2057           for (@n1=2;@n1<=size(quprimary) div 2;@n1++)
    20582058           {
    20592059              htest=intersect(htest,quprimary[2*@n1-1]);
     
    20642064           ideal htest=quprimary[2];
    20652065
    2066            for (@n1=2;@n1<=size(quprimary)/2;@n1++)
     2066           for (@n1=2;@n1<=size(quprimary) div 2;@n1++)
    20672067           {
    20682068              htest=intersect(htest,quprimary[2*@n1]);
     
    21062106              }
    21072107           }
    2108            
     2108
    21092109           for (lauf=1;lauf<=size(@j);lauf++)
    21102110           {
     
    21212121           //intersected with K[var(1),...,var(nva)] is (j:gh^n)
    21222122           //on the other hand j=(j,gh^n) intersected with (j:gh^n)
    2123  
     2123
    21242124           //------------------------------------------------------------------------------------
    21252125
     
    21282128           //-------------------------------------------------------------------------------------
    21292129
    2130            quotring=prepareQuotientring(nvars(basering)-restindep[@m][3]); 
     2130           quotring=prepareQuotientring(nvars(basering)-restindep[@m][3]);
    21312131
    21322132           //---------------------------------------------------------------------
    21332133           //we pass to the quotientring   K(var(nnp+1),..,var(nva))[..the rest..]
    21342134           //---------------------------------------------------------------------
    2135            
     2135
    21362136           execute quotring;
    21372137
     
    21412141
    21422142           kill gnir1;
    2143  
     2143
    21442144           //j is a standardbasis in the quotientring but usually not minimal
    21452145           //here it becomes minimal
     
    21552155           }
    21562156           //the primary decomposition of j*K(var(nnp+1),..,var(nva))[..the rest..]
    2157    
     2157
    21582158            list uprimary= zero_decomp(@j,ser,@wr);
    2159        
     2159
    21602160           //we need the intersection of the ideals in the list quprimary with the
    21612161           //polynomialring, i.e. let q=(f1,...,fr) in the quotientring such an ideal
     
    21672167           list saturn;
    21682168           ideal hpl;
    2169  
     2169
    21702170           for(@n=1;@n<=size(uprimary);@n++)
    21712171           {
    21722172              hpl=0;
    21732173              for(@n1=1;@n1<=size(uprimary[@n]);@n1++)
    2174               { 
     2174              {
    21752175                 hpl=hpl,leadcoef(uprimary[@n][@n1]);
    21762176              }
     
    21822182           //---------------------------------------------------------------------
    21832183           setring gnir;
    2184        
     2184
    21852185           collectprimary=imap(quring,uprimary);
    21862186           lsau=imap(quring,saturn);
    2187            @h=imap(quring,@h); 
     2187           @h=imap(quring,@h);
    21882188
    21892189           kill quring;
     
    21922192           @n2=size(quprimary);
    21932193           @n3=@n2;
    2194    
    2195            for(@n1=1;@n1<=size(collectprimary)/2;@n1++)
     2194
     2195           for(@n1=1;@n1<=size(collectprimary) div 2;@n1++)
    21962196           {
    21972197              if(deg(collectprimary[2*@n1][1])>0)
     
    22042204                 quprimary[@n2]=collectprimary[2*@n1];
    22052205              }
    2206            } 
    2207 
    2208            //here the intersection with the polynomialring 
     2206           }
     2207
     2208           //here the intersection with the polynomialring
    22092209           //mentioned above is really computed
    22102210
    2211            for(@n=@n3/2+1;@n<=@n2/2;@n++)
     2211           for(@n=@n3 div 2+1;@n<=@n2 div 2;@n++)
    22122212           {
    22132213              if(specialIdealsEqual(quprimary[2*@n-1],quprimary[2*@n]))
     
    22442244           {
    22452245              htprimary=decomp(@j,peek,ser);
    2246            }   
     2246           }
    22472247           // here we collect now both results primary(sat(j,gh))
    22482248           // and primary(j,gh^n)
    2249    
     2249
    22502250           @n=size(quprimary);
    22512251           for (@k=1;@k<=size(htprimary);@k++)
     
    22772277   list pr= decomp(i);
    22782278   pr;
    2279    testPrimary( pr, i); 
    2280 }
     2279   testPrimary( pr, i);
     2280}
  • Singular/LIB/random.lib

    r9e7626 r18dd47  
    1 // $Id: random.lib,v 1.2 1997-04-28 19:27:23 obachman Exp $
     1// $Id: random.lib,v 1.3 1997-08-12 14:01:11 Singular Exp $
    22//system("random",787422842);
    33//(GMG/BM, last modified 22.06.96)
     
    213213{
    214214   int ii,min,l,r; intmat M[n][m];
    215    int t=(n*(n-1))/2;
     215   int t=(n*(n-1)) div 2;
    216216//----------------------------- set defaults ----------------------------------
    217217   if( size(#)>=2 ) { int p=#[1]; int b=#[2]; }
Note: See TracChangeset for help on using the changeset viewer.