Changeset 90cf60e in git


Ignore:
Timestamp:
Oct 14, 2016, 2:30:14 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a85c1546f3be117e077ebe1215bb680cf6023e70
Parents:
81fb5aeadbd51ed0150e244d060d98a3a6637449
Message:
format
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/alexpoly.lib

    r81fb5ae r90cf60e  
    361361  int n_i,n_j;
    362362  int bad_contact;
    363   list newpos;  // when reordering the branches, here we save the new order of the old branches 
     363  list newpos;  // when reordering the branches, here we save the new order of the old branches
    364364  for (ii=1;ii<=r;ii++)
    365365  {
     
    421421      newpos=insert(newpos,newpos[j],i-1);
    422422      newpos=delete(newpos,j+1);
    423       // BE AWARE: after this reordering the graphs do not have the correct weight for the 
    424       //           strict transform any more; this will be adjusted further down 
     423      // BE AWARE: after this reordering the graphs do not have the correct weight for the
     424      //           strict transform any more; this will be adjusted further down
    425425      graphs=insert(graphs,graphs[j],i-1);
    426426      graphs=delete(graphs,j+1);
     
    440440      i=i+1;
    441441    }
    442   } 
    443   // Here we adjust the weights of the strict transforms in the graphs!!! 
     442  }
     443  // Here we adjust the weights of the strict transforms in the graphs!!!
    444444  for (i=1;i<=size(graphs);i++)
    445445  {
     
    578578  {
    579579    list result=rgraph,rtm,rmt;
    580     return(result); 
     580    return(result);
    581581  }
    582582  else // reorder the branches according to the ordering of the input
    583583  {
    584     // reordered total multiplicities, multiplicities and resolution graph 
     584    // reordered total multiplicities, multiplicities and resolution graph
    585585    intmat rtmro[nrows(rtm)][ncols(rtm)];
    586586    intmat rmtro[nrows(rmt)][ncols(rmt)];
  • Singular/LIB/ncHilb.lib

    r81fb5ae r90cf60e  
    2222proc nchilb(list L_wp, int d, list #)
    2323"USAGE:  nchilb(list of relations, an integer, optional);
    24          L is a list of modules (each module represents a free-polynomial), 
    25          d is an integer for the degree bound, 
     24         L is a list of modules (each module represents a free-polynomial),
     25         d is an integer for the degree bound,
    2626         # != NULL for non-finitely generated ideals;
    2727NOTE  : The input ideal needs to be given in special form. It is a list
     
    3131        every next entry is a variable.
    3232        Ex. module p1=[1,y,z],[-1,z,y] represents the poly y*z-z*y;
    33             module p2=[1,x,z,x],[-1,z,x,z] represents the poly x*z*x-z*x*z 
     33            module p2=[1,x,z,x],[-1,z,x,z] represents the poly x*z*x-z*x*z
    3434        for more details about the input, see examples.
    3535EXAMPLE: example nchilb; shows an example "
    3636{
    3737
    38     if (d<1) 
     38    if (d<1)
    3939    {
    4040      ERROR("bad degree bound");
    4141    }
    42    
     42
    4343    def save = basering;
    4444    int sz=size(#);
    4545    int lV=nvars(save);
    46    
     46
    4747    def R =makeLetterplaceRing(d);
    4848    setring R;
     
    5050    poly p;
    5151    poly q=0;
    52     // convert list L_wp of free-poly to letterPlace-poly format 
     52    // convert list L_wp of free-poly to letterPlace-poly format
    5353    setring save;
    5454    module M;
     
    5656    vector w;
    5757    poly pc=0;
    58     intvec v; 
     58    intvec v;
    5959    slm = size(L_wp);                  // number of polys in the given ideal
    60    
     60
    6161    for (i=1; i<=slm; i++)
    62     {   
     62    {
    6363        M  = L_wp[i];
    6464        sm = ncols(M);                 // number of words in the free-poly M
     
    6666        {
    6767            w  = M[j];
    68             sw = size(w); 
     68            sw = size(w);
    6969            for (k=2; k<=sw; k++)
    7070            {
     
    8383        setring R;
    8484        I = I,q; //lp-polynomial added to I
    85         q=0;   //ready for the next polynomial 
     85        q=0;   //ready for the next polynomial
    8686        setring save;
    8787    }
     
    8989
    9090    ideal J = system("freegb",I,d,lV);
    91    
     91
    9292    //Groebner Basis is computed for the given ideal.
    9393    //now compute the leading monomials of the Groebner Basis
    94    
     94
    9595    ideal J_lm;
    9696    for(i=1;i<=size(J);i++)
     
    9898        J_lm[i]=leadmonom(J[i]);
    9999    }
    100    
     100
    101101    setring save;
    102102    def A =makeLetterplaceRing(2*d);
    103103    setring A;
    104104    ideal I=imap(R, J_lm);
    105    
     105
    106106    //compute the Hilbert series
    107    
     107
    108108    if(sz==1)                     // non-finitely generated case
    109109    {
     
    116116}
    117117example
    118 { 
     118{
    119119"EXAMPLE:"; echo = 2;
    120120    ring r=0,(x,y,z),dp;
     
    123123    list l1=list(p1,p2);
    124124    nchilb(l1,6,1); //third argument is for non-finitely generated case
    125    
     125
    126126    ring r=0,(x,y,z,w),dp;
    127127    module p1=[1,y,x],[-1,x,y];            //represents the poly y*x-x*y
     
    133133    list l2=list(p1,p2,p3,p4,p5,p6);
    134134    nchilb(l2,5);
    135        
     135
    136136    ring r=0,(X,Y,Z),dp;
    137137    module p1 =[1,Y,Z];                //represents the poly Y*Z
     
    145145    list l3=list(p1,p2,p3,p4,p5,p6,p7,p8);
    146146    nchilb(l3,10);
    147    
     147
    148148    ring r=0,U(1..3),dp;
    149149    module p1=[1,U(2),U(3),U(3)];
     
    171171    p14,p15,p16,p17,p18,p19,p20,p21);
    172172    nchilb(ll,7,1);
    173    
     173
    174174    ring r=0,(x,y,z),dp;
    175175    module p1=[1,x,z,y,z,x,z];
     
    178178    module p4=[1,y,z];
    179179    module p5=[1,x,z,z,x,z];
    180    
     180
    181181    list l1=list(p1,p2,p3,p4,p5);
    182182    nchilb(l1,7);
  • kernel/combinatorics/hilb.cc

    r81fb5ae r90cf60e  
    14021402
    14031403static void idInsertMonomials(ideal I, poly p)
    1404 { 
     1404{
    14051405  /*
    14061406   * adds monomial in I and if required,
     
    14081408   * does not make copy of  p
    14091409   */
    1410    
     1410
    14111411  if(I == NULL)
    14121412  {
     
    14461446  /*
    14471447   * polynomials of J and Ob are assumed to
    1448    * be already sorted. J and Ob are 
     1448   * be already sorted. J and Ob are
    14491449   * represented by the minimal generating set
    14501450   */
     
    14531453  int JCount = IDELEMS(J);
    14541454  int ObCount = IDELEMS(Ob);
    1455  
     1455
    14561456  if(idIs0(J))
    14571457  {
    14581458    return(1);
    14591459  }
    1460   if(JCount != ObCount) 
     1460  if(JCount != ObCount)
    14611461  {
    14621462    return(0);
     
    14691469      return(0);
    14701470    }
    1471   } 
     1471  }
    14721472  return(s);
    14731473}
     
    14801480   * degree less or equal to tr
    14811481   */
    1482  
     1482
    14831483  //case when I=1;
    14841484  if(p_Totaldegree(I->m[0], currRing) == 0)
     
    14861486    return(1);
    14871487  }
    1488  
     1488
    14891489  int count = 0;
    14901490  for(int i = 0; i < IDELEMS(I); i++)
     
    14961496    count = count + 1;
    14971497  }
    1498  
     1498
    14991499  return(count);
    15001500}
     
    15031503{
    15041504  /*
    1505    * polynomials of J and obc are assumed to 
    1506    * be already sorted. J and Ob are 
     1505   * polynomials of J and obc are assumed to
     1506   * be already sorted. J and Ob are
    15071507   * represented by the minimal generating set.
    15081508   * checks if J and Ob are same in polys upto deg <=tr
     
    15161516    return(1);
    15171517  }
    1518  
    1519   if(JCount != ObCount) 
     1518
     1519  if(JCount != ObCount)
    15201520  {
    15211521    return(0);
     
    15291529    }
    15301530  }
    1531    
     1531
    15321532  return(s);
    15331533}
     
    15371537  /*
    15381538   * compares the ideal I with ideals in the Orbit 'idorb'
    1539    * upto degree trInd - max(deg of w, deg of word in polist) polynomials; 
     1539   * upto degree trInd - max(deg of w, deg of word in polist) polynomials;
    15401540   * I and ideals in the Orbit are sorted,
    15411541   * Orbit is ordered,
    15421542   *
    1543    * returns 0 if I is not equal to any of the ideals 
     1543   * returns 0 if I is not equal to any of the ideals
    15441544   * in the Orbit else returns position of the matched ideal
    15451545   */
    1546    
     1546
    15471547  int ps = 0;
    15481548  int i, j, s = 0;
    15491549  int orbCount = idorb.size();
    1550  
     1550
    15511551  if(idIs0(I))
    15521552  {
    15531553    return(1);
    15541554  }
    1555  
     1555
    15561556  int degw = p_Totaldegree(w, currRing);
    15571557  int degp;
    15581558  int dtr;
    1559   int dtrp; 
    1560 
    1561   dtr = trInd - degw; 
     1559  int dtrp;
     1560
     1561  dtr = trInd - degw;
    15621562  int IwCount;
    1563  
     1563
    15641564   IwCount = CountOnIdUptoTruncationIndex(I, dtr);
    15651565
     
    15681568    return(1);
    15691569  }
    1570  
     1570
    15711571  int ObCount;
    1572  
     1572
    15731573  bool flag2 = FALSE;
    1574  
     1574
    15751575  for(i = 1;i < orbCount; i++)
    15761576  {
     
    15791579    {
    15801580      dtr = trInd - degw;
    1581      
     1581
    15821582      ObCount = 0;
    15831583      ObCount = CountOnIdUptoTruncationIndex(idorb[i], dtr);
     
    15911591      }
    15921592    }
    1593     else 
     1593    else
    15941594    {
    15951595      flag2 = TRUE;
     
    16021602
    16031603    s = isMonoIdBasesSame_IG_Case(I, IwCount, idorb[i], ObCount);
    1604    
     1604
    16051605    if(s)
    16061606    {
     
    16151615{
    16161616  /*
    1617    * compares the ideal I with ideals in the Orbit 'idorb' 
     1617   * compares the ideal I with ideals in the Orbit 'idorb'
    16181618   * I and ideals in the Orbit are sorted,
    16191619   * Orbit is ordered,
    16201620   *
    1621    * returns 0 if I is not equal to any of the ideals 
     1621   * returns 0 if I is not equal to any of the ideals
    16221622   * in the Orbit else returns position of the matched ideal
    16231623   */
     
    16401640    }
    16411641  }
    1642  
     1642
    16431643  return(ps);
    16441644}
     
    16671667{
    16681668  /*
    1669    * eliminates monomials which 
     1669   * eliminates monomials which
    16701670   * can be generated by others in I
    16711671   */
    16721672  //first sort monomials of the ideal
    1673  
     1673
    16741674  idSkipZeroes(I);
    16751675
    16761676  sortMonoIdeal_totalDegOrder(I);
    1677  
     1677
    16781678  ideal J = idInit(1, 1);
    16791679  int i, k;
     
    16851685    for(i = 0; i < k; i++)
    16861686    {
    1687  
     1687
    16881688      if(p_LmDivisibleBy(I->m[i], I->m[k], currRing))
    1689       { 
     1689      {
    16901690        pDelete(&(I->m[k]));//this is not req.
    16911691        break;
     
    16931693    }
    16941694  }
    1695  
     1695
    16961696  idSkipZeroes(I);
    16971697  return(I);
     
    17001700static poly shiftInMon(poly p, int i, int lV, const ring r)
    17011701{
    1702   /* 
     1702  /*
    17031703   * shifts the varibles of monomial p in the  i^th layer,
    17041704   * p remains unchanged,
     
    17171717    if(e[j] == 1)
    17181718    {
    1719       s[j+sh] = e[j]; 
    1720     }
    1721   }
    1722  
     1719      s[j+sh] = e[j];
     1720    }
     1721  }
     1722
    17231723  p_SetExpV(smon, s, currRing);
    17241724  omFree(e);
    17251725  omFree(s);
    1726  
     1726
    17271727  p_SetComp(smon, p_GetComp(p, currRing), currRing);
    17281728  p_Setm(smon, currRing);
    1729  
     1729
    17301730  return(smon);
    17311731}
     
    17331733static poly deleteInMon(poly w, int i, int lV, const ring r)
    17341734{
    1735   /* 
     1735  /*
    17361736   * deletes the variables upto i^th layer of monomial w
    17371737   * w remains unchanged
    17381738   * creates new poly and returns it for the colon ideal
    17391739   */
    1740  
     1740
    17411741  poly dw = p_One(currRing);
    17421742  int *e = (int *)omAlloc((r->N+1)*sizeof(int));
     
    17481748  for(j=1;j<=cnt;j++)
    17491749  {
    1750     e[j]=0; 
     1750    e[j]=0;
    17511751  }*/
    17521752  for(j = (cnt+1); j < (r->N+1); j++)
     
    17541754    s[j] = e[j];
    17551755  }
    1756  
     1756
    17571757  p_SetExpV(dw, s, currRing);//new exponents
    17581758  omFree(e);
    17591759  omFree(s);
    1760  
     1760
    17611761  p_SetComp(dw, p_GetComp(w, currRing), currRing);
    17621762  p_Setm(dw, currRing);
    1763  
     1763
    17641764  return(dw);
    17651765}
     
    17801780  poly qmonp = NULL;
    17811781  bool del;
    1782  
     1782
    17831783  for(i = 0;i <= d - 1; i++)
    17841784  {
     
    17861786    smon = shiftInMon(p, i, lV, currRing);
    17871787    del = TRUE;
    1788    
     1788
    17891789    if(pLmDivisibleBy(smon, w))
    17901790    {
    17911791      flag = TRUE;
    1792       del  = FALSE; 
    1793      
     1792      del  = FALSE;
     1793
    17941794      pDelete(&dw);
    17951795      pDelete(&smon);
    1796      
     1796
    17971797      //delete all monomials of Jwi
    17981798      //and make Jwi =1
    1799      
     1799
    18001800      for(int j = 0;j < IDELEMS(Jwi); j++)
    18011801      {
     
    18031803      }
    18041804
    1805       idInsertMonomials(Jwi, p_One(currRing)); 
     1805      idInsertMonomials(Jwi, p_One(currRing));
    18061806      break;
    18071807    }
    18081808
    18091809    if(pLmDivisibleBy(dw, smon))
    1810     { 
    1811       del = FALSE; 
     1810    {
     1811      del = FALSE;
    18121812      qmonp = p_Divide(smon, dw, currRing);
    18131813      idInsertMonomials(Jwi, shiftInMon(qmonp, -d, lV, currRing));
    1814      
     1814
    18151815      //shiftInMon(qmonp, -d, lV, currRing):returns a new poly,
    18161816      //qmonp remains unchanged, delete it
     
    18261826    }
    18271827  }
    1828  
    1829 } 
     1828
     1829}
    18301830
    18311831static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi)
     
    18361836   * keeps S and w unchanged
    18371837   */
    1838  
     1838
    18391839  if(idIs0(S))
    18401840  {
     
    18431843
    18441844  int i, j, d;
    1845   d = p_Totaldegree(w, currRing); 
    1846   bool flag = FALSE; 
     1845  d = p_Totaldegree(w, currRing);
     1846  bool flag = FALSE;
    18471847  int SCount = IDELEMS(S);
    18481848  int cnt = 0;
     
    18551855    }
    18561856  }
    1857  
     1857
    18581858  Jwi = minimalMonomialsGenSet(Jwi);
    18591859  return(Jwi);
     
    18621862
    18631863void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE )
    1864 { 
     1864{
    18651865  /*
    18661866   * It is based on iterative right colon operation to the
     
    18701870   * that is, all the monomials of ideal can be obtained from
    18711871   * finite subsets by applying the finite number
    1872    * of elementary operations. 
     1872   * of elementary operations.
    18731873   */
    18741874
    18751875  int trInd;
    18761876  S = minimalMonomialsGenSet(S);
    1877  
     1877
    18781878  int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int);
    18791879  if(IG_CASE)
     
    18861886    POS = &positionInOrbit_FG_Case;
    18871887  }
    1888  
     1888
    18891889  std::vector<ideal > idorb;
    18901890  std::vector< poly > polist;
    1891  
     1891
    18921892  ideal orb_init = idInit(1, 1);
    18931893  idorb.push_back(orb_init);
    1894  
     1894
    18951895  polist.push_back( p_One(currRing));
    18961896
     
    19031903  int ds, is, ps, sz;
    19041904  int lpcnt = 0;
    1905  
     1905
    19061906  poly w, wi;
    19071907  ideal Jwi;
     
    19141914    if(lpcnt >= 1)
    19151915    {
    1916       if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0) 
     1916      if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
    19171917      {
    19181918        C.push_back(1);
     
    19471947      Jwi = colonIdeal(S, wi, lV, Jwi);
    19481948      ps = (*POS)(Jwi, wi, idorb, polist, trInd);
    1949      
     1949
    19501950      if(ps == 0)  // found new colon ideal
    19511951      {
    1952        
     1952
    19531953        idorb.push_back(Jwi);
    19541954        polist.push_back(wi);
     
    19691969
    19701970  for(is = idorb.size()-1; is >= 0; is--)
    1971   { 
     1971  {
    19721972    idDelete(&idorb[is]);
    19731973  }
     
    19761976    pDelete(&polist[is]);
    19771977  }
    1978  
    1979   idorb.resize(0); 
     1978
     1979  idorb.resize(0);
    19801980  polist.resize(0);
    19811981
    19821982  row.resize(0);
    19831983
    1984   int rowCount, colCount; 
     1984  int rowCount, colCount;
    19851985#if 0
    19861986  for(rowCount = 0; rowCount < mat.size(); rowCount++)
     
    20022002  TransExtInfo p;
    20032003  p.r = rDefault(0, 1, tt);
    2004   coeffs cf = nInitChar(n_transExt,&p); 
    2005  
     2004  coeffs cf = nInitChar(n_transExt,&p);
     2005
    20062006  char** xx = (char**)omalloc(sizeof(char*));
    20072007  xx[0] = omStrDup("x");
    2008   ring R = rDefault(cf, 1, xx); 
    2009   rChangeCurrRing(R); 
     2008  ring R = rDefault(cf, 1, xx);
     2009  rChangeCurrRing(R);
    20102010  /*
    20112011   * matrix corresponding to the orbit of the ideal
     
    20432043  matrix Hnot;
    20442044  luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot);
    2045  
     2045
    20462046  mp_Delete(&mR,R);
    20472047  mp_Delete(&u,R);
Note: See TracChangeset for help on using the changeset viewer.