Changeset 2bf04b in git


Ignore:
Timestamp:
Nov 12, 2015, 2:39:46 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
6da2d6765f8866f8426131bf3a097a5c051e956e
Parents:
412c61b77c65fd4adca8f6576d7f1a597459552e
Message:
format
Files:
59 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gradedModules.lib

    r412c61 r2bf04b  
    16551655    { // no middle part
    16561656      if(a[1]>0)
    1657         {
    1658           N=grtwist(a[1],0);
    1659 
    1660           if(a[n+1]>0)
    1661             { N=grsum(N,grtwist(a[n+1],-1));}
    1662         }
     1657        {
     1658          N=grtwist(a[1],0);
     1659
     1660          if(a[n+1]>0)
     1661            { N=grsum(N,grtwist(a[n+1],-1));}
     1662        }
    16631663      else
    1664         { N=grtwist(a[n+1],-1);}
     1664        { N=grtwist(a[n+1],-1);}
    16651665
    16661666      return (N); // grorder(N));
     
    16781678
    16791679      for(; i <= n; i++)
    1680         {
    1681           if(a[i]==0) { i++; continue; }
    1682           j = i - 1;
    1683           S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
    1684         }
     1680        {
     1681          if(a[i]==0) { i++; continue; }
     1682          j = i - 1;
     1683          S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
     1684        }
    16851685
    16861686      // S is the middle (non-zero) part
    16871687
    16881688      if(a[1] > 0 )
    1689         {
    1690           N=grsum(grtwist(a[1],0), S);
    1691         }
     1689        {
     1690          N=grsum(grtwist(a[1],0), S);
     1691        }
    16921692      else
    1693         { N = S;}
     1693        { N = S;}
    16941694
    16951695      if(a[n+1] > 0 )
    1696         { N=grsum(N, grtwist(a[n+1],-1)); }
     1696        { N=grsum(N, grtwist(a[n+1],-1)); }
    16971697
    16981698
     
    24612461    { // no middle part
    24622462      if(a[1]>0)
    2463         {
    2464           N=grtwist(a[1],-1);
    2465 
    2466           if(a[n+1]>0)
    2467             { N=grsum(N,grtwist(a[n+1],0));}
    2468         }
     2463        {
     2464          N=grtwist(a[1],-1);
     2465
     2466          if(a[n+1]>0)
     2467            { N=grsum(N,grtwist(a[n+1],0));}
     2468        }
    24692469      else
    2470         { N=grtwist(a[n+1],0);}
     2470        { N=grtwist(a[n+1],0);}
    24712471
    24722472      return (N); // grorder(N));
     
    24862486
    24872487      for(; i <= n; i++)
    2488         {
    2489           if(a[i]==0) { i++; continue; }
     2488        {
     2489          if(a[i]==0) { i++; continue; }
    24902490          int j=size(a)-i;
    2491           S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
    2492         }
     2491          S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
     2492        }
    24932493
    24942494      // S is the middle (non-zero) part
    24952495
    24962496      if(a[1] > 0 )
    2497         {
    2498           N=grsum(grtwist(a[1],-1), S);
    2499         }
     2497        {
     2498          N=grsum(grtwist(a[1],-1), S);
     2499        }
    25002500      else
    2501         { N = S;}
     2501        { N = S;}
    25022502
    25032503      if(a[n+1] > 0 )
    2504         { N=grsum(N, grtwist(a[n+1],0)); }
     2504        { N=grsum(N, grtwist(a[n+1],0)); }
    25052505
    25062506
  • Singular/LIB/hdepth.lib

    r412c61 r2bf04b  
    2323{
    2424    if(bound<=1)
    25         {
    26             ERROR("My inverse : negative bound in the inverse");
    27         }
     25    {
     26      ERROR("My inverse : negative bound in the inverse");
     27    }
    2828    if(p == 0)
    29             {
    30                 ERROR("My inverse : p is 0");
    31             }
    32         poly original;
     29    {
     30      ERROR("My inverse : p is 0");
     31    }
     32    poly original;
    3333    original = p;
    3434    if(leadcoef(p) == 0)
    35         {
    36             ERROR("My inverse : the power series is not a unit.");
    37         }
     35    {
     36      ERROR("My inverse : the power series is not a unit.");
     37    }
    3838    poly q = 1/p[1];
    3939    poly res = q;
     
    4242    while(p != 0)
    4343    {
    44         res = res + q * p;
    45         p = jet(p*s,bound);
     44      res = res + q * p;
     45      p = jet(p*s,bound);
    4646    }
    4747    //TEST
    4848    if(jet(original*res,bound) != poly(1))
    49         {
    50             ERROR("Myinverse does not work properly.");
    51         }
     49    {
     50      ERROR("Myinverse does not work properly.");
     51    }
    5252    return(res);
    5353}
     
    6060"
    6161{
    62     poly f;
    63         int i;
    64         for(i=0;i<size(v)-1;i++)
    65         {
    66                 f=f+v[i+1]*t^i;
    67         }
    68         return(f);
     62  poly f;
     63  int i;
     64  for(i=0;i<size(v)-1;i++)
     65  {
     66    f=f+v[i+1]*t^i;
     67  }
     68  return(f);
    6969}
    7070///////////////////////////////////////////////////////////////////////////////////
     
    7474"
    7575{
    76     int pos=1;
    77         while( (f!=0) && (pos==1) )
    78         {
    79                 if(leadcoef(f)<0)
    80                 {
    81                         pos=0;
    82                 }
    83                 f=f-lead(f);
    84         }
    85         return(pos);
     76  int pos=1;
     77  while( (f!=0) && (pos==1) )
     78  {
     79    if(leadcoef(f)<0)
     80    {
     81      pos=0;
     82    }
     83    f=f-lead(f);
     84  }
     85  return(pos);
    8686}
    8787///////////////////////////////////////////////////////////////////////////////////
     
    9191"
    9292{
    93     number c;
    94         while(f!=0)
    95             {
    96                 c = c+leadcoef(f);
    97                 f=f-lead(f);
    98         }
    99         return(int(c));
     93  number c;
     94  while(f!=0)
     95  {
     96    c = c+leadcoef(f);
     97    f=f-lead(f);
     98  }
     99  return(int(c));
    100100}
    101101///////////////////////////////////////////////////////////////////////////////////
     
    105105"
    106106{
    107     int dd = d;
    108         if(debug == 0)
    109             {"G(t)=",g;}
    110         if(positiv(g)==1)
    111                 {
    112                     if(debug == 0)
    113                         {return("hdepth =",dd);}
    114                     else
    115                         {return(dd);}
    116                 }
    117         poly f=g;
    118         number ag;
    119         int c1;
    120         int bound;
    121         bound = deg(g);
    122         while(dd >= 0)
    123         {
    124            dd = dd-1;
    125            f = jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound );
    126        if(positiv(f) == 1)
    127        {
    128                     if(debug == 0)
    129                         {
    130                             "G(t)/(1-t)^",d-dd,"=",f,"+...";
    131                         return("hdepth =",dd);
    132                         }
    133                     else
    134                 {return(d);}
    135        }
     107  int dd = d;
     108  if(debug == 0)
     109  {"G(t)=",g;}
     110  if(positiv(g)==1)
     111  {
     112    if(debug == 0)
     113    {return("hdepth =",dd);}
     114    else
     115    {return(dd);}
     116  }
     117  poly f=g;
     118  number ag;
     119  int c1;
     120  int bound;
     121  bound = deg(g);
     122  while(dd >= 0)
     123  {
     124    dd = dd-1;
     125    f = jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound );
     126    if(positiv(f) == 1)
     127    {
     128      if(debug == 0)
     129      {
     130        "G(t)/(1-t)^",d-dd,"=",f,"+...";
     131        return("hdepth =",dd);
     132      }
     133      else
     134      {return(d);}
     135    }
    136136    c1=sumcoef(f);
    137         if(c1<0)
    138        {
    139                 while(c1<0)
    140                 {
    141                     bound=bound+1;
    142                     f=jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound );
    143                     c1=sumcoef(f);
    144                 }
    145         }
    146         if(debug == 0)
    147             {"G(t)/(1-t)^",d-dd,"=",f,"+...";}
     137    if(c1<0)
     138    {
     139      while(c1<0)
     140      {
     141        bound=bound+1;
     142        f=jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound );
     143        c1=sumcoef(f);
     144      }
    148145    }
    149     ERROR("g was not a Hilbert Series since the coefficient sum is not > 0");
     146    if(debug == 0)
     147    {"G(t)/(1-t)^",d-dd,"=",f,"+...";}
     148  }
     149  ERROR("g was not a Hilbert Series since the coefficient sum is not > 0");
    150150}
    151 
    152151example
    153152{
     
    167166"
    168167{
    169     int debug;
    170     if(size(#)>0)
    171         {
    172             if(typeof(#[1])=="int")
    173                 {debug = #[1];}
    174         }
    175     else
    176         {debug = 1;}
    177     M = std(M);
    178     int d=nvars(basering)-dim(M);
    179     intvec v=hilb(M,2);
    180     ring R = 0,t,ds;
    181     poly hp=hilbconstruct(v);
    182     if(debug == 0)
    183         {"dim =",d;}
    184     return(hdepth_p(hp,d,debug));
     168  int debug;
     169  if(size(#)>0)
     170  {
     171    if(typeof(#[1])=="int")
     172    {debug = #[1];}
     173  }
     174  else
     175  {debug = 1;}
     176  M = std(M);
     177  int d=nvars(basering)-dim(M);
     178  intvec v=hilb(M,2);
     179  ring R = 0,t,ds;
     180  poly hp=hilbconstruct(v);
     181  if(debug == 0)
     182  {"dim =",d;}
     183  return(hdepth_p(hp,d,debug));
    185184}
    186185example
  • Singular/LIB/inout.lib

    r412c61 r2bf04b  
    487487         @@s = tab(@li@)+"// ring:"; @@s,s;
    488488         @@s = tab(@li@)+"// minpoly ="; @@s,minpoly;
    489         if (size(ideal(@id@))>0)
    490         {
     489        if (size(ideal(@id@))>0)
     490        {
    491491           @@s = tab(@li@)+"// quotient ring from ideal:"; @@s;ideal(@id@);
    492         }
     492        }
    493493         kill @id@;
    494494         "// objects belonging to this ring:";
  • Singular/LIB/mathml.lib

    r412c61 r2bf04b  
    2929
    3030/*********************************************************
    31 **                                                      **
    32 **                        TOOLs                         **
    33 **                                                      **
     31**                                                        **
     32**                          TOOLs                                **
     33**                                                        **
    3434*********************************************************/
    3535
    3636static proc mathmlStringReplace(string s,string dummy,string origin)"USAGE: texStringReplace(s); where s is a string
    3737ASSUME: s is a string
    38 RETURN: s including origin instead of dummy
     38RETURN:        s including origin instead of dummy
    3939THEORY: if s contains dummy, these parts will be replaced by origin
    4040"{
    41         int k,L;
    42         string S;
    43         S = s;
    44         while(find(S,dummy)>0){
    45                 k = find(S,dummy);
    46                 L = size(dummy);
    47                 if(k+L<=size(S)){               
    48                         S = S[1,k-1] + origin +  S[k+L..size(S)];
    49                 }
    50                 else{S = S[1,k-1] + origin;}
    51         }
     41        int k,L;
     42        string S;
     43        S = s;
     44        while(find(S,dummy)>0){
     45                k = find(S,dummy);
     46                L = size(dummy);
     47                if(k+L<=size(S)){
     48                        S = S[1,k-1] + origin +  S[k+L..size(S)];
     49                }
     50                else{S = S[1,k-1] + origin;}
     51        }
    5252
    5353return(S);
     
    5656
    5757proc mathmlRingType(){
    58         string S        = charstr(basering);
    59         int i           = find(S,",");
     58        string S         = charstr(basering);
     59        int i                = find(S,",");
    6060        int n;
    61         if(i>0){S = S[1,i-1];}
    62         if(S=="real" || S =="complex"){return(0)}
    63         else{ if (npars(basering)>0) {
     61        if(i>0){S = S[1,i-1];}
     62        if(S=="real" || S =="complex"){return(0)}
     63        else{ if (npars(basering)>0) {
    6464                  n=ringlist(basering)[1][1];
    6565                  if (n!=0 && prime(n)!=n) {return(2);}
     
    7171
    7272/*********************************************************
    73 **                                                      **
    74 **                        POLY                          **
    75 **                                                      **
     73**                                                        **
     74**                          POLY                                **
     75**                                                        **
    7676*********************************************************/
    7777
     
    8585 while (i<size(s)) {
    8686   if (s[i]=="/")  {u=1;
    87                     i=size(s);} 
     87                    i=size(s);}
    8888   i=i+1;
    8989  }
     
    9595   t=t+"<mfrac> <mn>";
    9696 while (i<=size(s)) {
    97     if (s[i]=="/") {t=t+"</mn> <mn>";} 
     97    if (s[i]=="/") {t=t+"</mn> <mn>";}
    9898    else           {t=t+s[i];}
    9999    i=i+1;
     
    105105  t=t+"<mn>"+s+"</mn>";}
    106106return(t);
    107 } 
     107}
    108108
    109109proc mathmlVariablesEncoding(string s)  {
     
    111111int p;
    112112 if(s[size(s)]==")"){
    113                         p = find(s,"(");
    114                         S = S + "<msub><mi>"+s[1,p-1] + "</mi><mn>" + s[p+1,size(s)-p-1]+ "</mn></msub>";
    115                 }
    116   else{   
    117         if (size(s)>1)  { 
     113                        p = find(s,"(");
     114                        S = S + "<msub><mi>"+s[1,p-1] + "</mi><mn>" + s[p+1,size(s)-p-1]+ "</mn></msub>";
     115                }
     116  else{
     117        if (size(s)>1)  {
    118118                  S = S + "<msub><mi>"+s[1] + "</mi><mn>" + s[2,size(s)-1]+ "</mn></msub>";}
    119119        else         {S="<mi>"+s+"</mi>";}
     
    136136  g=g+"</mn></msup>";
    137137  k=k+1;}
    138   }   
     138  }
    139139return(g);
    140140}
     
    186186
    187187proc mathmlPolyGAL(poly p){
    188         string S;
    189         for(int i = 1;i<size(p);i++){
    190                 S = S + mathmlTermGAL(p[i]);
     188        string S;
     189        for(int i = 1;i<size(p);i++){
     190                S = S + mathmlTermGAL(p[i]);
    191191           if (string(leadcoef(p[i+1]))!="-1") {S=S+"<mo>+</mo>";}
    192         }
    193         S = S+ mathmlTermGAL(p[i]);
     192        }
     193        S = S+ mathmlTermGAL(p[i]);
    194194return(S);
    195195}
    196196
    197197proc mathmlTermGAL(poly p){
    198         int b = 0;
    199         int B = 0;     
    200         string S,S1,C,Pname;
    201         Pname = ringlist(basering)[1][2][1];
    202         C = string(leadcoef(p));
    203        
    204         C = mathmlStringReplace(C,Pname,"");
     198        int b = 0;
     199        int B = 0;
     200        string S,S1,C,Pname;
     201        Pname = ringlist(basering)[1][2][1];
     202        C = string(leadcoef(p));
     203
     204        C = mathmlStringReplace(C,Pname,"");
    205205        C = mathmlStringReplace(C,"^","");
    206206        if (p==-1 || p==1 || p==0) {return("<mn>"+string(p)+"</mn>");}
    207207         else {
    208208           if (C=="-1") {S=S+"<mo>-</mo>";}
    209            else { 
     209           else {
    210210             if (C!="1") {S =S+ "<msup><mi>"+Pname+"</mi><mn>"+C +"</mi></msup>";}
    211211              }
     
    220220proc mathmlPolyR(poly a) {
    221221      string S;
    222  
     222
    223223      def origin = basering;
    224    
     224
    225225      if(npars(origin) == 0){
    226                 list l          = ringlist(basering);
    227                 l[1][3]         = "parTMP";
    228                 def ringCOMPLEX = ring(l);
    229                 setring ringCOMPLEX;
    230                 poly a = fetch(origin,a);
    231         }
     226                list l                 = ringlist(basering);
     227                l[1][3]         = "parTMP";
     228                def ringCOMPLEX        = ring(l);
     229                setring ringCOMPLEX;
     230                poly a = fetch(origin,a);
     231        }
    232232    string S1;
    233233    string S2;
     
    243243     S1=mathmlMonomial(leadmonom(d));
    244244      if (leadcoef(d)==1) {
    245        if (S1=="") {S=S+"<mn>1</mn>";} 
     245       if (S1=="") {S=S+"<mn>1</mn>";}
    246246   }
    247247    else {
     
    269269int n=npars(basering);
    270270
    271  if (n>0) { 
     271 if (n>0) {
    272272    if (SignumLeadcoef(numerator(d))) {
    273273           g=g+"<mo>-</mo>";
     
    297297 else      {if (SignumLeadcoef(numerator(leadcoef(a)))==0) {g=g+"<mo>+</mo>";}}
    298298  g=g+mathmlPolyN(a,r);
    299  } 
     299 }
    300300return(g);
    301301}
     
    317317{ "EXAMPLE:"; echo=2;
    318318        string h;
    319         ring r = (0,a),(x1,x2),dp;
    320         h=h+mathmlPoly(x1+a2)+"<br>";
    321         h=h+mathmlPoly(x1*x2^3)+"<br>";
     319        ring r = (0,a),(x1,x2),dp;
     320        h=h+mathmlPoly(x1+a2)+"<br>";
     321        h=h+mathmlPoly(x1*x2^3)+"<br>";
    322322        ring r=(0,a,b),(x(1..2)),lp;
    323323        poly z=(3*a^2-12*b)*x(1)^2*x(2)+(3*a^3-1)*x(2)+x(1)^2-3/5*x(1)+1;
     
    356356
    357357/*********************************************************
    358 **                                                      **
    359 **                      ring                            **
    360 **                                                      **
     358**                                                        **
     359**                        ring                                **
     360**                                                        **
    361361*********************************************************/
    362362
     
    365365ASSUME:  r is a ring
    366366RETURN:  lateX-code for the ring r
    367 THEORY:       
     367THEORY:
    368368KEYWORDS: ring, lateX, teX, tex, latex
    369369EXAMPLE:  example texRing; shows an example
    370370"
    371371{       setring r;
    372         list l,l1,l2;
    373         l       = ringlist(r);
     372        list l,l1,l2;
     373        l         = ringlist(r);
    374374        l2      = ringlist(r)[2];
    375375
    376         string c,p,P,V,C,S,h;
    377        
    378         int i,b;
    379         int bchar;
    380        
     376        string c,p,P,V,C,S,h;
     377
     378        int i,b;
     379        int bchar;
     380
    381381
    382382        list l3=l;
     
    386386        list l=fetch(r,l);
    387387        setring r;
    388        
    389        
    390         //characteristic
    391         c  = charstr(r);               
    392         bchar = 0;
    393         if(find(c,",") != 0){
    394                 c       = c[1,find(c,",")-1];
    395                 b = 0;
    396                 if(typeof(l[1][2][1]) != "string" && b==0&& c =="integer"){bchar= 1;b = 1;}     
    397                 if(typeof(l[1][2][1]) != "string" && b==0){bchar  = 2;b=1;}
    398                 if(b==0){  if (mathmlRingType()==2) {bchar = 4;}
    399                            else {bchar=3;} 
    400                         }       
    401         }       
    402        
    403         //minimalpolynom
    404         p = string(minpoly);
    405        
    406 
    407 
    408 
    409         //parameters
    410         if(bchar==3){
    411                 if(p != "0"){P=P+"[";}                                         
    412                 else{P=P+"(";}
    413                         for(i=1;i<size(l[1][2]);i++){
    414                                 P = P + mathmlVariablesEncoding(string(l[1][2][i])) +",";
    415                         }
    416                         P=P+mathmlVariablesEncoding(string(l[1][2][size(l[1][2])]));
    417                 if(p != "0"){
     388
     389
     390        //characteristic
     391        c  = charstr(r);
     392        bchar = 0;
     393        if(find(c,",") != 0){
     394                c         = c[1,find(c,",")-1];
     395                b = 0;
     396                if(typeof(l[1][2][1]) != "string" && b==0&& c =="integer"){bchar= 1;b = 1;}
     397                if(typeof(l[1][2][1]) != "string" && b==0){bchar  = 2;b=1;}
     398                if(b==0){  if (mathmlRingType()==2) {bchar = 4;}
     399                           else {bchar=3;}
     400                        }
     401        }
     402
     403        //minimalpolynom
     404        p = string(minpoly);
     405
     406
     407
     408
     409        //parameters
     410        if(bchar==3){
     411                if(p != "0"){P=P+"[";}
     412                else{P=P+"(";}
     413                        for(i=1;i<size(l[1][2]);i++){
     414                                P = P + mathmlVariablesEncoding(string(l[1][2][i])) +",";
     415                        }
     416                        P=P+mathmlVariablesEncoding(string(l[1][2][size(l[1][2])]));
     417                if(p != "0"){
    418418                        l3[1][4]=ideal(0);
    419419                        w=ring(l3);
     
    428428                        setring(r);
    429429                       }
    430                 else{P=P+")";}
    431         }
    432 
    433 
    434         //variables
    435         V = V + "[";
    436         for(i = 1;i<size(l2);i++){
    437                 V = V + mathmlVariablesEncoding((string(l2[i]))) + ",";
    438         }
    439         V = V + mathmlVariablesEncoding((string(l2[size(l2)])));
    440         V = V + "]";
    441 
    442         b = 0;
    443         if(c == "integer" && b == 0){
    444                 if(bchar==1){                                                   //Z/(p^k)
    445                         if(string(l[1][2][2])!="1"){
    446                         C=C+"<msub><mrow><mn>&integers;</mn></mrow><mrow><msup><mrow>"+string(l[1][2][1])+"</mrow><mrow>"+string(l[1][2][2])+"<mrow></msup></mrow></msub>";
    447                         }
    448                         else{C=C+"<msub><mn>&integers;</mn>"+"<mn>"+string(l[1][2][1])+"</mn></msub>";}
    449                         b = 1;
    450                 }
    451                 else{C = C + "<mn>&integers;</mn>";b=1;}                                //Z
    452         }
    453         if(c == "0" && b == 0){C = C + "<mn>&rationals;</mn>";b=1;}                     //Q
    454         if(c == "real" && b == 0){C = C + "<mn>&reals;</mn>";b=1;}                      //R
    455         if(c == "complex" && b == 0){
    456                 b=1;
    457                 if(typeof(l[1][3]) != "none"){
    458                         if(l[1][3]!="i"){C = C + "<mn>&reals;</mn>("+l[1][3]+")";}      //R(j)
    459                         else{C = C + "<mn>&complexes;</mn>";}
    460                 }
    461                 else{C = C + "<mn>&complexes;</mn";}                                       //C
    462         }
    463         if(b == 0){ if (bchar==4) {C = C + "<msub><mn>F</mn>"+c+"</msub>";}                //F/p
     430                else{P=P+")";}
     431        }
     432
     433
     434        //variables
     435        V = V + "[";
     436        for(i = 1;i<size(l2);i++){
     437                V = V + mathmlVariablesEncoding((string(l2[i]))) + ",";
     438        }
     439        V = V + mathmlVariablesEncoding((string(l2[size(l2)])));
     440        V = V + "]";
     441
     442        b = 0;
     443        if(c == "integer" && b == 0){
     444                if(bchar==1){                                                        //Z/(p^k)
     445                        if(string(l[1][2][2])!="1"){
     446                        C=C+"<msub><mrow><mn>&integers;</mn></mrow><mrow><msup><mrow>"+string(l[1][2][1])+"</mrow><mrow>"+string(l[1][2][2])+"<mrow></msup></mrow></msub>";
     447                        }
     448                        else{C=C+"<msub><mn>&integers;</mn>"+"<mn>"+string(l[1][2][1])+"</mn></msub>";}
     449                        b = 1;
     450                }
     451                else{C = C + "<mn>&integers;</mn>";b=1;}                                 //Z
     452        }
     453        if(c == "0" && b == 0){C = C + "<mn>&rationals;</mn>";b=1;}                        //Q
     454        if(c == "real" && b == 0){C = C + "<mn>&reals;</mn>";b=1;}                        //R
     455        if(c == "complex" && b == 0){
     456                b=1;
     457                if(typeof(l[1][3]) != "none"){
     458                        if(l[1][3]!="i"){C = C + "<mn>&reals;</mn>("+l[1][3]+")";}        //R(j)
     459                        else{C = C + "<mn>&complexes;</mn>";}
     460                }
     461                else{C = C + "<mn>&complexes;</mn";}                                           //C
     462        }
     463        if(b == 0){ if (bchar==4) {C = C + "<msub><mn>F</mn>"+c+"</msub>";}                //F/p
    464464                    else          {C = C + "<msub><mn>&integers;</mn>"+c+"</msub>";b=1;}   //Z/p
    465        
    466                    }
    467         //epic conclusion
    468         if(size(P)!=0){S = S + C+P+V;}
    469         else{S=S+C+V;}
    470        
    471        if (l[4]!=0) { 
     465
     466                   }
     467        //epic conclusion
     468        if(size(P)!=0){S = S + C+P+V;}
     469        else{S=S+C+V;}
     470
     471       if (l[4]!=0) {
    472472          setring w;
    473            
     473
    474474          S=S+"<mo>/</mo><mo>(</mo>";
    475475            for(int k=1;k<=size(l[4]);k++) {
     
    480480          S=S[1,size(S)-10]+"<mo>)</mo>";
    481481        }
    482        
    483         S = "<math xmlns=http://www.w3.org/1998/Math/MathML>" + S + "</math>";
     482
     483        S = "<math xmlns=http://www.w3.org/1998/Math/MathML>" + S + "</math>";
    484484return(S);
    485485}
     
    489489{ "EXAMPLE:"; echo=2;
    490490        string h;
    491         ring r = 32003,(x,y,z),dp;
    492         h=h+mathmlRing(r)+"<br>";
    493         ring r = 32003,(x(1..10)),dp;
    494         h=h+mathmlRing(r)+"<br>";
    495         ring r = 0,(a,b,c,d),lp;
    496         h=h+mathmlRing(r)+"<br>";
    497         ring r =7,(x,y,z),ds;
    498         h=h+mathmlRing(r)+"<br>";
    499         ring r = 7,(x(1..6)),(lp(3),dp);
    500         h=h+mathmlRing(r)+"<br>";
    501         ring r =0,(x,y,z),(c,wp(2,1,3));
    502         h=h+mathmlRing(r)+"<br>";
    503         ring r =(7,a,b,c),(x,y,z),Dp;
    504         h=h+mathmlRing(r)+"<br>";
    505         ring r =(7,a),(x,y,z),dp; minpoly = a^2+a+3;
    506         h=h+mathmlRing(r)+"<br>";
    507         ring r =real,(x,y,z),dp;
    508         h=h+mathmlRing(r)+"<br>";
     491        ring r = 32003,(x,y,z),dp;
     492        h=h+mathmlRing(r)+"<br>";
     493        ring r = 32003,(x(1..10)),dp;
     494        h=h+mathmlRing(r)+"<br>";
     495        ring r = 0,(a,b,c,d),lp;
     496        h=h+mathmlRing(r)+"<br>";
     497        ring r =7,(x,y,z),ds;
     498        h=h+mathmlRing(r)+"<br>";
     499        ring r = 7,(x(1..6)),(lp(3),dp);
     500        h=h+mathmlRing(r)+"<br>";
     501        ring r =0,(x,y,z),(c,wp(2,1,3));
     502        h=h+mathmlRing(r)+"<br>";
     503        ring r =(7,a,b,c),(x,y,z),Dp;
     504        h=h+mathmlRing(r)+"<br>";
     505        ring r =(7,a),(x,y,z),dp; minpoly = a^2+a+3;
     506        h=h+mathmlRing(r)+"<br>";
     507        ring r =real,(x,y,z),dp;
     508        h=h+mathmlRing(r)+"<br>";
    509509        ring r =(real,50),(x,y,z),dp;
    510         h=h+mathmlRing(r)+"<br>";
    511         ring r =(real,10,50),(x,y,z),dp;
    512         h=h+mathmlRing(r)+"<br>";
    513         ring r = (complex,30,j),(x,y,z),dp;
    514         h=h+mathmlRing(r)+"<br>";
    515         ring r =complex,(x,y,z),dp;
    516         h=h+mathmlRing(r)+"<br>";
    517         ring r =7,(x,y,z), dp;
    518         h=h+mathmlRing(r)+"<br>";
    519         ring r =integer,(x,y,z), dp;
    520         h=h+mathmlRing(r)+"<br>";
    521         ring r =(integer, 6, 3),(x,y,z), dp;
    522         h=h+mathmlRing(r)+"<br>";
    523         ring r =(integer, 100),(x,y,z), dp;
    524         h=h+mathmlRing(r)+"<br>";
     510        h=h+mathmlRing(r)+"<br>";
     511        ring r =(real,10,50),(x,y,z),dp;
     512        h=h+mathmlRing(r)+"<br>";
     513        ring r = (complex,30,j),(x,y,z),dp;
     514        h=h+mathmlRing(r)+"<br>";
     515        ring r =complex,(x,y,z),dp;
     516        h=h+mathmlRing(r)+"<br>";
     517        ring r =7,(x,y,z), dp;
     518        h=h+mathmlRing(r)+"<br>";
     519        ring r =integer,(x,y,z), dp;
     520        h=h+mathmlRing(r)+"<br>";
     521        ring r =(integer, 6, 3),(x,y,z), dp;
     522        h=h+mathmlRing(r)+"<br>";
     523        ring r =(integer, 100),(x,y,z), dp;
     524        h=h+mathmlRing(r)+"<br>";
    525525        ring r=(121,a),x,lp;
    526526        h=h+mathmlRing(r);
     
    531531
    532532/*********************************************************
    533 **                                                      **
    534 **                      map                             **
    535 **                                                      **
     533**                                                        **
     534**                        map                                **
     535**                                                        **
    536536*********************************************************/
    537537
     
    540540ASSUME:  f is a map, #[1] ring or empty
    541541RETURN:  lateX-code for the map f
    542 THEORY:       
     542THEORY:
    543543KEYWORDS: map, lateX, teX, tex, latex
    544544EXAMPLE:  example texMap; shows an example
    545545"
    546 {       
    547        
    548         // f: s--->r (rings) || f:s1--->s2 (string)
    549         string s1,s2;
     546{
     547
     548        // f: s--->r (rings) || f:s1--->s2 (string)
     549        string s1,s2;
    550550        string h1,h2;
    551         string T,S; //variables, output string
    552         s2 = mathmlRing(basering);
    553         s2 = s2[48,size(s2)-54];
    554         int B = 0;
    555         int b = 0;
    556         if(nameof(basering)==nameof(preimage(f))){b=1;}
    557        
    558         def r = basering;
    559         if(size(#)!=0){
    560                 if(typeof(#[1]) != "ring"){return("ERROR - wrong input. check texMap documentation." );}
    561                 def     s;
    562                         s = #[1];
    563                 setring s;
    564                 s1      = mathmlRing(s);
    565                 s1      = s1[48,size(s1)-54];   
    566                 list l1;               
    567                 for(int k=1;k<=nvars(s);k++){
    568                         l1[k] = mathmlVariablesEncoding(string(var(k)));
    569                 }
    570                
    571                 setring r;
    572                 for(int i = 1;i<=nvars(s);i++){
     551        string T,S; //variables, output string
     552        s2 = mathmlRing(basering);
     553        s2 = s2[48,size(s2)-54];
     554        int B = 0;
     555        int b = 0;
     556        if(nameof(basering)==nameof(preimage(f))){b=1;}
     557
     558        def r = basering;
     559        if(size(#)!=0){
     560                if(typeof(#[1]) != "ring"){return("ERROR - wrong input. check texMap documentation." );}
     561                def         s;
     562                        s = #[1];
     563                setring s;
     564                s1        = mathmlRing(s);
     565                s1         = s1[48,size(s1)-54];
     566                list l1;
     567                for(int k=1;k<=nvars(s);k++){
     568                        l1[k] = mathmlVariablesEncoding(string(var(k)));
     569                }
     570
     571                setring r;
     572                for(int i = 1;i<=nvars(s);i++){
    573573                        h1=mathmlPoly(f[i]);
    574574                        h2=h1[48,size(h1)-54];
    575                         T =T+ "<mtr><mtd>"+l1[i]+"</mtd><mtd>"+"<mo>&mapsto;</mo>"+"</mtd><mtd>"+h2+"</mtd></mtr>";
    576                 }
    577         }
    578         else{
    579                 if(b==1){
    580                         mathmlMap(f,basering);
    581                         return();
    582                 }
    583                 else{
    584                         s1 = "'"+nameof(preimage(f))+"'";
    585                         print("For detailed information we need the source");
    586                         B = 1;
    587                 }
    588 
    589         }
    590         S = "<mtr><mtd>"+s1+"</mtd><mtd>" + "<mo>&rightarrow;</mo>" +"</mtd><mtd>"+ s2+"</mtd></mtr>"+T;
    591         S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mtable>" + S + "</mtable></math>";
    592        
    593         return(S);
     575                        T =T+ "<mtr><mtd>"+l1[i]+"</mtd><mtd>"+"<mo>&mapsto;</mo>"+"</mtd><mtd>"+h2+"</mtd></mtr>";
     576                }
     577        }
     578        else{
     579                if(b==1){
     580                        mathmlMap(f,basering);
     581                        return();
     582                }
     583                else{
     584                        s1 = "'"+nameof(preimage(f))+"'";
     585                        print("For detailed information we need the source");
     586                        B = 1;
     587                }
     588
     589        }
     590        S = "<mtr><mtd>"+s1+"</mtd><mtd>" + "<mo>&rightarrow;</mo>" +"</mtd><mtd>"+ s2+"</mtd></mtr>"+T;
     591        S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mtable>" + S + "</mtable></math>";
     592
     593        return(S);
    594594}
    595595example
    596596{ "EXAMPLE:"; echo=2;
    597597        string h;
    598         ring U  = 0,(x,y,z),lp;
    599         ring M2 = real,(z(1..3)),lp;
    600         setring M2;
    601         map f   = U,z(1)*z(2)^3,z(1),-z(2);
    602         h=h+mathmlMap(f)+"<br>";
    603         //2nd
    604         h=h+mathmlMap(f,U)+"<br>";
    605         //3rd
    606         ring R = real,(x,y,z),lp;
    607         map f2 = R,x2,y2,z-x;
    608         h=h+string(mathmlMap(f2));
     598        ring U         = 0,(x,y,z),lp;
     599        ring M2 = real,(z(1..3)),lp;
     600        setring M2;
     601        map f        = U,z(1)*z(2)^3,z(1),-z(2);
     602        h=h+mathmlMap(f)+"<br>";
     603        //2nd
     604        h=h+mathmlMap(f,U)+"<br>";
     605        //3rd
     606        ring R = real,(x,y,z),lp;
     607        map f2 = R,x2,y2,z-x;
     608        h=h+string(mathmlMap(f2));
    609609        viewMathml(h);}
    610610
     
    617617
    618618/*********************************************************
    619 **                                                      **
    620 **                      IDEAL                           **
    621 **                                                      **
     619**                                                        **
     620**                        IDEAL                                **
     621**                                                        **
    622622*********************************************************/
    623623proc mathmlIdeal(ideal I)"USAGE: texIdeal(I), where I is an ideal
    624624ASSUME:  I is an ideal
    625625RETURN:  lateX-code for the ideal I
    626 THEORY: 
     626THEORY:
    627627KEYWORDS: ideal, lateX, teX, tex, latex
    628628EXAMPLE:  example texIdeal; shows an example
    629629"{
    630         string S = "";
    631         for(int i = 1;i<size(I);i++){
    632                 S = S + mathmlPoly(I[i],"no$") + ",";
    633         }
    634         S = S + mathmlPoly(I[size(I)],"no$");
    635         S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>&lang;</mo>" + S + "<mo>&rang;</mo></math>";
    636         return(S);
     630        string S = "";
     631        for(int i = 1;i<size(I);i++){
     632                S = S + mathmlPoly(I[i],"no$") + ",";
     633        }
     634        S = S + mathmlPoly(I[size(I)],"no$");
     635        S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>&lang;</mo>" + S + "<mo>&rang;</mo></math>";
     636        return(S);
    637637}
    638638example
    639639{"EXAMPLE: "; echo=2;
    640         ring r = 0,(x,y,z),dp;
    641         ideal I = x2,y3,z;
    642         viewMathml(mathmlIdeal(I));
    643 }
    644 
    645 
    646 
    647 /*********************************************************
    648 **                                                      **
    649 **                      LIST                            **
    650 **                                                      **
     640        ring r = 0,(x,y,z),dp;
     641        ideal I = x2,y3,z;
     642        viewMathml(mathmlIdeal(I));
     643}
     644
     645
     646
     647/*********************************************************
     648**                                                        **
     649**                        LIST                                **
     650**                                                        **
    651651*********************************************************/
    652652proc mathmlList(list l)"USAGE: texList(l), where l is a list
    653653ASSUME:  l is a list
    654654RETURN:  lateX-code for the list l
    655 THEORY: 
     655THEORY:
    656656KEYWORDS: list, lateX, teX, tex, latex
    657657EXAMPLE:  example texList; shows an example
    658658"{
    659         string tmp;
    660         string S = "";
    661         for(int i=1;i<size(l);i++){
    662                 tmp = mathml(l[i]);     
    663                 tmp = tmp[48,size(tmp)-54];
    664                 //S = S + tex(l[i]) + ";";
    665                 S = S + tmp + ";";     
    666         }
    667         //tmp = tex(l[size(l)]);       
    668         tmp = mathml(l[size(l)]);
    669         tmp = tmp[48,size(tmp)-54];
    670         //S = S + tex(l[size(l)]);
    671         S = S + tmp;   
    672         S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>{</mo>" + S + "<mo>}</mo></math>";;
    673         return(S);
     659        string tmp;
     660        string S = "";
     661        for(int i=1;i<size(l);i++){
     662                tmp = mathml(l[i]);
     663                tmp = tmp[48,size(tmp)-54];
     664                //S = S + tex(l[i]) + ";";
     665                S = S + tmp + ";";
     666        }
     667        //tmp = tex(l[size(l)]);
     668        tmp = mathml(l[size(l)]);
     669        tmp = tmp[48,size(tmp)-54];
     670        //S = S + tex(l[size(l)]);
     671        S = S + tmp;
     672        S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>{</mo>" + S + "<mo>}</mo></math>";;
     673        return(S);
    674674}
    675675example
    676676{"EXAMPLE:"; echo=2;
    677677        string h;
    678         //int   
    679         ring r = integer,(x,y,z),dp;
    680         list l = 1,2,3;
    681         h=h+mathmlList(l)+"<br>";
    682         //ring 
    683         ring r2 = real,(a,b,c),dp;
    684         ring r3 = complex,(x(1..3)),dp;
    685         list l2 = r,r2,r3;
    686         h=h+mathmlList(l2)+"<br>";
    687         //matrix
    688         setring r;
    689         matrix m1[2][2]=x2y,-xz3,0,17x3z2;
    690         matrix m2[2][2]=1,2,3,4;
    691         list l3 = m1,m2;
    692         h=h+mathmlList(l3);
    693         //poly
    694         poly p  = x2-1;
    695         poly p2 = x3-y+z;
    696         poly p3 = y3-z7;
    697         list l4 = p,p2,p3;
    698         //mathmlList(l4);
     678        //int
     679        ring r = integer,(x,y,z),dp;
     680        list l = 1,2,3;
     681        h=h+mathmlList(l)+"<br>";
     682        //ring
     683        ring r2 = real,(a,b,c),dp;
     684        ring r3 = complex,(x(1..3)),dp;
     685        list l2 = r,r2,r3;
     686        h=h+mathmlList(l2)+"<br>";
     687        //matrix
     688        setring r;
     689        matrix m1[2][2]=x2y,-xz3,0,17x3z2;
     690        matrix m2[2][2]=1,2,3,4;
     691        list l3 = m1,m2;
     692        h=h+mathmlList(l3);
     693        //poly
     694        poly p  = x2-1;
     695        poly p2 = x3-y+z;
     696        poly p3 = y3-z7;
     697        list l4 = p,p2,p3;
     698        //mathmlList(l4);
    699699        viewMathml(h);
    700700}
     
    703703
    704704/*********************************************************
    705 **                                                      **
    706 **                      BIGINT,INT                      **
    707 **                                                      **
     705**                                                        **
     706**                        BIGINT,INT                        **
     707**                                                        **
    708708*********************************************************/
    709709proc mathmlBigInt (bigint I){
    710         return("<math xmlns=http://www.w3.org/1998/Math/MathML>"+string(I)+"</math>");
     710        return("<math xmlns=http://www.w3.org/1998/Math/MathML>"+string(I)+"</math>");
    711711}
    712712
    713713proc mathmlInt(int I){
    714         return(mathmlBigInt(I));
    715 }
    716 
    717 
    718 /*********************************************************
    719 **                                                      **
    720 **                      STRING                          **
    721 **                                                      **
     714        return(mathmlBigInt(I));
     715}
     716
     717
     718/*********************************************************
     719**                                                        **
     720**                        STRING                                **
     721**                                                        **
    722722*********************************************************/
    723723proc mathmlString(string m){
     
    727727
    728728/*********************************************************
    729 **                                                      **
    730 **                      NUMBER                          **
    731 **                                                      **
    732 **requires: mathmlPoly - since there might be a parameter       **
     729**                                                        **
     730**                        NUMBER                                **
     731**                                                        **
     732**requires: mathmlPoly - since there might be a parameter         **
    733733*********************************************************/
    734734
    735735proc mathmlNumber(number n){
    736         string S;
    737         S = mathmlPoly(n);     
     736        string S;
     737        S = mathmlPoly(n);
    738738return(S);
    739739}
    740740
    741741/*********************************************************
    742 **                                                      **
    743 **              VECTOR, INTVEC                          **
    744 **              INTMAT, BIGINTMAT, MATRIX               **
    745 **                                                      **
     742**                                                        **
     743**                VECTOR, INTVEC                                **
     744**                INTMAT, BIGINTMAT, MATRIX                **
     745**                                                        **
    746746*********************************************************/
    747747
    748748proc mathmlVector(vector v){
    749         int L           = size(v);
    750         matrix m[L][1]  = v;
    751         string S        = mathmlMatrix(m);
     749        int L                 = size(v);
     750        matrix m[L][1]        = v;
     751        string S         = mathmlMatrix(m);
    752752return(S);
    753753}
    754754
    755755proc mathmlIntvec(intvec v){
    756         matrix m = v;
    757         string S = mathmlMatrix(m);
     756        matrix m = v;
     757        string S = mathmlMatrix(m);
    758758return(S);
    759759}
    760760proc mathmlIntmat(intmat M){
    761         matrix m = M;
    762         string S = mathmlMatrix(m);
     761        matrix m = M;
     762        string S = mathmlMatrix(m);
    763763return(S);
    764764}
    765765proc mathmlBigintmat(bigintmat M){
    766         matrix m = M;
    767         string S = mathmlMatrix(m);
     766        matrix m = M;
     767        string S = mathmlMatrix(m);
    768768return(S);
    769769}
     
    792792
    793793/*********************************************************
    794 **                                                      **
    795 **                      View                    **
    796 **                                                      **
     794**                                                        **
     795**                        View                        **
     796**                                                        **
    797797*********************************************************/
    798798
     
    800800
    801801proc viewMathml(string s){
    802         string p = "firefox";
    803         string Sstart   = "<!doctype html><html><head><meta charset=UTF-8><title>MathML Examples</title></head><body>";
    804         string Send     = "</body></html> ";
    805         string S = Sstart + s + Send;   
    806         write(":w singular_mathml.html", S);
    807        
    808         system("sh",p+" singular_mathml.html");
    809 }
    810 
    811 
    812 
    813 
     802        string p = "firefox";
     803        string Sstart         = "<!doctype html><html><head><meta charset=UTF-8><title>MathML Examples</title></head><body>";
     804        string Send        = "</body></html> ";
     805        string S = Sstart + s + Send;
     806        write(":w singular_mathml.html", S);
     807
     808        system("sh",p+" singular_mathml.html");
     809}
     810
     811
     812
     813
  • Singular/dyn_modules/gfanlib/gfan.h

    r412c61 r2bf04b  
    4444class facet
    4545{
    46         private:
    47                 /** \brief Inner normal of the facet, describing it uniquely up to isomorphism */
    48                 int64vec *fNormal;
    49 
    50                 /** \brief An interior point of the facet*/
    51                 int64vec *interiorPoint;
    52 
    53                 /** \brief Universal Cone Number
    54                 * The number of the cone the facet belongs to, Set in getConeNormals()
    55                 */
    56                 int UCN;
    57 
    58                 /** \brief The codim of the facet
    59                 */
    60                 short codim;
    61 
    62                 /** \brief The Groebner basis on the other side of a shared facet
    63                 *
    64                 * In order not to have to compute the flipped GB twice we store the basis we already get
    65                 * when identifying search facets. Thus in the next step of the reverse search we can
    66                 * just copy the old cone and update the facet and the gcBasis.
    67                 * facet::flibGB is set via facet::setFlipGB() and printed via facet::printFlipGB
    68                 */
    69                 ideal flipGB;           //The Groebner Basis on the other side, computed via gcone::flip
    70 
    71         public:
    72                 /** \brief Boolean value to indicate whether a facet is flippable or not
    73                 * This is also used to mark facets that nominally are flippable but which do
    74                 * not intersect with the positive orthant. This check is done in gcone::getCodim2Normals
    75                 */
    76                 bool isFlippable;       //**flippable facet? */
    77                 //bool isIncoming;      //Is the facet incoming or outgoing in the reverse search? No longer in use
    78                 facet *next;            //Pointer to next facet
    79                 facet *prev;            //Pointer to predecessor. Needed for the SearchList in noRevS
    80                 facet *codim2Ptr;       //Pointer to (codim-2)-facet. Bit of recursion here ;-)
    81                 int numCodim2Facets;    //#of (codim-2)-facets of this facet. Set in getCodim2Normals()
    82                 unsigned numRays;       //Number of spanning rays of the facet
    83                 ring flipRing;          //the ring on the other side of the facet
    84 //              int64vec **fRays;
    85 
    86                 /** The default constructor. */
    87                 facet();
    88                 /** Constructor for lower dimensional faces*/
    89                 facet(const int &n);
    90                 /**  The copy constructor */
    91                 facet(const facet& f);
    92                 /** A shallow copy of facets*/
    93                 facet* shallowCopy(const facet& f);
    94                 void shallowDelete();
    95                 /** The default destructor */
    96                 ~facet();
    97                 /** Comparison operator*/
    98 //              inline bool operator==(const facet *f,const facet *g);
    99                 /** \brief Comparison of facets*/
    100 //              inline bool areEqual(facet *f, facet *g);//Now static
    101                 /** Stores the facet normal \param int64vec*/
    102                 inline void setFacetNormal(int64vec *iv);
    103                 /** Returns the facet normal */
    104                 inline int64vec *getFacetNormal() const;
    105                 /** Return a reference to the facet normal*/
    106                 inline const int64vec *getRef2FacetNormal() const;
    107                 /** Method to print the facet normal*/
    108                 inline void printNormal() const;
    109                 /** Store the flipped GB*/
    110                 inline void setFlipGB(ideal I);
    111                 /** Return the flipped GB*/
    112                 inline ideal getFlipGB();
    113                 /** Print the flipped GB*/
    114                 inline void printFlipGB();
    115                 /** Set the UCN */
    116                 inline void setUCN(int n);
    117                 /** \brief Get the UCN
    118                 * Returns the UCN iff this != NULL, else -1
    119                 */
    120                 inline int getUCN();
    121                 /** Store an interior point of the facet */
    122                 inline void setInteriorPoint(int64vec *iv);
    123                 inline int64vec *getInteriorPoint();
    124                 inline const int64vec *getRef2InteriorPoint();
    125                 /** \brief Debugging function
    126                 * prints the facet normal an all (codim-2)-facets that belong to it
    127                 */
    128                 volatile void fDebugPrint();
    129                 friend class gcone;
     46        private:
     47                /** \brief Inner normal of the facet, describing it uniquely up to isomorphism */
     48                int64vec *fNormal;
     49
     50                /** \brief An interior point of the facet*/
     51                int64vec *interiorPoint;
     52
     53                /** \brief Universal Cone Number
     54                * The number of the cone the facet belongs to, Set in getConeNormals()
     55                */
     56                int UCN;
     57
     58                /** \brief The codim of the facet
     59                */
     60                short codim;
     61
     62                /** \brief The Groebner basis on the other side of a shared facet
     63                *
     64                * In order not to have to compute the flipped GB twice we store the basis we already get
     65                * when identifying search facets. Thus in the next step of the reverse search we can
     66                * just copy the old cone and update the facet and the gcBasis.
     67                * facet::flibGB is set via facet::setFlipGB() and printed via facet::printFlipGB
     68                */
     69                ideal flipGB;                //The Groebner Basis on the other side, computed via gcone::flip
     70
     71        public:
     72                /** \brief Boolean value to indicate whether a facet is flippable or not
     73                 * This is also used to mark facets that nominally are flippable but which do
     74                 * not intersect with the positive orthant. This check is done in gcone::getCodim2Normals
     75                */
     76                bool isFlippable;        //**flippable facet? */
     77                //bool isIncoming;        //Is the facet incoming or outgoing in the reverse search? No longer in use
     78                facet *next;                //Pointer to next facet
     79                facet *prev;                //Pointer to predecessor. Needed for the SearchList in noRevS
     80                facet *codim2Ptr;        //Pointer to (codim-2)-facet. Bit of recursion here ;-)
     81                int numCodim2Facets;        //#of (codim-2)-facets of this facet. Set in getCodim2Normals()
     82                unsigned numRays;        //Number of spanning rays of the facet
     83                ring flipRing;                //the ring on the other side of the facet
     84//                 int64vec **fRays;
     85
     86                /** The default constructor. */
     87                facet();
     88                /** Constructor for lower dimensional faces*/
     89                facet(const int &n);
     90                /**  The copy constructor */
     91                facet(const facet& f);
     92                /** A shallow copy of facets*/
     93                facet* shallowCopy(const facet& f);
     94                void shallowDelete();
     95                /** The default destructor */
     96                ~facet();
     97                /** Comparison operator*/
     98//                 inline bool operator==(const facet *f,const facet *g);
     99                /** \brief Comparison of facets*/
     100//                 inline bool areEqual(facet *f, facet *g);//Now static
     101                /** Stores the facet normal \param int64vec*/
     102                inline void setFacetNormal(int64vec *iv);
     103                /** Returns the facet normal */
     104                inline int64vec *getFacetNormal() const;
     105                /** Return a reference to the facet normal*/
     106                inline const int64vec *getRef2FacetNormal() const;
     107                /** Method to print the facet normal*/
     108                inline void printNormal() const;
     109                /** Store the flipped GB*/
     110                inline void setFlipGB(ideal I);
     111                /** Return the flipped GB*/
     112                inline ideal getFlipGB();
     113                /** Print the flipped GB*/
     114                inline void printFlipGB();
     115                /** Set the UCN */
     116                inline void setUCN(int n);
     117                /** \brief Get the UCN
     118                * Returns the UCN iff this != NULL, else -1
     119                */
     120                inline int getUCN();
     121                /** Store an interior point of the facet */
     122                inline void setInteriorPoint(int64vec *iv);
     123                inline int64vec *getInteriorPoint();
     124                inline const int64vec *getRef2InteriorPoint();
     125                /** \brief Debugging function
     126                * prints the facet normal an all (codim-2)-facets that belong to it
     127                */
     128                volatile void fDebugPrint();
     129                friend class gcone;
    130130};
    131131
     
    140140class gcone
    141141{
    142         private:
    143                 ideal inputIdeal;       //the original
    144                 ring baseRing;          //the basering of the cone
    145                 int64vec *ivIntPt;      //an interior point of the cone
    146                 int UCN;                //unique number of the cone
    147                 int pred;               //UCN of the cone this one is derived from
    148                 static int counter;
    149 
    150         public:
    151                 /** \brief Pointer to the first facet */
    152                 facet *facetPtr;        //Will hold the adress of the first facet; set by gcone::getConeNormals
     142        private:
     143                ideal inputIdeal;        //the original
     144                ring baseRing;                //the basering of the cone
     145                int64vec *ivIntPt;        //an interior point of the cone
     146                int UCN;                //unique number of the cone
     147                int pred;                //UCN of the cone this one is derived from
     148                 static int counter;
     149
     150        public:
     151                /** \brief Pointer to the first facet */
     152                facet *facetPtr;        //Will hold the adress of the first facet; set by gcone::getConeNormals
    153153#ifdef gfanp
    154                 static float time_getConeNormals;
    155                 static float time_getCodim2Normals;
    156                 static float t_getExtremalRays;
    157                 static float t_ddPolyh;
    158                 static float time_flip;
    159                 static float time_flip2;
    160                 static float t_areEqual;
    161                 static float t_ffG;
    162                 static float t_markings;
    163                 static float t_dd;
    164                 static float t_kStd;
    165                 static float time_enqueue;
    166                 static float time_computeInv;
    167                 static float t_ddMC;
    168                 static float t_mI;
    169                 static float t_iP;
    170                 static float t_isParallel;
    171                 static unsigned parallelButNotEqual;
    172                 static unsigned numberOfFacetChecks;
    173 #endif
    174                 /** Matrix to contain the homogeneity/lineality space */
    175                 static dd_MatrixPtr dd_LinealitySpace;
    176                 static int lengthOfSearchList;
    177                 /** Maximum size of the searchlist*/
    178                 static int maxSize;
    179                 /** is the ideal homogeneous? */
    180                 static bool hasHomInput;
    181                 /** # of variables in the ring */
    182                 static int numVars;             //#of variables in the ring
    183                 /** The hilbert function - for the homogeneous case*/
    184                 static int64vec *hilbertFunction;
    185                 /** The zero vector. Needed in case of fNormal mismatch*/
    186                 static int64vec *ivZeroVector;
    187 
    188                 /** # of facets of the cone
    189                 * This value is set by gcone::getConeNormals
    190                 */
    191                 int numFacets;          //#of facets of the cone
    192 
    193                 /**
    194                 * At least as a workaround we store the irredundant facets of a matrix here.
    195                 * This is needed to compute an interior points of a cone. Note that there
    196                 * will be non-flippable facets in it!
    197                 */
    198                 dd_MatrixPtr ddFacets;  //Matrix to store irredundant facets of the cone
    199 
    200                 /** Array of intvecs representing the rays of the cone*/
    201                 int64vec **gcRays;
    202                 unsigned numRays;       //#rays of the cone
    203                 /** Contains the Groebner basis of the cone. Is set by gcone::getGB(ideal I)*/
    204                 ideal gcBasis;          //GB of the cone, set by gcone::getGB();
    205                 gcone *next;            //Pointer to next cone
    206                 gcone *prev;
    207 
    208                 gcone();
    209                 gcone(ring r, ideal I);
    210                 gcone(const gcone& gc, const facet &f);
    211                 ~gcone();
    212                 inline int getCounter();
    213                 inline ring getBaseRing();
    214                 inline ring getRef2BaseRing();
    215                 inline void setBaseRing(ring r);
    216                 inline void setIntPoint(int64vec *iv);
    217                 inline int64vec *getIntPoint(bool shallow=FALSE);
    218                 inline void showIntPoint();
    219                 inline void setNumFacets();
    220                 inline int getNumFacets();
    221                 inline int getUCN();
    222                 inline int getPredUCN();
    223                 volatile void showFacets(short codim=1);
    224 //              volatile void showSLA(facet &f);
    225 //              void idDebugPrint(const ideal &I);
    226 //              void invPrint(const ideal &I);
    227 //              bool isMonomial(const ideal &I);
    228 //              int64vec *ivNeg(const int64vec *iv);
    229 //              inline int dotProduct(int64vec &iva, int64vec &ivb);
    230 //              inline int dotProduct(const int64vec &iva, const int64vec &ivb);
    231 //              inline bool isParallel(const int64vec &a, const int64vec &b);
    232                 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE);
    233 //              inline int intgcd(const int &a, const int &b);
    234                 void writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE);
    235                 void readConeFromFile(int gcNum, gcone *gc);
    236                 int64vec f2M(gcone *gc, facet *f, int n=1);
    237 //              inline void sortRays(gcone *gc);
    238                 //The real stuff
    239                 void getConeNormals(const ideal &I, bool compIntPoint=FALSE);
    240                 void getCodim2Normals(const gcone &gc);
    241                 void getExtremalRays(const gcone &gc);
    242                 void orderRays();
    243                 void flip(ideal gb, facet *f);
    244                 void flip2(const ideal &gb, facet *f);
    245                 void computeInv(const ideal &gb, ideal &inv, const int64vec &f);
    246                 //poly restOfDiv(poly const &f, ideal const &I); removed with r12286
    247                 inline ideal ffG(const ideal &H, const ideal &G);
    248                 inline void getGB(ideal const &inputIdeal);
    249                 void interiorPoint( dd_MatrixPtr &M, int64vec &iv);//used from flip and optionally from getConeNormals
    250 //              void interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010, again removed Mar 16th, 2010
    251                 void preprocessInequalities(dd_MatrixPtr &M);
    252                 ring rCopyAndAddWeight(const ring &r, int64vec *ivw);
    253                 ring rCopyAndAddWeight2(const ring &, const int64vec *, const int64vec *);
    254 //              ring rCopyAndChangeWeight(const ring &r, int64vec *ivw);        //NOTE remove
    255 //              void reverseSearch(gcone *gcAct); //NOTE both removed from r12286
    256 //              bool isSearchFacet(gcone &gcTmp, facet *testfacet); //NOTE remove
    257                 void makeInt(const dd_MatrixPtr &M, const int line, int64vec &n);
    258 //              void normalize();//NOTE REMOVE
    259                 facet * enqueueNewFacets(facet *f);
    260                 facet * enqueue2(facet *f);
    261 //              dd_MatrixPtr facets2Matrix(const gcone &gc);//NOTE remove
    262                 /** Compute the lineality space Ax=0 and return it as dd_MatrixPtr dd_LinealitySpace*/
    263                 dd_MatrixPtr computeLinealitySpace();
    264                 inline bool iv64isStrictlyPositive(const int64vec *);
    265                 /** Exchange 2 ordertype_a by just 1 */
    266                 void replaceDouble_ringorder_a_ByASingleOne();
    267 //              static void gcone::idPrint(ideal &I);
    268 //              friend class facet;
     154                static float time_getConeNormals;
     155                static float time_getCodim2Normals;
     156                static float t_getExtremalRays;
     157                static float t_ddPolyh;
     158                static float time_flip;
     159                static float time_flip2;
     160                static float t_areEqual;
     161                static float t_ffG;
     162                static float t_markings;
     163                static float t_dd;
     164                static float t_kStd;
     165                static float time_enqueue;
     166                static float time_computeInv;
     167                static float t_ddMC;
     168                static float t_mI;
     169                static float t_iP;
     170                static float t_isParallel;
     171                static unsigned parallelButNotEqual;
     172                static unsigned numberOfFacetChecks;
     173#endif
     174                /** Matrix to contain the homogeneity/lineality space */
     175                static dd_MatrixPtr dd_LinealitySpace;
     176                static int lengthOfSearchList;
     177                /** Maximum size of the searchlist*/
     178                static int maxSize;
     179                /** is the ideal homogeneous? */
     180                static bool hasHomInput;
     181                /** # of variables in the ring */
     182                static int numVars;                //#of variables in the ring
     183                /** The hilbert function - for the homogeneous case*/
     184                static int64vec *hilbertFunction;
     185                /** The zero vector. Needed in case of fNormal mismatch*/
     186                static int64vec *ivZeroVector;
     187
     188                /** # of facets of the cone
     189                * This value is set by gcone::getConeNormals
     190                */
     191                int numFacets;                //#of facets of the cone
     192
     193                /**
     194                * At least as a workaround we store the irredundant facets of a matrix here.
     195                * This is needed to compute an interior points of a cone. Note that there
     196                * will be non-flippable facets in it!
     197                */
     198                dd_MatrixPtr ddFacets;        //Matrix to store irredundant facets of the cone
     199
     200                /** Array of intvecs representing the rays of the cone*/
     201                int64vec **gcRays;
     202                unsigned numRays;        //#rays of the cone
     203                /** Contains the Groebner basis of the cone. Is set by gcone::getGB(ideal I)*/
     204                ideal gcBasis;                //GB of the cone, set by gcone::getGB();
     205                gcone *next;                //Pointer to next cone
     206                gcone *prev;
     207
     208                gcone();
     209                gcone(ring r, ideal I);
     210                gcone(const gcone& gc, const facet &f);
     211                ~gcone();
     212                inline int getCounter();
     213                inline ring getBaseRing();
     214                inline ring getRef2BaseRing();
     215                inline void setBaseRing(ring r);
     216                inline void setIntPoint(int64vec *iv);
     217                inline int64vec *getIntPoint(bool shallow=FALSE);
     218                inline void showIntPoint();
     219                inline void setNumFacets();
     220                inline int getNumFacets();
     221                inline int getUCN();
     222                inline int getPredUCN();
     223                volatile void showFacets(short codim=1);
     224//                 volatile void showSLA(facet &f);
     225//                 void idDebugPrint(const ideal &I);
     226//                 void invPrint(const ideal &I);
     227//                 bool isMonomial(const ideal &I);
     228//                 int64vec *ivNeg(const int64vec *iv);
     229//                 inline int dotProduct(int64vec &iva, int64vec &ivb);
     230//                 inline int dotProduct(const int64vec &iva, const int64vec &ivb);
     231//                 inline bool isParallel(const int64vec &a, const int64vec &b);
     232                void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE);
     233//                 inline int intgcd(const int &a, const int &b);
     234                void writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE);
     235                void readConeFromFile(int gcNum, gcone *gc);
     236                int64vec f2M(gcone *gc, facet *f, int n=1);
     237//                 inline void sortRays(gcone *gc);
     238                //The real stuff
     239                void getConeNormals(const ideal &I, bool compIntPoint=FALSE);
     240                void getCodim2Normals(const gcone &gc);
     241                void getExtremalRays(const gcone &gc);
     242                void orderRays();
     243                void flip(ideal gb, facet *f);
     244                void flip2(const ideal &gb, facet *f);
     245                void computeInv(const ideal &gb, ideal &inv, const int64vec &f);
     246                //poly restOfDiv(poly const &f, ideal const &I); removed with r12286
     247                inline ideal ffG(const ideal &H, const ideal &G);
     248                inline void getGB(ideal const &inputIdeal);
     249                void interiorPoint( dd_MatrixPtr &M, int64vec &iv);//used from flip and optionally from getConeNormals
     250//                 void interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010, again removed Mar 16th, 2010
     251                void preprocessInequalities(dd_MatrixPtr &M);
     252                ring rCopyAndAddWeight(const ring &r, int64vec *ivw);
     253                ring rCopyAndAddWeight2(const ring &, const int64vec *, const int64vec *);
     254//                 ring rCopyAndChangeWeight(const ring &r, int64vec *ivw);        //NOTE remove
     255//                 void reverseSearch(gcone *gcAct); //NOTE both removed from r12286
     256//                 bool isSearchFacet(gcone &gcTmp, facet *testfacet); //NOTE remove
     257                void makeInt(const dd_MatrixPtr &M, const int line, int64vec &n);
     258//                 void normalize();//NOTE REMOVE
     259                facet * enqueueNewFacets(facet *f);
     260                facet * enqueue2(facet *f);
     261//                 dd_MatrixPtr facets2Matrix(const gcone &gc);//NOTE remove
     262                /** Compute the lineality space Ax=0 and return it as dd_MatrixPtr dd_LinealitySpace*/
     263                dd_MatrixPtr computeLinealitySpace();
     264                inline bool iv64isStrictlyPositive(const int64vec *);
     265                /** Exchange 2 ordertype_a by just 1 */
     266                void replaceDouble_ringorder_a_ByASingleOne();
     267//                 static void gcone::idPrint(ideal &I);
     268//                 friend class facet;
    269269};
    270270lists lprepareResult(gcone *gc, const int n);
  • Singular/links/ndbm.h

    r412c61 r2bf04b  
    3939 * SUCH DAMAGE.
    4040 *
    41  *      @(#)ndbm.h      5.1 (Berkeley) 5/30/85
     41 *        @(#)ndbm.h        5.1 (Berkeley) 5/30/85
    4242 *
    4343 * Par. 3 removed due to a license change (1999)
     
    5353
    5454typedef struct {
    55         int     dbm_dirf;               /* open directory file */
    56         int     dbm_pagf;               /* open page file */
    57         int     dbm_flags;              /* flags, see below */
    58         long    dbm_maxbno;             /* last ``bit'' in dir file */
    59         long    dbm_bitno;              /* current bit number */
    60         long    dbm_hmask;              /* hash mask */
    61         long    dbm_blkptr;             /* current block for dbm_nextkey */
    62         int     dbm_keyptr;             /* current key for dbm_nextkey */
    63         long    dbm_blkno;              /* current page to read/write */
    64         long    dbm_pagbno;             /* current page in pagbuf */
    65         char    dbm_pagbuf[PBLKSIZ];    /* page file block buffer */
    66         long    dbm_dirbno;             /* current block in dirbuf */
    67         char    dbm_dirbuf[DBLKSIZ];    /* directory file block buffer */
     55        int        dbm_dirf;                /* open directory file */
     56        int        dbm_pagf;                /* open page file */
     57        int        dbm_flags;                /* flags, see below */
     58        long        dbm_maxbno;                /* last ``bit'' in dir file */
     59        long        dbm_bitno;                /* current bit number */
     60        long        dbm_hmask;                /* hash mask */
     61        long        dbm_blkptr;                /* current block for dbm_nextkey */
     62        int        dbm_keyptr;                /* current key for dbm_nextkey */
     63        long        dbm_blkno;                /* current page to read/write */
     64        long        dbm_pagbno;                /* current page in pagbuf */
     65        char        dbm_pagbuf[PBLKSIZ];        /* page file block buffer */
     66        long        dbm_dirbno;                /* current block in dirbuf */
     67        char        dbm_dirbuf[DBLKSIZ];        /* directory file block buffer */
    6868} DBM;
    6969
    70 #define _DBM_RDONLY     0x01    /* data base open read-only */
    71 #define _DBM_IOERR      0x02    /* data base I/O error */
     70#define _DBM_RDONLY        0x01        /* data base open read-only */
     71#define _DBM_IOERR        0x02        /* data base I/O error */
    7272
    73 #define dbm_rdonly(db)  ((db)->dbm_flags & _DBM_RDONLY)
     73#define dbm_rdonly(db)        ((db)->dbm_flags & _DBM_RDONLY)
    7474
    75 #define dbm_error(db)   ((db)->dbm_flags & _DBM_IOERR)
    76         /* use this one at your own risk! */
    77 #define dbm_clearerr(db)        ((db)->dbm_flags &= ~_DBM_IOERR)
     75#define dbm_error(db)        ((db)->dbm_flags & _DBM_IOERR)
     76        /* use this one at your own risk! */
     77#define dbm_clearerr(db)        ((db)->dbm_flags &= ~_DBM_IOERR)
    7878
    7979/* for flock(2) and fstat(2) */
    80 #define dbm_dirfno(db)  ((db)->dbm_dirf)
    81 #define dbm_pagfno(db)  ((db)->dbm_pagf)
     80#define dbm_dirfno(db)        ((db)->dbm_dirf)
     81#define dbm_pagfno(db)        ((db)->dbm_pagf)
    8282
    8383typedef struct {
    84         char    *dptr;
    85         int     dsize;
     84        char        *dptr;
     85        int        dsize;
    8686} datum;
    8787
     
    8989 * flags to dbm_store()
    9090 */
    91 #define DBM_INSERT      0
    92 #define DBM_REPLACE     1
     91#define DBM_INSERT        0
     92#define DBM_REPLACE        1
    9393
    94 DBM     *dbm_open(char *file, int flags, int mode);
    95 void    dbm_close(DBM *db);
    96 datum   dbm_fetch(register DBM *db, datum key);
    97 datum   dbm_firstkey(DBM *db);
    98 datum   dbm_nextkey(register DBM *db);
    99 long    dbm_forder(register DBM *db, datum key);
    100 int     dbm_delete(register DBM *db, datum key);
    101 int     dbm_store(register DBM *db, datum key, datum dat, int replace);
     94DBM        *dbm_open(char *file, int flags, int mode);
     95void        dbm_close(DBM *db);
     96datum        dbm_fetch(register DBM *db, datum key);
     97datum        dbm_firstkey(DBM *db);
     98datum        dbm_nextkey(register DBM *db);
     99long        dbm_forder(register DBM *db, datum key);
     100int        dbm_delete(register DBM *db, datum key);
     101int        dbm_store(register DBM *db, datum key, datum dat, int replace);
    102102
    103103#endif /* NDBM_H */
  • Singular/links/sing_dbm.cc

    r412c61 r2bf04b  
    122122    {
    123123      if (!SI_LINK_CLOSE_P(l))
    124         {
    125           if (!dbClose(l)) {Print("cannot close link!\n");}
    126         }
     124      {
     125        if (!dbClose(l)) {Print("cannot close link!\n");}
     126      }
    127127      //(SI_LINK_CLOSE_P(l)) automatically
    128128      if (dbOpen(l, SI_LINK_READ)) return NULL;
     
    160160      if (db->actual.dptr==NULL)
    161161      {
    162         db->actual=gdbm_firstkey(db->db);
     162        db->actual=gdbm_firstkey(db->db);
    163163      }
    164164      d_key = gdbm_nextkey(db->db,db->actual);
     
    215215    {
    216216      if (!SI_LINK_W_OPEN_P(l)) //exceptions
    217         {
    218           if (!SI_LINK_CLOSE_P(l))
    219             {
    220               if (!dbClose(l)) {Print("close error\n");};
    221             }
    222           if (!dbOpen(l,SI_LINK_WRITE)) {Print("open_for_write error\n");}
    223         }
     217      {
     218        if (!SI_LINK_CLOSE_P(l))
     219        {
     220          if (!dbClose(l)) {Print("close error\n");};
     221        }
     222        if (!dbOpen(l,SI_LINK_WRITE)) {Print("open_for_write error\n");}
     223      }
    224224    }
    225225
     
    238238        ret  = gdbm_store(db->db, d_key, d_value, GDBM_REPLACE);
    239239//         db->actual=d_key;
    240         if (ret==-1) {Print("reader calls gdbm_store!");}
     240        if (ret==-1) {Print("reader calls gdbm_store!");}
    241241        if (ret==0)
    242242          { b=FALSE; }
     
    247247          {
    248248            Werror("GDBM link I/O error: '%s' ", gdbm_errno);
    249             //            Print(gdbm_strerror(gdbm_errno));
     249            //            Print(gdbm_strerror(gdbm_errno));
    250250            //dbm_clearerr(db->db);
    251             //            gdbm_errno=0;
     251            //            gdbm_errno=0;
    252252          }
    253253        }
  • Singular/pyobject_setup.cc

    r412c61 r2bf04b  
    2828  assume(bbx != NULL);
    2929  return (pyobject_load() || (bbx->blackbox_Init == pyobject_autoload)?
    30           NULL: bbx->blackbox_Init(bbx));
     30    NULL: bbx->blackbox_Init(bbx));
    3131}
    3232
  • Tst/Long/classify_l.tst

    r412c61 r2bf04b  
    111111classify(f);
    112112
    113 f=(x+3y3)*(x3+xy18+y26); // Z[3,67], step 44,   k=3, i=5
     113f=(x+3y3)*(x3+xy18+y26); // Z[3,67], step 44, k=3, i=5
    114114classify(f);
    115115
  • Tst/Long/nfmodstd_l.tst

    r412c61 r2bf04b  
    1111minpoly = a^2+1;
    1212ideal HJa=(2*a+3)*x*y^4*z^2 + (a+2)*x^2*y^3*z*w-x^2*y^3*z*w + 2*x*y*z^2*w^3 + (7*a-1)*y^3*w^4,
    13           2*x^2*y^4*z + x^2*y*z^2*w^2-a*x*y^2*z^2*w^2 + (a+11)*x^2*y*z*w^3 -12*x*w^6 + 12*y*w^6,
    14           2*y^5*z + x^2*y^2*z*w-x*y^3*z*w -x*y^3*w^2 +a*y^4*w^2 + 2*y^2*z*w^3,
    15           3*x*y^4*z^3 + x^2*y^2*z*w^3-x*y^3*z*w^3 +(4+a)*y^3*z^2*w^3 +3*x*y*z^3*w^3 +4*a*z^2*w^6
    16           -x*w^7+y*w^7;
     13          2*x^2*y^4*z + x^2*y*z^2*w^2-a*x*y^2*z^2*w^2 + (a+11)*x^2*y*z*w^3 -12*x*w^6 + 12*y*w^6,
     14          2*y^5*z + x^2*y^2*z*w-x*y^3*z*w -x*y^3*w^2 +a*y^4*w^2 + 2*y^2*z*w^3,
     15          3*x*y^4*z^3 + x^2*y^2*z*w^3-x*y^3*z*w^3 +(4+a)*y^3*z^2*w^3 +3*x*y*z^3*w^3 +4*a*z^2*w^6
     16          -x*w^7+y*w^7;
    1717
    1818 tst_test_nfmodstd(HJa);
     
    2121minpoly = a^4+a^3+a^2+a+1;
    2222ideal I1=(8/a^2)*x^2*y^2+5*x*y^3+(3-a^2)*x^3*z + x^2*y*z,
    23           x^5+ 2*y^3*z^2+ 13*y^2*z^3+ 5*y*z^4,
    24           8*x^3+(12*a+a^2)*y^3 +x*z^2+3,
    25           (7*a^2-a)*x^2*y^4+18*y^3*z^2+y^3*z^3;
     23          x^5+ 2*y^3*z^2+ 13*y^2*z^3+ 5*y*z^4,
     24          8*x^3+(12*a+a^2)*y^3 +x*z^2+3,
     25          (7*a^2-a)*x^2*y^4+18*y^3*z^2+y^3*z^3;
    2626tst_test_nfmodstd(I1);
    2727
    2828ideal HUa = a*x+(a-1)*y+(a+2)*w+u,x*y+(a-1)*y*z+z*w + (a+2)*x*w+a*w*u,
    29             a*x*y*z+(a+5)*y*z*w+a*x*y*u+(a+2)*x*w*u+a*z*w*u,(a-11)*x*y*z*w+(a+5)*x*y*z*u+a*x*y*w*u +
    30             a*x*z*w*u+a*y*z*w*u,(a + 3)*x*y*z*w*u -(a+23)*v^5;
     29            a*x*y*z+(a+5)*y*z*w+a*x*y*u+(a+2)*x*w*u+a*z*w*u,(a-11)*x*y*z*w+(a+5)*x*y*z*u+a*x*y*w*u +
     30            a*x*z*w*u+a*y*z*w*u,(a + 3)*x*y*z*w*u -(a+23)*v^5;
    3131tst_test_nfmodstd(HUa);
    3232kill r;
     
    3434minpoly = a^3 + 5a + 7;
    3535ideal I6a=a*x+(a+2)*y+z+w+u+v,x*y+y*z+z*w+w*u+(a+3)*x*v+u*v,x*y*z+y*z*w
    36           + (a+1)*z*w*u+x*y*v+x*u*v+w*u*v,(a-1)*x*y*z*w + y*z*w*u +x*y*z*v +x*y*u*v+ x*w*u*v+ z*w*u*v,
    37           x*y*z*w*u+(a+1)*x*y*z*w*v+x*y*z*u*v+x*y*w*u*v+x*z*w*u*v+y*z*w*u*v,x*y*z*w*u*v-a+2;
     36          + (a+1)*z*w*u+x*y*v+x*u*v+w*u*v,(a-1)*x*y*z*w + y*z*w*u +x*y*z*v +x*y*u*v+ x*w*u*v+ z*w*u*v,
     37          x*y*z*w*u+(a+1)*x*y*z*w*v+x*y*z*u*v+x*y*w*u*v+x*z*w*u*v+y*z*w*u*v,x*y*z*w*u*v-a+2;
    3838tst_test_nfmodstd(I6a);
    3939kill r;
     
    4141minpoly = a^3+2;
    4242ideal I= (2*w*y-2*a+3)*x-z*y^2-z,2*z*x^3 + (4*w*y + 5)*x^2 + (4*z*y^2 + 4*z)*x +
    43             2*w*y^3-10*y^2 - 10*w*y,(w^2-a^2+2*a)*x + 11*w*y*z-2*z, (-z^2 + 4*w^2+a^2+2)*x*z
    44             + (4*w*z^2 + 2*w^3-10*w)*y + 4*z^2-10*w^2 + a^2+a;
     43            2*w*y^3-10*y^2 - 10*w*y,(w^2-a^2+2*a)*x + 11*w*y*z-2*z, (-z^2 + 4*w^2+a^2+2)*x*z
     44            + (4*w*z^2 + 2*w^3-10*w)*y + 4*z^2-10*w^2 + a^2+a;
    4545tst_test_nfmodstd(I);
    4646ideal I1= (2*w*y-(2*a+3)*z^2)*x-z*y^2-z^2*x,
     
    5353minpoly = a^3 + 2a + 11;
    5454ideal Ua = (a-x)^2 + (a-1)^2*y + z + (a+2)*w + u,x*y + (a-1)*y*z + z*w +
    55           (a + 2)*x*w + a*w*u,a*x*y*z + (a + 5)*y*z*w + a*x*y*u + (a+2)*x*w*u + a*z*w*u,
    56           (a-11)*x*y*z*w + (a + 5)*x*y*z*u + a*x*y*w*u + a*x*z*w*u + a*y*z*w*u,(a + 3)*x*y*z*w*u + a+23;
     55          (a + 2)*x*w + a*w*u,a*x*y*z + (a + 5)*y*z*w + a*x*y*u + (a+2)*x*w*u + a*z*w*u,
     56          (a-11)*x*y*z*w + (a + 5)*x*y*z*u + a*x*y*w*u + a*x*z*w*u + a*y*z*w*u,(a + 3)*x*y*z*w*u + a+23;
    5757tst_test_nfmodstd(Ua);
    5858kill r;
  • Tst/Long/stdZtests.tst

    r412c61 r2bf04b  
    88reduce(I,gI);
    99ideal ggI = std(gI);
    10 size(gI);size(ggI); 
     10size(gI);size(ggI);
    1111ideal gJ =  std(J);
    1212gJ;
    1313reduce(J,gJ);
    1414ideal ggJ = std(gJ);
    15 size(gJ);size(ggJ); 
     15size(gJ);size(ggJ);
    1616
    1717tst_status(1);
  • Tst/New/gndlib.tst

    r412c61 r2bf04b  
    4545  y3 = 1+a1*x2+a1*x2^2+a3*x1*x2^4+a4*x1*x2^6;
    4646  y4 = 1+a4*x2+(a2^2+a3)*x2^10+(a1+a2+a3+a4)*x1*x2^11;
    47  
     47
    4848  list as,xs;
    4949  if(nra != 0)
     
    193193  y3 = 1+a1*x2+(a2+a3+a4)*x2^2;
    194194  y4 = 1+a2*x2^2;
    195  
     195
    196196  list as,xs;
    197197  if(nra != 0)
     
    231231  y3 = 1+a1*x2;
    232232  y4 = 1+a2*x2^2;
    233  
     233
    234234  list as,xs;
    235235  if(nra != 0)
  • Tst/New/hilblocinhom.res.gz.uu

    r412c61 r2bf04b  
    1 begin 664 hilblocinhom.res.gz
    2 M'XL("&:MI%$``VAI;&)L;V-I;FAO;2YR97,`E91+;YM`$(#/\:^86CU`3,B^
    3 M,!`7#E4OD:H>FMXBJW)L7%;:0L1L7)LH_[U#FBQ(?LA%6G9W9G8>S,?>_?AR
    4 M^PT`>`Y?;S_#V*(-C7X8ST9W;QJ1`PE_ZDI;SY^-NAGR'$IM'DR]U%59_PZK
    5 MXD^(=F'=(9F#6ZL0ZD>KZ\I[;&KK]YZC'!I=_8+O&0N\;;`+6C]88:^?YJ!7
    6 MQ<*`SF`K=^UDRUFPW8E6T+N5O6'\;H@Z0[OR-`6YYTPE41S=B'GD"1^1,^2"
    7 MID2HJQ%ELGI:6E@VVA8-Y7;#8%DN=#60*.<_(?^5W11+V&1=W1[J@`\*25U\
    8 M_!<_V)S(H"S/#-^%*AH+2(("!RKQ'IFS'-9UXU%V8#(^,Y\RU&U!^?DS,YGX
    9 MSHZ'</'L=H)V>DU6]V;^(4.DJ3>-2'GQ/%XO#!;CV8N3IR1W.\'[!@MRY];R
    10 M2+.%.M!L0\V^OH;+2VB*5;$FM#H#VKM3T0$$WAB@I=Q-IZ\H3%K.^E#34SCP
    11 M.6==-^(4DYA:0CUA@D:*/(Y#Y&F"@D6>\E'$DD8JTNA*3M,K&=-(V2%VY%[S
    12 M>.JRB8_`LU?X9EAX<AJI_ZNB[)YS\SY*7>222\^C3K(A=9*?H$ZJP]3)Y)6Z
    13 GO6]E!M]*L9Y%Q7L6%7'9W5S=Q?2$WN"'570]?1S]!<Y0$'[[!```
     1begin 640 hilblocinhom.res.gz
     2M'XL("&9X1%8``VAI;&)L;V-I;FAO;2YR97,`E51-;YM`$+W[5TRM'B#&9#_X
     3MVKIPJ'J)5/70]%95E0.XK+2%B-FX-E'^>X<V`53CRD5:]F-FY[WE/?;V\_N;
     4MCP#`,_AP\PZ6%JUO]-URL[A]CH@,:/&;KK5UW,VB[R'+H-+FSC2YKJOFAU^7
     5M/WVT6SMLDAD,X\"'YM[JIG;NV\:Z8^4P@U;7W^%3RCSGX!V]SO4*'.-1!KHH
     6MMP9T"@=Y[%8'SKS#472"WIT<$^.71-0IVL+1!!(ZPD7D#+F@+A'!>D'PQ4-N
     7M(6^U+5LB](9!7FUU/5D)AJ()%:WMOLQAG_:'=5![?,)>#:#X!]3;_PU;51=B
     8M]O7+U@+20HF3D'B!XRR#7=,Z1`E,RC?F;8JZ*XF4NS&KE3OD<1\>AXGPB:C>
     9M4=87\_55BDC=F!KTT<?E;FNP7&Z>AO7(AW$2CTKRQ!_'ZHRJ@LVH:DC5ZVNX
     10MNH*V+,H=>:A/H/FPB\]H_2PV#>4QBGYKONHX&Z'$C.Z<]0K$"I.89"`=F*"F
     11MD,>QCUPE*%CH!"Z*6%)30H5K&:FUC*DI-F<2>2(85P,%><8E)Z?=3T\;S'KG
     12M?ZA7_7,IV;/V"@=&X67V$M'$7B+^E[V$FK>7Y+V]3KZ/F7P?*4;323F:3I)C
     138^[NHOVH>T)G\C9+XOU[\`OV(#`O-!```
    1414`
    1515end
  • Tst/New/hilblocinhom.tst

    r412c61 r2bf04b  
    99ideal ss=std(i,v);
    1010for(int l=1;l<=size(si);l++)
    11         {
    12         if(si[l]!=ss[l])
    13                 {"false";}
    14         }
     11{
     12  if(si[l]!=ss[l])
     13  {"false";}
     14}
    1515
    1616
     
    2222ideal ss=std(i,v);
    2323for(int l=1;l<=size(si);l++)
    24         {
    25         if(si[l]!=ss[l])
    26                 {"false";}
    27         }
     24{
     25  if(si[l]!=ss[l])
     26  {"false";}
     27}
    2828
    2929
  • Tst/New/stdZtests.tst

    r412c61 r2bf04b  
    159159reduce(J,gJ);
    160160kill rng;
    161        
     161
    162162ring rng = (integer),(x,y,z),(ls(3),C);
    163163ideal I = 7*x*z+3*x*z^2-x^2,4*z+6*z^2+2*y;
     
    168168ideal gJ =  std(J);
    169169gJ;
    170 reduce(J,gJ);     
     170reduce(J,gJ);
    171171kill rng;
    172172
     
    354354ideal g= std(inI);
    355355reduce(inI,g);
    356 /// 
     356///
    357357ring rng = (integer),(x,y,z),(ws(-1,-1,-1),C);
    358358ideal I  = 6yz-6,6xy-6yz-8y;
     
    383383
    384384ring r=integer,(t,x(1..4)),ws(1,-1,-11,-3,-19);
    385 ideal inJ = 
     385ideal inJ =
    386386 3,
    387387 t*x(3)*x(4)+2*t*x(1)*x(2),
    388388 t*x(1)*x(2)^2+2*t^3*x(1)*x(2)*x(3),
    389389 x(1)^2*x(2)*x(3)*x(4)+2*t^2*x(1)^3*x(2)*x(3);
    390 ideal J = 
     390ideal J =
    391391 x(1)^2*x(2)*x(3)*x(4)-t*x(1)^2*x(2)^3+5*t*x(1)^2*x(2)*x(3)*x(4)+16*t^3*x(1)*x(2)*x(3)^2*x(4)-2*x(1)^3*x(2)^2-1536*x(1)^3*x(3)*x(4)+32*t^2*x(1)^2*x(3)^2*x(4),
    392392 t*x(1)*x(2)^2+2*x(1)^2*x(2)+2*t^3*x(1)*x(2)*x(3)-192*x(1)^3+4*t^2*x(1)^2*x(3),
     
    469469std(J2);
    470470kill r;
    471  
     471
    472472//  Infinite reduction small example
    473473
     
    477477gi;
    478478reduce(i,gi);
    479 kill r; 
     479kill r;
    480480
    481481//  Intersect with the elimination takes for ever. With the module is immediate
     
    488488I_J;
    489489kill rng;
    490  
     490
    491491//  Github Adi #61
    492492
     
    495495qring QR = QQQ;
    496496ideal I = 41,-36*x1;
    497 module syzI = syz (I); 
     497module syzI = syz (I);
    498498print(syzI);
    499 kill rng,QR; 
     499kill rng,QR;
    500500
    501501//  Github Adi #60
     
    510510ideal IGJ = I+gJ;
    511511intersect(I_J, IGJ) ;
    512 kill rng,QR; 
    513  
     512kill rng,QR;
     513
    514514//  Github Adi #59
    515515
     
    536536intersect(I_J,  I+gJ);
    537537kill rng;
    538  
     538
    539539//  Github Adi #56
    540540
     
    584584reduce (I,gI );
    585585kill rng;
    586  
     586
    587587//  Singular Trac: #719
    588588
    589589ring r = integer,(t,x(1..5)),ws(1,-1,-1,-1,-1,-1);
    590590poly h = 3*t*x(2)*x(4)-21*t*x(1)*x(5)-12*t^2*x(1)*x(2)-2*t^2*x(1)*x(3)-6*t^2*x(1)*x(4);
    591 ideal G = 
     591ideal G =
    592592x(2)+6*x(4)+7*x(5)+4*t*x(2),
    593593x(2)+8*x(3)+7*x(5)+t*x(2),
     
    600600reduce(G,Gstd);
    601601kill r;
    602  
     602
    603603// Memory leak
    604604
     
    646646ideal ngIJ = intersect(gI,gJ ); // wrong
    647647kill rng;
    648        
    649 tst_status(1);$;     
    650 
     648
     649tst_status(1);$;
     650
  • Tst/New/std_integer5.tst

    r412c61 r2bf04b  
    1313ideal stdstdIJ = std(stdIJ);
    1414stdstdIJ;
    15  
     15
    1616tst_status(1);$
  • Tst/Short/bug_tr712.tst

    r412c61 r2bf04b  
    1111ideal gI_J = std(gI,J);
    1212size( std(reduce (I,gI ) ));
    13 size( std(reduce (IJ,gIJ ) )); 
     13size( std(reduce (IJ,gIJ ) ));
    1414size( std(reduce (IJ,gI_J ) ));
    15 size( std(reduce (gI_J, gIJ) )); 
     15size( std(reduce (gI_J, gIJ) ));
    1616gI_J;
    1717gIJ;
  • Tst/Short/bug_tr719.tst

    r412c61 r2bf04b  
    55ring r=integer,(t,x(1..5)),ws(1,-1,-1,-1,-1,-1);
    66poly h = 3*t*x(2)*x(4)-21*t*x(1)*x(5)-12*t^2*x(1)*x(2)-2*t^2*x(1)*x(3)-6*t^2*x(1)*x(4);
    7 ideal G = 
     7ideal G =
    88x(2)+6*x(4)+7*x(5)+4*t*x(2),
    99x(2)+8*x(3)+7*x(5)+t*x(2),
  • Tst/Short/polylib_s.res.gz.uu

    r412c61 r2bf04b  
    1 begin 644 polylib_s.res.gz
    2 M'XL(".I8]%```W!O;'EL:6)?<RYR97,`O5AM;]LV$/[N7\$&^R!9=&R2LI/4
    3 M<("]]$.&9AC6`1L0I(5B*XX:O1AZL27]^MV1E$0Y:N=E10TD$N^.=\=[[DB>
    4 M/OSYR\UOA!!V3=[?_$3.\BP_#X.'L^7H@^;P:P+$3T$<Y):]'.&37%^371)6
    5 M(/@I.X_]PWF6>WD[0UR3]MT]5WI1_$CQW!!;G!._]*)=Z)-UM0Z#]7(TG9)=
    6 MFJSUF#RF241``6DTC=[]_>/M[^_?O1W!_#2(MR1=S:A5T#T]T))6M+9IN%LB
    7 M5ZFPXKV79M:#E_DH;L-B/MVQ^U7A[)V#4SJ54P.!`V'O%+6S/SB'TBDKIT*R
    8 M0/+!*?:U4U3(+(%;`1N9KF26P#T`>P_\HE1"%4JAR%R)5"A3HM`!I?8H5AP:
    9 M811<:,%ZPM#UIR1*MI9>P-R&11U[W?E<M3Z;#E?H3.-PW]E*>B`=D/8-/R?U
    10 M?-2B<W%-GH,P],(0,Z"A7AKX777X/7MY5J1>!Z`F?!U!!>"2-.C(Z8#<DY=Z
    11 MZQQ(60Y)\)8(/IL)Q8N+Z,%/2?)($%?D*;K\/83)^AGS&NA)NI$ZR69G2'2_
    12 MMR3V(C_#UY)4I!Y0PTTU/X._>E%6`T?I\,KA")J$H^0PAK^:3TH%!H<8<T"U
    13 M,B:[MKE@I<>:V0X?EQ93#ZX>PFXU@\!'KD7T"V]>!+Q,4$+;'.-[IXS9G49N
    14 M*[5(55EA*)P9@JP5Y/8K0)E_`U#`'X*.$/2!H#?PS[7_':<F/]EL*(,9ZS*8
    15 M\2Z#'U/?3[WXN4OAAO+E'.Y2&-Z"C>^%)%B5.(B230%*;U=W)9U1=D_O)O@R
    16 M8??(;31;MY`+[0_L9D])$6[(@T\X)>ODV4]!A`09B9-<SAIQ<WI6U00$Z-D9
    17 MK`\22>Z*;`09(]]D;FW]&$'%!V`NK0#9L,0:2Z`-E-FK6S2(-A!0&0"FYW%S
    18 M7D\QL2(X(R((0.J'7AXD,4Z^M4UO`W!2[F^F_T#5,>@MO^<4B*R"`:=8![48
    19 MA-HUH)YW4$=>N4[\QPYI33CMN"%PWNB39I/)DP:ER9:LB'#G)9\P#L_%Q>75
    20 MK'(NIFXM9;0):PONL1E2=+[`M"UELVDWJR>/06/R4,#X!/':)P'N"*R;T$5A
    21 M,1B%"R,*E[TH;/QM+P@P/BD&Q`S"86<QRJFPNU@\@@`<4MRIA22"7NO13'6Y
    22 M'+0.Z9(7:9R1@Q]LGW)_@[*(LA7$9`V[),+-5*7;;T97.C1:X4BH<9X&)8D@
    23 M+!B91Z=D4')0;8\?^=*8$,G0`QVRD"Y(%[:KH;#Q61<VSH[#QH[CQKY7X&3<
    24 M7A\VUL4MB/.]OR9[L(G>*569E=K+GCC='R'7<Z9U`.1E_2M'&I,G(<.LZ.M&
    25 MO(<L"8O<)U^RQBY;-#D?1-.XGG+70#.(^T4@Q_\=RS`[`G%NH`AGTXOT;[8\
    26 MX+T$4QYF"&'H>QLT!L=N]$9GN_1P0!\H6R?1#L*4D68SUN'A`V"\@$+IC;ZN
    27 M5^D`SZ2%(M(6LJZPW*ZP^'P0BH4!Q<4Q%.P8BU<4UO<#PR@A1B>"FJ$<*)TA
    28 MB(XJ>#19G`P6U@T[/Q>&$=-"6S4-5K"&(VL9'L@M&)>#<%UU<(E9!U><I.!^
    29 M4/L=8"WI_T/&`3,!H+D:M5:UW+YJX8BI"VPV!4$9$'7?BE9W5V4%@1*U@#N7
    30 M6]-%17EY?Z0C:B[PM1CC_478CBBKL;XCR1MWK4=@B"L.W'70G)[0KB/KK<-:
    31 MPU+T!OHZE^ZD,)NBN'+EKJ;H!$7K]RU:@@VA);B!ENC02KW-IW42=UAIPBE(
    32 M_;$R;CRJMU9WEQOL>"I.:VZ`MRI=IW(E0=N`.K@!#XU+SZ_M1-I)JUO4JNY-
    33 MW<JI78X*=W#5QE<%87Y52.+<CW/CLX(BG/Q=P4!UIU#5&BP!*V"7T#+S"VC;
    34 MFR,5-H,\2<E^==?G4S;',:]<*NY[>O9R:NO\8-,MC*9;0-,]';=%6$1PDP:3
    35 M2UGX*51>$:_E]1LN`A_^&D_;M92(G6[4XA4DU+*=;,7V$JUB'R,:0ZYQ_W&9
    36 M:73CQPEL*:\U:TPW#?/6F)'"KI'"4$\\V!C'@QR?\H$!D?2AEJD/1=Q\);(V
    37 M.QQM,BAFVVC9HF15-K7?%+YL[]16'^Q7G#(M#_:M**'!OBE>7W;EJFS1XA@)
    38 MJBWW9:.MFF[)JAQ?]N,M^*[1KKA&NQ)L.-CJ%J[&WV[A3>.JG*>MWU2Y3'O>
    39 M#H9">60%1B1>Q+!;IG'^N\;YGQ4/Z0T419KZQF)-ZJE+[NU5;5O^D3OEN(+U
    40 MP'\'1F,0Z@0^]P5,5I3$R*0U,OKK9U0>3Z:3D!`QU9%H6G*(",73IGG'$[UJ
    41 M!@(_'+WLV66S3F0F55S'<*)#*1DPKSV8])D$M"_;$Y.^33@^2S[D_.=OZOR1
    42 BRZ=XVE?>YHJQ"[JP"^+W:?P"761@;OG#Z!^*P0@GU18`````
     1begin 640 polylib_s.res.gz
     2M'XL("*2,1%8``W!O;'EL:6)?<RYR97,`O5AM;]LV$/[N7\$&^R!9=&R2=IK4
     3M<("]]$.&9AC6`1L0I($BR8X:2S+T9DF_?G<D)5&.VWE940.)R>/QWIX['NF/
     4M?_YR\QLAA%V3#S<_D;,\R\^WX>/9<O11K_!K`L2',`YSRUZ.\)M<7Y-=LJV!
     5M\2$[CX/]>9:[>;=#7)-N/#]7<I']0/#"8+LX)T'E1KMM0+S:VX;><C2=DEV:
     6M>'I.UFD2$1!`6DFC]W__>/O[A_?O1K`_#>,-25<S:A6TI'M:T9HV-MWNEKBJ
     7M1%AQZ::9]>AF`;+;X,S#';M?%4[I[)W*J9T&"!P(I5,T3KEW]I53U4Z-9('D
     8MO5.4C5/4N%C!:@W+N#B7BQ6L[F&YA/6B4DPU<B'+0K'4R%,ATQZY2F0K]BTS
     9M,EYHQF;"T/2G)$HVEG9@88-3AU;W-M>=S:;!-1K3&CPTMI862`.D?L/.2;,8
     10M=>B\-9"Z[)%Z=O.L2-T>*DWX.E8*JB5I<9#;`:,G-W6]'$A9#G"_(X+/9D*M
     11MQ47T&*0D61-$$-<477X>MXGWC!D,]"3UI4SB[PR._O..Q&X49#BL2$V:(V*X
     12M*>9GL%<[9;6!KQQ>.QSAD8&O.,SAK^&32H6=0S0YX%<;F^>VZ;"28\ULAX\K
     13MBZDOKKZ$W4D&AD]<L^@!;P<"!A/DT#K'..Z%,;N7R&TE%JD*?T/@S&!D'2.W
     14M7P'*XAN``O80-(2@#02M@7]S^]]QZO+SJL]5-NMS=9T&0>K&SWVRMI0O9VN?
     15MK#`*_<#=DG!5X21*_`*$WJ[N*CJC[)[>37`P8?>XVDJV;@'U[@-ZLZ>DV/KD
     16M,2"<$B]Y#E)@(6%&XB27NT;<W)[5#0$&>G8&N0<I(T\Z-H+<D".919L@1OCP
     17M"]"56H!L:&*M)I`&PNS5+2I$'0B=#`#3^[BY;R"86!&<^Q$$(`VV;AXF,6Z^
     18MM4UK0S!2GEFF_4#5,1BX/S`*6%;A$:-8!RIC!JB\!S5R*R\)UCVFFG!:LR#0
     19M+72?\#/9)Y";;,B*B/FBXA/&X?OB[>75K';>3N>-Y-$JK`VXRV9(T9D!VS:4
     20MS:;]K@$_AH?)(QTC$<9>0$*L<M9OZ/TU.BB;#_SU@\W`79B?Y"TQW=WO+$8Y
     21M%7;O]1H8H)EPIQ&2"'*MM9F^TG#4#BF0%VF<D7T0;I[RP$=>1,X*8^+!&8<0
     22M,E6G]IO1E0Z"%C@2:IZG844B"`#&8.U4#,H(*FC]B2^-#9$,,M`AL^@%Z0-D
     23MW!W8Q6&`V&&$V/<*D8S0ZP/$^@B%<5X&'BE!)UJG1&56:B\'[+0\P&A@3&<`
     24M\,OJ58:T*D_"@%G1UY6XCUFR+?*`?$D;N^QQ,VX2S+A)P.DR3&PY_^^H;;,#
     25MN!8&7M`M7J1T>S3!VDO89'M!L+:!ZZ,R:(31&YW!TL(C\D"8ET0["$A&VD-3
     26M!X(?"?N+H"NYT=?E*AE@F=101%I#UA?+W"@6HR7RV6'0V6'47U$LWR_L1EDP
     27M.A'4#-J1<C@&QD%5CB87)\."M<#.SX6AQ-3054*+"OAPH"W#%MF!8;0U;K2U
     28M.$G!T+`)>F@ZTO\'AP,Z`N"9:WPZT?+P:80CIG-89E-@E*ZKNTZTNKNJ:@B)
     29M:`3<=^8-O:@IK^X/9$3M-;D18[P["-L153W6]Q-YKVWT#!1QM0+W#%2G-W1^
     30M9`,_+`]<T<??ZTRZD\QLBNS*E+N&HA$4M=_WN!CMEQOM-W7]!R^)>U0TX11,
     31M_E@9MPWU*E7WAAM\0=2<-MR`:57-G7HN"5H'Y/8-^&%<.'[M-M*>6]U@5LU@
     32MZT9N-?+.Z)[<?'DG<1[$N?'T5H23W]X&4CN%E)9@";"57<*SDK^%IVW;Y*"4
     33M\R0EY>INN$[9`N>\GE-Q/Y!3RJV=\48[X=!.IN.NA(H([J`@?"D+-(6Z*6)/
     34M7ERA"7_\:SSMK*X0#_V8B5>0#LMNLQ7;R^=PN\47@.@4&<>IF)E*_2!.H/1?
     35MJ];8;BKFG3+CN!#F+3CQ>>@;Q[B<G_((1\P"J$0:0`FVOYE8_@YG?@:E:!N/
     36MG2A956WEMF4K'T;J2`[+%:=,\X-^*TIH6+:E%\B7JRHZU#A&@GJZ!O(QJAZF
     37M<JEV`OEF[6`61CT*HQY#GX.NWG$U_W:.MT\^93SM[*;*9#JP]F@HE$56:$3B
     38M10Q[-XVR%$999L5C>@/IGZ:!X:Q)/=7EP?G3/6@_<:<:U^`/_'=@-@:FGN'S
     39MD,%<BI(8%VF#"T/_&97-Q302$B*F.A+M8Q8B0K%7M&/LO'4[$?CCRLO7KGSF
     40M$IE)-=<QG.A0R@78U[45W5&`]F5]8C+4"<VOXL>,__Q-C3\P^11+A\*[7#%.
     41900&G(/Y:B[_'%AFH6_XP^@=\>L$JXQ4`````
    4342`
    4443end
  • Tst/Short/polylib_s.stat

    r412c61 r2bf04b  
     11 >> tst_memory_0 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:208936
     21 >> tst_memory_1 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:2273280
     31 >> tst_memory_2 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:2400256
     41 >> tst_timer_1 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:5
  • Tst/Short/polylib_s.tst

    r412c61 r2bf04b  
    55
    66example cyclic;
    7 killall();
    87
    98example katsura;
    10 killall();
    119
    1210example freerank;
    13 killall();
    1411
    1512example maxcoef;
    16 killall();
    1713
    1814example maxdeg;
    19 killall();
    2015
    2116example maxdeg1;
    22 killall();
    2317
    2418example mindeg;
    25 killall();
    2619
    2720example mindeg1;
    28 killall();
    2921
    3022example normalize;
    31 killall();
    3223
    3324example rad_con;
    34 killall();
    3525
    3626example content;
    37 killall();
    3827
    3928/*example numerator;// core function in SW*/ring r=0,x,dp;number n=3/2;numerator(n);kill r;
  • factory/gfops.h

    r412c61 r2bf04b  
    6666{
    6767    while ( i < 0 )
    68         i += gf_p;
     68        i += gf_p;
    6969    while ( i >= gf_p )
    70         i -= gf_p;
     70        i -= gf_p;
    7171    if ( i == 0 )
    72         return gf_q;
     72        return gf_q;
    7373    int c = 0;
    7474    while ( i > 1 ) {
    75         c = gf_table[c];
    76         i--;
     75        c = gf_table[c];
     76        i--;
    7777    }
    7878    return c;
     
    8282{
    8383    while ( i < 0 )
    84         i += gf_p;
     84        i += gf_p;
    8585    while ( i >= gf_p )
    86         i -= gf_p;
     86        i -= gf_p;
    8787    if ( i == 0 )
    88         return gf_q;
     88        return gf_q;
    8989    long c = 0;
    9090    while ( i > 1 ) {
    91         c = gf_table[c];
    92         i--;
     91        c = gf_table[c];
     92        i--;
    9393    }
    9494    return c;
     
    114114{
    115115    if ( gf_iszero( a ) )
    116         return 0;
    117     else
    118         return 1;
     116        return 0;
     117    else
     118        return 1;
    119119}
    120120//}}}
     
    127127    int i = a + gf_m1;
    128128    if ( i >= gf_q1 )
    129         i -= gf_q1;
     129        i -= gf_q1;
    130130    return i;
    131131}
     
    139139    int zb, zab, r;
    140140    if ( a >= b ) {
    141         zb = b;
    142         zab = a - b;
    143     }
    144     else {
    145         zb = a;
    146         zab = b - a;
     141        zb = b;
     142        zab = a - b;
     143    }
     144    else {
     145        zb = a;
     146        zab = b - a;
    147147    }
    148148    if ( gf_table[zab] == gf_q )
    149         r = gf_q; /*if z^(a-b)+1 =0*/
    150     else {
    151         r= zb + gf_table[zab];
    152         if ( r >= gf_q1 )
    153             r -= gf_q1;
     149        r = gf_q; /*if z^(a-b)+1 =0*/
     150    else {
     151        r= zb + gf_table[zab];
     152        if ( r >= gf_q1 )
     153            r -= gf_q1;
    154154    }
    155155    return r;
     
    164164{
    165165    if ( a == gf_q || b == gf_q )
    166         return gf_q;
    167     else {
    168         int i = a + b;
    169         if ( i >= gf_q1 ) i -= gf_q1;
    170         return i;
     166        return gf_q;
     167    else {
     168        int i = a + b;
     169        if ( i >= gf_q1 ) i -= gf_q1;
     170        return i;
    171171    }
    172172}
     
    175175{
    176176    if ( a == gf_q || b == gf_q )
    177         return gf_q;
    178     else {
    179         long i = a + b;
    180         if ( i >= gf_q1 ) i -= gf_q1;
    181         return i;
     177        return gf_q;
     178    else {
     179        long i = a + b;
     180        if ( i >= gf_q1 ) i -= gf_q1;
     181        return i;
    182182    }
    183183}
     
    187187    ASSERT( b != gf_q, "divide by zero" );
    188188    if ( a == gf_q )
    189         return gf_q;
    190     else {
    191         int s = a - b;
    192         if (s < 0)
    193             s += gf_q1;
    194         return s;
     189        return gf_q;
     190    else {
     191        int s = a - b;
     192        if (s < 0)
     193            s += gf_q1;
     194        return s;
    195195    }
    196196}
     
    208208{
    209209    if ( a == gf_q )
    210         os << "0";
     210        os << "0";
    211211    else  if ( a == 0 )
    212         os << "1";
     212        os << "1";
    213213    else  if ( a == 1 )
    214         os << gf_name;
    215     else
    216         os << gf_name << "^" << a;
     214        os << gf_name;
     215    else
     216        os << gf_name << "^" << a;
    217217}
    218218#endif /* NOSTREAMIO */
     
    223223{
    224224    if ( n == 0 )
    225         return 0;
     225        return 0;
    226226    else if ( n == 1 )
    227         return a;
    228     else
    229         return gf_mul( a, gf_power( a, n-1 ) );
     227        return a;
     228    else
     229        return gf_mul( a, gf_power( a, n-1 ) );
    230230}
    231231
     
    233233{
    234234    if ( n == 0 )
    235         return 0;
     235        return 0;
    236236    else if ( n == 1 )
    237         return a;
    238     else
    239         return gf_mul( a, gf_power( a, n-1 ) );
     237        return a;
     238    else
     239        return gf_mul( a, gf_power( a, n-1 ) );
    240240}
    241241//}}}
  • factory/parseutil.cc

    r412c61 r2bf04b  
    8383    static PUtilBase * create( const char * str )
    8484    {
    85         if ( strlen( str ) < 9 )
    86             return new PUtilInt( atoi( str ) );
    87         else
    88             return new PUtilCF( CanonicalForm( str ) );
     85        if ( strlen( str ) < 9 )
     86            return new PUtilInt( atoi( str ) );
     87        else
     88            return new PUtilCF( CanonicalForm( str ) );
    8989    }
    9090};
     
    123123{
    124124    if ( this != &pu ) {
    125         delete value;
    126         value = pu.value->copy();
     125        delete value;
     126        value = pu.value->copy();
    127127    }
    128128    return *this;
  • factory/templates/ftmpl_afactor.cc

    r412c61 r2bf04b  
    2626{
    2727    if ( exp() == 1 )
    28         s << "(" << factor() << ", " << minpoly() << ")";
     28        s << "(" << factor() << ", " << minpoly() << ")";
    2929    else
    30         s << "((" << factor() << ")^" << exp() << ", " << minpoly() << ")";
     30        s << "((" << factor() << ")^" << exp() << ", " << minpoly() << ")";
    3131}
    3232
  • factory/templates/ftmpl_array.cc

    r412c61 r2bf04b  
    1212{
    1313    if ( a._size > 0 ) {
    14         _min = a._min;
    15         _max = a._max;
    16         _size = a._size;
    17         data = new T[_size];
    18         for ( int i = 0; i < _size; i++ )
    19             data[i] = a.data[i];
     14        _min = a._min;
     15        _max = a._max;
     16        _size = a._size;
     17        data = new T[_size];
     18        for ( int i = 0; i < _size; i++ )
     19            data[i] = a.data[i];
    2020    }
    2121    else {
    22         data = 0;
    23         _min = _size = 0;
    24         _max = -1;
     22        data = 0;
     23        _min = _size = 0;
     24        _max = -1;
    2525    }
    2626}
     
    3333    _size = i;
    3434    if ( i == 0 )
    35         data = 0;
     35        data = 0;
    3636    else
    37         data = new T[_size];
     37        data = new T[_size];
    3838}
    3939
     
    4242{
    4343    if ( max < min ) {
    44         _min = _size = 0;
    45         _max = -1;
    46         data = 0;
     44        _min = _size = 0;
     45        _max = -1;
     46        data = 0;
    4747    }
    4848    else {
    49         _min = min;
    50         _max = max;
    51         _size = _max - _min + 1;
    52         data = new T[_size];
     49        _min = min;
     50        _max = max;
     51        _size = _max - _min + 1;
     52        data = new T[_size];
    5353    }
    5454}
     
    6464{
    6565    if ( this != &a ) {
    66         delete [] data;
    67         _min = a._min;
    68         _max = a._max;
    69         _size = a._size;
    70         if ( a._size > 0 ) {
    71             _size = a._size;
    72             data = new T[_size];
    73             for ( int i = 0; i < _size; i++ )
    74                 data[i] = a.data[i];
    75         }
    76         else {
    77             data = 0;
    78             _size = 0;
    79         }
     66        delete [] data;
     67        _min = a._min;
     68        _max = a._max;
     69        _size = a._size;
     70        if ( a._size > 0 ) {
     71            _size = a._size;
     72            data = new T[_size];
     73            for ( int i = 0; i < _size; i++ )
     74                data[i] = a.data[i];
     75        }
     76        else {
     77            data = 0;
     78            _size = 0;
     79        }
    8080    }
    8181    return *this;
     
    112112{
    113113    for ( int i = 0; i < _size; i++ )
    114         data[i] *= t;
     114        data[i] *= t;
    115115    return *this;
    116116}
     
    120120{
    121121    for ( int i = 0; i < _size; i++ )
    122         data[i] += t;
     122        data[i] += t;
    123123    return *this;
    124124}
     
    129129    ASSERT ( _size == a._size, "warning: array size mismatch." );
    130130    for ( int i = 0; i < _size; i++ )
    131         data[i] += a.data[i];
     131        data[i] += a.data[i];
    132132    return *this;
    133133}
     
    139139{
    140140    if ( _size == 0 )
    141         os << "( )";
     141        os << "( )";
    142142    else {
    143         os << "( " << data[0];
    144         for ( int i = 1; i < _size; i++ )
    145             os << ", " << data[i];
    146         os << " )";
     143        os << "( " << data[0];
     144        for ( int i = 1; i < _size; i++ )
     145            os << ", " << data[i];
     146        os << " )";
    147147    }
    148148}
  • factory/templates/ftmpl_factor.cc

    r412c61 r2bf04b  
    77{
    88    if ( this != &f ) {
    9         _factor = f._factor;
    10         _exp = f._exp;
     9        _factor = f._factor;
     10        _exp = f._exp;
    1111    }
    1212    return *this;
     
    3232{
    3333    if ( exp() == 1 )
    34         s << factor();
     34        s << factor();
    3535    else
    36         s << "(" << factor() << ")^" << exp();
     36        s << "(" << factor() << ")^" << exp();
    3737}
    3838
  • factory/templates/ftmpl_matrix.cc

    r412c61 r2bf04b  
    88    ASSERT( (nr > 0 && nc > 0) || (nr == 0 && nc == 0), "illegal index" );
    99    if ( nr == 0 )
    10         elems = 0;
     10        elems = 0;
    1111    else {
    12         int i;
    13         elems = new T_ptr[nr];
    14         for ( i = 0; i < nr; i++ )
    15             elems[i] = new T[nc];
     12        int i;
     13        elems = new T_ptr[nr];
     14        for ( i = 0; i < nr; i++ )
     15            elems[i] = new T[nc];
    1616    }
    1717}
     
    2121{
    2222    if ( NR == 0 )
    23         elems = 0;
     23        elems = 0;
    2424    else {
    25         int i, j;
    26         elems = new T_ptr[NR];
    27         for ( i = 0; i < NR; i++ ) {
    28             elems[i] = new T[NC];
    29             for ( j = 0; j < NC; j++ )
    30                 elems[i][j] = M.elems[i][j];
    31         }
     25        int i, j;
     26        elems = new T_ptr[NR];
     27        for ( i = 0; i < NR; i++ ) {
     28            elems[i] = new T[NC];
     29            for ( j = 0; j < NC; j++ )
     30                elems[i][j] = M.elems[i][j];
     31        }
    3232    }
    3333}
     
    3737{
    3838    if ( elems != 0 ) {
    39         int i;
    40         for ( i = 0; i < NR; i++ )
    41             delete [] elems[i];
    42         delete [] elems;
     39        int i;
     40        for ( i = 0; i < NR; i++ )
     41            delete [] elems[i];
     42        delete [] elems;
    4343    }
    4444}
     
    4848{
    4949    if ( this != &M ) {
    50         int i, j;
    51         if ( NR != M.NR || NC != M.NC ) {
    52             for ( i = 0; i < NR; i++ )
    53                 delete [] elems[i];
    54             delete elems;
    55             NR = M.NR; NC = M.NC;
    56             elems = new T_ptr[NR];
    57             for ( i = 0; i < NR; i++ )
    58                 elems[i] = new T[NC];
    59         }
    60         for ( i = 0; i < NR; i++ )
    61             for ( j = 0; j < NC; j++ )
    62                 elems[i][j] = M.elems[i][j];
     50        int i, j;
     51        if ( NR != M.NR || NC != M.NC ) {
     52            for ( i = 0; i < NR; i++ )
     53                delete [] elems[i];
     54            delete elems;
     55            NR = M.NR; NC = M.NC;
     56            elems = new T_ptr[NR];
     57            for ( i = 0; i < NR; i++ )
     58                elems[i] = new T[NC];
     59        }
     60        for ( i = 0; i < NR; i++ )
     61            for ( j = 0; j < NC; j++ )
     62                elems[i][j] = M.elems[i][j];
    6363    }
    6464    return *this;
     
    112112    ASSERT( i > 0 && i <= NR && j > 0 && j <= NR, "illegal index" );
    113113    if ( i != j ) {
    114         i--; j--;
    115         T * h = elems[i];
    116         elems[i] = elems[j];
    117         elems[j] = h;
     114        i--; j--;
     115        T * h = elems[i];
     116        elems[i] = elems[j];
     117        elems[j] = h;
    118118    }
    119119}
     
    124124    ASSERT( i > 0 && i <= NC && j > 0 && j <= NC, "illegal index" );
    125125    if ( i != j ) {
    126         int k;
    127         i--; j--;
    128         for ( k = 0; k < NR; k++ ) {
    129             T h = elems[k][i];
    130             elems[k][i] = elems[k][j];
    131             elems[k][j] = h;
    132         }
     126        int k;
     127        i--; j--;
     128        for ( k = 0; k < NR; k++ ) {
     129            T h = elems[k][i];
     130            elems[k][i] = elems[k][j];
     131            elems[k][j] = h;
     132        }
    133133    }
    134134}
     
    140140    s << "( " << elems[i][0];
    141141    for ( int j = 1; j < NC; j++ )
    142         s << ", " << elems[i][j];
     142        s << ", " << elems[i][j];
    143143    s << " )";
    144144}
     
    148148{
    149149    if ( NR == 0 )
    150         s << "( )";
     150        s << "( )";
    151151    else if ( NR == 1 ) {
    152         s << "( ";
    153         printrow( s, 0 );
    154         s << " )";
     152        s << "( ";
     153        printrow( s, 0 );
     154        s << " )";
    155155    }
    156156    else {
    157         int i;
    158         s << "(\n";
    159         printrow( s, 0 );
    160         for ( i = 1; i < NR; i++ ) {
    161             s << ",\n";
    162             printrow( s, i );
    163         }
    164         s << "\n)";
     157        int i;
     158        s << "(\n";
     159        printrow( s, 0 );
     160        for ( i = 1; i < NR; i++ ) {
     161            s << ",\n";
     162            printrow( s, i );
     163        }
     164        s << "\n)";
    165165    }
    166166}
     
    174174    int i, j;
    175175    for ( i = 0; i < lhs.NR; i++ )
    176         for ( j = 0; j < lhs.NC; j++ )
    177             res.elems[i][j] = lhs.elems[i][j] + rhs.elems[i][j];
     176        for ( j = 0; j < lhs.NC; j++ )
     177            res.elems[i][j] = lhs.elems[i][j] + rhs.elems[i][j];
    178178    return res;
    179179}
     
    186186    int i, j;
    187187    for ( i = 0; i < lhs.NR; i++ )
    188         for ( j = 0; j < lhs.NC; j++ )
    189             res.elems[i][j] = lhs.elems[i][j] - rhs.elems[i][j];
     188        for ( j = 0; j < lhs.NC; j++ )
     189            res.elems[i][j] = lhs.elems[i][j] - rhs.elems[i][j];
    190190    return res;
    191191}
     
    197197    int i, j;
    198198    for ( i = 0; i < lhs.NR; i++ )
    199         for ( j = 0; j < lhs.NC; j++ )
    200             res.elems[i][j] = lhs.elems[i][j] * rhs;
     199        for ( j = 0; j < lhs.NC; j++ )
     200            res.elems[i][j] = lhs.elems[i][j] * rhs;
    201201    return res;
    202202}
     
    208208    int i, j;
    209209    for ( i = 0; i < rhs.NR; i++ )
    210         for ( j = 0; j < rhs.NC; j++ )
    211             res.elems[i][j] = rhs.elems[i][j] * lhs;
     210        for ( j = 0; j < rhs.NC; j++ )
     211            res.elems[i][j] = rhs.elems[i][j] * lhs;
    212212    return res;
    213213}
     
    220220    int i, j, k;
    221221    for ( i = 0; i < lhs.NR; i++ )
    222         for ( j = 0; j < rhs.NC; j++ ) {
    223             res[i][j] = 0;
    224             for ( k = 0; k < lhs.NC; k++ )
    225                 res[i][j]+= lhs.elems[i][k] * rhs.elems[k][j];
    226         }
     222        for ( j = 0; j < rhs.NC; j++ ) {
     223            res[i][j] = 0;
     224            for ( k = 0; k < lhs.NC; k++ )
     225                res[i][j]+= lhs.elems[i][k] * rhs.elems[k][j];
     226        }
    227227    return res;
    228228}*/
     
    239239    ASSERT( r_max - r_min + 1 == S.NR && c_max - c_min + 1 == S.NC, "incompatible matrices" );
    240240    if ( M.elems != S.elems ) {
    241         int i, j;
    242         for ( i = 0; i < S.NR; i++ )
    243             for ( j = 0; j < S.NC; j++ )
    244                 M.elems[r_min+i-1][c_min+j-1] = S.elems[i][j];
     241        int i, j;
     242        for ( i = 0; i < S.NR; i++ )
     243            for ( j = 0; j < S.NC; j++ )
     244                M.elems[r_min+i-1][c_min+j-1] = S.elems[i][j];
    245245    }
    246246    return *this;
     
    255255    m = c_max - c_min + 1;
    256256    if ( M.elems == S.M.elems ) {
    257         if ( r_min < S.r_min ) {
    258             for ( i = 0; i < n; i++ )
    259                 for ( j = 0; j < m; j++ )
    260                     M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
    261         }
    262         else if ( r_min > S.r_min ) {
    263             for ( i = n-1; i >= 0; i-- )
    264                 for ( j = 0; j < m; j++ )
    265                     M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
    266         }
    267         else if ( c_min < S.c_min ) {
    268             for ( j = 0; j < m; j++ )
    269                 for ( i = 0; i < n; i++ )
    270                     M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
    271         }
    272         else if ( c_min > S.c_min ) {
    273             for ( j = m-1; j >= 0; j-- )
    274                 for ( i = 0; i < n; i++ )
    275                     M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
    276         }
     257        if ( r_min < S.r_min ) {
     258            for ( i = 0; i < n; i++ )
     259                for ( j = 0; j < m; j++ )
     260                    M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
     261        }
     262        else if ( r_min > S.r_min ) {
     263            for ( i = n-1; i >= 0; i-- )
     264                for ( j = 0; j < m; j++ )
     265                    M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
     266        }
     267        else if ( c_min < S.c_min ) {
     268            for ( j = 0; j < m; j++ )
     269                for ( i = 0; i < n; i++ )
     270                    M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
     271        }
     272        else if ( c_min > S.c_min ) {
     273            for ( j = m-1; j >= 0; j-- )
     274                for ( i = 0; i < n; i++ )
     275                    M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
     276        }
    277277    }
    278278    else {
    279         for ( i = 0; i < n; i++ )
    280             for ( j = 0; j < m; j++ )
    281                 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
     279        for ( i = 0; i < n; i++ )
     280            for ( j = 0; j < m; j++ )
     281                M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1];
    282282    }
    283283    return *this;
     
    291291    int n = r_max - r_min + 1, m = c_max - c_min + 1;
    292292    for ( i = 0; i < n; i++ )
    293         for ( j = 0; j < m; j++ )
    294             res.elems[i][j] = M.elems[r_min+i-1][c_min+j-1];
     293        for ( j = 0; j < m; j++ )
     294            res.elems[i][j] = M.elems[r_min+i-1][c_min+j-1];
    295295    return res;
    296296}
  • factory/timing.h

    r412c61 r2bf04b  
    4848#define TIMING_END_AND_PRINT(t, msg) times( &timing_ ## t ## _end ); \
    4949  fprintf( stderr, "%s%.2f sec\n", msg, \
    50            float( timing_ ## t ## _end - timing_ ## t ## _start ) / HZ ); \
     50           float( timing_ ## t ## _end - timing_ ## t ## _start ) / HZ ); \
    5151  timing_ ## t ## _time += timing_ ## t ## _end - timing_ ## t ## _start;
    5252#define TIMING_DEFINE_PRINT(t) static clock_t timing_ ## t ## _start, timing_ ## t ## _end; \
     
    6666#define TIMING_END_AND_PRINT(t, msg) times( &timing_ ## t ## _end ); \
    6767  fprintf( stderr, "%s%.2f sec\n", msg, \
    68            float( timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime ) / HZ ); \
     68           float( timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime ) / HZ ); \
    6969  timing_ ## t ## _time += timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime;
    7070#define TIMING_DEFINE_PRINT(t) static struct tms timing_ ## t ## _start, timing_ ## t ## _end; \
  • factory/variable.h

    r412c61 r2bf04b  
    4444    Variable& operator= ( const Variable & v )
    4545    {
    46         _level = v._level;
    47         return *this;
     46        _level = v._level;
     47        return *this;
    4848    }
    4949    int level() const { return _level; }
     
    5353    friend bool operator == ( const Variable & lhs, const Variable & rhs )
    5454    {
    55         return lhs._level == rhs._level;
     55        return lhs._level == rhs._level;
    5656    }
    5757    friend bool operator != ( const Variable & lhs, const Variable & rhs )
    5858    {
    59         return lhs._level != rhs._level;
     59        return lhs._level != rhs._level;
    6060    }
    6161    friend bool operator > ( const Variable & lhs, const Variable & rhs )
    6262    {
    63         return lhs._level > rhs._level;
     63        return lhs._level > rhs._level;
    6464    }
    6565    friend bool operator < ( const Variable & lhs, const Variable & rhs )
    6666    {
    67         return lhs._level < rhs._level;
     67        return lhs._level < rhs._level;
    6868    }
    6969    friend bool operator >= ( const Variable & lhs, const Variable & rhs )
    7070    {
    71         return lhs._level >= rhs._level;
     71        return lhs._level >= rhs._level;
    7272    }
    7373    friend bool operator <= ( const Variable & lhs, const Variable & rhs )
    7474    {
    75         return lhs._level <= rhs._level;
     75        return lhs._level <= rhs._level;
    7676    }
    7777#ifndef NOSTREAMIO
  • gfanlib/gfanlib_matrix.h

    r412c61 r2bf04b  
    197197  std::string toString()const
    198198  {
    199           std::stringstream f;
    200           f<<*this;
    201           return f.str();
     199          std::stringstream f;
     200          f<<*this;
     201          return f.str();
    202202  }
    203203
  • gfanlib/gfanlib_symmetriccomplex.cpp

    r412c61 r2bf04b  
    185185int SymmetricComplex::getLinDim()const
    186186{
    187         return linealitySpace.getHeight();
     187  return linealitySpace.getHeight();
    188188}
    189189
  • gfanlib/gfanlib_vector.h

    r412c61 r2bf04b  
    293293  std::string toString()const
    294294  {
    295           std::stringstream f;
    296           f<<*this;
    297           return f.str();
     295    std::stringstream f;
     296    f<<*this;
     297    return f.str();
    298298  }
    299299
  • gfanlib/gfanlib_zcone.cpp

    r412c61 r2bf04b  
    459459    dd_ErrorType err=dd_NoError;
    460460
    461         cddinitGmp();
     461        cddinitGmp();
    462462
    463463    A=ZMatrix2MatrixGmp(inequalities, equations, &err);
     
    748748std::string ZCone::toString()const
    749749{
    750         std::stringstream f;
    751         f<<*this;
    752         return f.str();
     750        std::stringstream f;
     751        f<<*this;
     752        return f.str();
    753753// =======
    754754//   std::stringstream s;
     
    983983  }
    984984*/
    985 //        ZCone dual(newGenerators,linealitySpace);
    986           ZCone dual(generators,linealitySpace);
     985//          ZCone dual(newGenerators,linealitySpace);
     986          ZCone dual(generators,linealitySpace);
    987987//  dual.findFacets();
    988988//  dual.canonicalize();
  • gfanlib/gfanlibtest.cpp

    r412c61 r2bf04b  
    2020      if(tab)s<<tab;
    2121      for(int j=0;j<m.getWidth();j++)
    22         {
    23           s<<m[i][j];
    24           if(i+1!=m.getHeight() || j+1!=m.getWidth())
    25             {
    26               s<<",";
    27             }
    28         }
     22      {
     23        s<<m[i][j];
     24        if(i+1!=m.getHeight() || j+1!=m.getWidth())
     25          {
     26            s<<",";
     27          }
     28      }
    2929      s<<endl;
    3030    }
     
    4040      if(tab)s<<tab;
    4141      for(int j=0;j<m.getWidth();j++)
    42         {
    43           stringstream temp;
    44           temp<<m[i][j];
    45           string temp2=temp.str();
    46           for(int k=temp2.size();k<fieldWidth;k++)s<<" ";
    47           s<<temp2;
    48           if(i+1!=m.getHeight() || j+1!=m.getWidth())
    49             {
    50               s<<" ";
    51             }
    52         }
     42      {
     43        stringstream temp;
     44        temp<<m[i][j];
     45        string temp2=temp.str();
     46        for(int k=temp2.size();k<fieldWidth;k++)s<<" ";
     47        s<<temp2;
     48        if(i+1!=m.getHeight() || j+1!=m.getWidth())
     49          {
     50            s<<" ";
     51          }
     52      }
    5353      s<<endl;
    5454    }
  • kernel/GBEngine/kstd1.h

    r412c61 r2bf04b  
    3737
    3838ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
    39                 int newIdeal, intvec *vw, int uptodeg, int lVblock);
     39                int newIdeal, intvec *vw, int uptodeg, int lVblock);
    4040
    4141/* the following global data are defined in kutil.cc */
  • kernel/GBEngine/tgb_internal.h

    r412c61 r2bf04b  
    15701570          {
    15711571            if (row_array[i]!=zero)
    1572             { STATISTIC(n_Sub);
     1572            { STATISTIC(n_Sub);
    15731573              other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf));
    1574             }
     1574            }
    15751575
    15761576          }
     
    15821582          {
    15831583            if (row_array[i]!=zero)
    1584             { STATISTIC(n_Add);
     1584            { STATISTIC(n_Add);
    15851585              other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef2,(number)(long) row_array[i],currRing->cf),(number)(long) other_row_array[i],currRing->cf));
    1586             }
     1586            }
    15871587
    15881588          }
     
    17331733        {
    17341734          if (row_array[i]!=zero)
    1735           {
    1736             STATISTIC(n_Add);
     1735          {
     1736            STATISTIC(n_Add);
    17371737            other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef,(number)(long)row_array[i],currRing->cf),(number)(long)other_row_array[i],currRing->cf));
    1738           }
     1738          }
    17391739        }
    17401740        updateLastReducibleIndex(other_row,r);
     
    18541854      {
    18551855        for(i=0;i<len;i++)
    1856         {
     1856        {
    18571857         int idx=old_to_new_indices[idx_array[i]];
    18581858         row[idx]=F4mat_to_number_type(coef_array[i]);
     
    18621862      {
    18631863        for(i=0;i<len;i++)
    1864         {
     1864        {
    18651865          row[old_to_new_indices[i]]=F4mat_to_number_type(coef_array[i]);
    18661866        }
  • kernel/combinatorics/hdegree.cc

    r412c61 r2bf04b  
    10141014  {
    10151015    //consider just monic generators (over rings with zero-divisors)
    1016     ideal SS=id_Copy(S,tailRing); 
     1016    ideal SS=id_Copy(S,tailRing);
    10171017    for(i=0;i<=idElem(S);i++)
    10181018    {
    1019         if(p_IsPurePower(SS->m[i],tailRing)==0)
    1020                 { 
    1021                   p_Delete(&SS->m[i],tailRing);
    1022                 }
    1023         }
    1024         S=id_Copy(SS,tailRing);
    1025         idSkipZeroes(S);
     1019      if(p_IsPurePower(SS->m[i],tailRing)==0)
     1020      {
     1021        p_Delete(&SS->m[i],tailRing);
     1022      }
     1023    }
     1024    S=id_Copy(SS,tailRing);
     1025    idSkipZeroes(S);
    10261026  }
    10271027  #if 0
  • kernel/fglm/fglmcomb.cc

    r412c61 r2bf04b  
    9292        }
    9393    }
    94     if ( best > 0 ) {
     94    if ( best > 0 )
     95    {
    9596        // OwnSPoly
    9697        poly p2 = (source->m)[best-1];
     
    99100        poly m = pOne();
    100101        for ( i= (currRing->N); i > 0; i-- )
    101         {
     102        {
    102103            diff= pGetExp( *pptr, i ) - pGetExp( p2, i );
    103104            pSetExp( m, i, diff );
  • kernel/fglm/fglmhom.cc

    r412c61 r2bf04b  
    7272    void initialize( poly m, int b, BOOLEAN ind )
    7373    {
    74         basis = b;
    75         inDest = ind;
    76         mon.dm = m;
    77         mon.sm = NULL;
     74        basis = b;
     75        inDest = ind;
     76        mon.dm = m;
     77        mon.sm = NULL;
    7878    }
    7979    void initialize( const homogElem h )
    8080    {
    81         basis = h.basis;
    82         inDest = h.inDest;
    83         mon.dm = h.mon.dm;
    84         mon.sm = h.mon.sm;
     81        basis = h.basis;
     82        inDest = h.inDest;
     83        mon.dm = h.mon.dm;
     84        mon.sm = h.mon.sm;
    8585    }
    8686#endif
     
    167167                int k;
    168168#ifdef HAVE_EXPLICIT_CONSTR
    169                 // Expand array using Singulars ReAlloc function
     169                // Expand array using Singulars ReAlloc function
    170170                dat->monlist=
    171                     (homogElem * )omReallocSize( dat->monlist,
    172                                            (dat->monlistmax)*sizeof( homogElem ),
    173                                            (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) );
     171                    (homogElem * )omReallocSize( dat->monlist,
     172                                           (dat->monlistmax)*sizeof( homogElem ),
     173                                           (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) );
    174174                for ( k= dat->monlistmax; k < (dat->monlistmax+dat->monlistblock); k++ )
    175175                    dat->monlist[k].homogElem();
    176176#else
    177                 // Expand array by generating new one and copying
    178                 int newsize = dat->monlistmax  + dat->monlistblock;
    179                 homogElem * tempelem = new homogElem[ newsize ];
    180                 // Copy old elements
    181                 for ( k= dat->monlistmax - 1; k >= 0; k-- )
    182                     tempelem[k].initialize( dat->monlist[k] );
    183                 delete [] homogElem;
    184                 homogElem = tempelem;
     177                // Expand array by generating new one and copying
     178                int newsize = dat->monlistmax  + dat->monlistblock;
     179                homogElem * tempelem = new homogElem[ newsize ];
     180                // Copy old elements
     181                for ( k= dat->monlistmax - 1; k >= 0; k-- )
     182                    tempelem[k].initialize( dat->monlist[k] );
     183                delete [] homogElem;
     184                homogElem = tempelem;
    185185#endif
    186186                dat->monlistmax+= dat->monlistblock;
     
    189189            dat->monlist[dat->numMonoms]= homogElem( mon, basis, inDest );
    190190#else
    191             dat->monlist[dat->numMonoms].initialize( mon, basis, inDest );
     191            dat->monlist[dat->numMonoms].initialize( mon, basis, inDest );
    192192#endif
    193193            dat->numMonoms++;
     
    388388        for ( j= dat.monlistmax - 1; j >= 0; j-- ) dat.monlist[j].homogElem();
    389389#else
    390         dat.monlist = new homogElem[ dat.monlistmax ];
     390        dat.monlist = new homogElem[ dat.monlistmax ];
    391391#endif
    392392        dat.numMonoms= 0;
     
    417417        omFreeSize( (ADDRESS)dat.monlist, dat.monlistmax*sizeof( homogElem ) );
    418418#else
    419         delete [] dat.monlist;
     419        delete [] dat.monlist;
    420420#endif
    421421        PROT( "<\n" );
  • kernel/groebner_walk/walkProc.cc

    r412c61 r2bf04b  
    9494    {
    9595        snames=sring->cf->extRing->names;
    96         dnames=dring->cf->extRing->names;
     96        dnames=dring->cf->extRing->names;
    9797        pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) );
    9898    }
     
    100100    {
    101101        snames=NULL;
    102         dnames=NULL;
     102        dnames=NULL;
    103103        pperm= NULL;
    104104    }
     
    264264    {
    265265        snames=sring->cf->extRing->names;
    266         dnames=dring->cf->extRing->names;
     266        dnames=dring->cf->extRing->names;
    267267        pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) );
    268268    }
     
    270270    {
    271271        pperm= NULL;
    272         snames=NULL;
    273         dnames=NULL;
     272        snames=NULL;
     273        dnames=NULL;
    274274    }
    275275
  • kernel/numeric/mpr_numeric.cc

    r412c61 r2bf04b  
    936936          WarnS("rootArranger::arrange: precision lost");
    937937          mprec*=10;
    938         }
     938        }
    939939      } while(!found);
    940940#if 0
  • kernel/numeric/mpr_numeric.h

    r412c61 r2bf04b  
    3030public:
    3131  vandermonde( const long _cn, const long _n,
    32                const long _maxdeg, number *_p, const bool _homog = true );
     32               const long _maxdeg, number *_p, const bool _homog = true );
    3333  ~vandermonde();
    3434
     
    7272
    7373  void fillContainer( number *_coeffs, number *_ievpoint,
    74                       const int _var, const int _tdg,
    75                       const rootType _rt, const int _anz );
     74                      const int _var, const int _tdg,
     75                      const rootType _rt, const int _anz );
    7676
    7777  bool solver( const int polishmode= PM_NONE );
     
    153153
    154154  rootArranger( rootContainer ** _roots,
    155                 rootContainer ** _mu,
    156                 const int _howclean = PM_CORRUPT );
     155                rootContainer ** _mu,
     156                const int _howclean = PM_CORRUPT );
    157157  ~rootArranger() {}
    158158
  • kernel/old/old.IIntvec.h

    r412c61 r2bf04b  
    66public:
    77  Intvec(iterator first,
    8         iterator last,
    9         const allocator_type& __a = allocator_type()):
     8        iterator last,
     9        const allocator_type& __a = allocator_type()):
    1010    std::vector<int>(first,last,__a){
    1111  }
  • libpolys/misc/options.c

    r412c61 r2bf04b  
    66unsigned si_opt_2 = Sy_bit(V_QUIET)
    77                   //| Sy_bit(V_QRING) // not default, as speed drops by 10 %
    8                    | Sy_bit(V_REDEFINE)
    9                    | Sy_bit(V_LOAD_LIB)
    10                    | Sy_bit(V_SHOW_USE)
    11                    | Sy_bit(V_PROMPT)
    12                    ;
     8                   | Sy_bit(V_REDEFINE)
     9                   | Sy_bit(V_LOAD_LIB)
     10                   | Sy_bit(V_SHOW_USE)
     11                   | Sy_bit(V_PROMPT)
     12                   ;
    1313
  • libpolys/polys/monomials/p_polys.cc

    r412c61 r2bf04b  
    25442544        d=pGetCoeff(ph);
    25452545        s=ns;
    2546         if (s2<=3) break;
     2546        if (s2<=3) break;
    25472547      }
    25482548      else if (ns<s)
  • libpolys/polys/nc/ncSAFormula.cc

    r412c61 r2bf04b  
    276276  return p;
    277277
    278 } //    return ncSA_1xy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
     278} //         return ncSA_1xy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
    279279///////////////////////////////////////////////////////////////////////////////////////////
    280280static inline poly ncSA_Mxy0x0y0(const int i, const int j, const int n, const int m, const ring r)
     
    296296  return p;
    297297
    298 } //    return ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
     298} //         return ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
    299299///////////////////////////////////////////////////////////////////////////////////////////
    300300static inline poly ncSA_Qxy0x0y0(const int i, const int j, const int n, const int m, const number m_q, const ring r)
     
    345345  return p;
    346346
    347 } //    return ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
     347} //         return ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
    348348///////////////////////////////////////////////////////////////////////////////////////////
    349349static inline poly ncSA_1xy0x0yG(const int i, const int j, const int n, const int m, const number m_g, const ring r)
  • libpolys/polys/nc/ncSAMult.cc

    r412c61 r2bf04b  
    554554///////////////////////////////////////////////////////////////////////////////////////////
    555555CAntiCommutativeSpecialPairMultiplier::CAntiCommutativeSpecialPairMultiplier(ring r, int i, int j):
    556                 CSpecialPairMultiplier(r, i, j)
    557 {
    558 #if OUTPUT
    559         Print("CAntiCommutativeSpecialPairMultiplier::CAntiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d)!", i, j);
    560         PrintLn();
     556                CSpecialPairMultiplier(r, i, j)
     557{
     558#if OUTPUT
     559        Print("CAntiCommutativeSpecialPairMultiplier::CAntiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d)!", i, j);
     560        PrintLn();
    561561#endif
    562562}
     
    566566{
    567567#if OUTPUT
    568         PrintS("CAntiCommutativeSpecialPairMultiplier::~CAntiCommutativeSpecialPairMultiplier()");
    569         PrintLn();
     568        PrintS("CAntiCommutativeSpecialPairMultiplier::~CAntiCommutativeSpecialPairMultiplier()");
     569        PrintLn();
    570570#endif
    571571}
     
    575575{
    576576#if OUTPUT
    577         Print("CAntiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight);
    578         PrintLn();
    579 #endif
    580 
    581         const ring r = GetBasering();
    582 
    583         return CFormulaPowerMultiplier::ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
     577        Print("CAntiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight);
     578        PrintLn();
     579#endif
     580
     581        const ring r = GetBasering();
     582
     583        return CFormulaPowerMultiplier::ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
    584584}
    585585
    586586///////////////////////////////////////////////////////////////////////////////////////////
    587587CQuasiCommutativeSpecialPairMultiplier::CQuasiCommutativeSpecialPairMultiplier(ring r, int i, int j, number q):
    588                 CSpecialPairMultiplier(r, i, j), m_q(q)
    589 {
    590 #if OUTPUT
    591         Print("CQuasiCommutativeSpecialPairMultiplier::CQuasiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d, q)!", i, j);
    592         PrintLn();
    593         PrintS("Parameter q: ");
    594         n_Write(q, r);
     588                CSpecialPairMultiplier(r, i, j), m_q(q)
     589{
     590#if OUTPUT
     591        Print("CQuasiCommutativeSpecialPairMultiplier::CQuasiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d, q)!", i, j);
     592        PrintLn();
     593        PrintS("Parameter q: ");
     594        n_Write(q, r);
    595595#endif
    596596}
     
    600600{
    601601#if OUTPUT
    602         PrintS("CQuasiCommutativeSpecialPairMultiplier::~CQuasiCommutativeSpecialPairMultiplier()");
    603         PrintLn();
     602        PrintS("CQuasiCommutativeSpecialPairMultiplier::~CQuasiCommutativeSpecialPairMultiplier()");
     603        PrintLn();
    604604#endif
    605605}
     
    609609{
    610610#if OUTPUT
    611         Print("CQuasiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight);
    612         PrintLn();
    613 #endif
    614 
    615         const ring r = GetBasering();
    616 
    617         return CFormulaPowerMultiplier::ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
     611        Print("CQuasiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight);
     612        PrintLn();
     613#endif
     614
     615        const ring r = GetBasering();
     616
     617        return CFormulaPowerMultiplier::ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
    618618}
    619619
  • libpolys/polys/nc/ncSAMult.h

    r412c61 r2bf04b  
    505505class CCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier
    506506{
    507         public:
    508                 CCommutativeSpecialPairMultiplier(ring r, int i, int j);
    509                 virtual ~CCommutativeSpecialPairMultiplier();
    510 
    511                 // Exponent * Exponent
    512                 virtual poly MultiplyEE(const int expLeft, const int expRight);
     507        public:
     508                CCommutativeSpecialPairMultiplier(ring r, int i, int j);
     509                virtual ~CCommutativeSpecialPairMultiplier();
     510
     511                // Exponent * Exponent
     512                virtual poly MultiplyEE(const int expLeft, const int expRight);
    513513};
    514514
     
    516516class CAntiCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier
    517517{
    518         public:
    519                 CAntiCommutativeSpecialPairMultiplier(ring r, int i, int j);
    520                 virtual ~CAntiCommutativeSpecialPairMultiplier();
    521 
    522                 // Exponent * Exponent
    523                 virtual poly MultiplyEE(const int expLeft, const int expRight);
     518        public:
     519                CAntiCommutativeSpecialPairMultiplier(ring r, int i, int j);
     520                virtual ~CAntiCommutativeSpecialPairMultiplier();
     521
     522                // Exponent * Exponent
     523                virtual poly MultiplyEE(const int expLeft, const int expRight);
    524524};
    525525
     
    528528class CQuasiCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier
    529529{
    530         private:
    531                 const number m_q;
    532                 // TODO: make cache for some 'good' powers!?
    533 
    534   public:
    535                 CQuasiCommutativeSpecialPairMultiplier(ring r, int i, int j, number q);
    536                 virtual ~CQuasiCommutativeSpecialPairMultiplier();
    537 
    538                 // Exponent * Exponent
    539                 virtual poly MultiplyEE(const int expLeft, const int expRight);
     530        private:
     531                const number m_q;
     532                // TODO: make cache for some 'good' powers!?
     533
     534  public:
     535                CQuasiCommutativeSpecialPairMultiplier(ring r, int i, int j, number q);
     536                virtual ~CQuasiCommutativeSpecialPairMultiplier();
     537
     538                // Exponent * Exponent
     539                virtual poly MultiplyEE(const int expLeft, const int expRight);
    540540};
    541541
  • libpolys/polys/nc/old.gring.cc

    r412c61 r2bf04b  
    27112711      if ( p != NULL)
    27122712      {
    2713         q = p_One(r);
    2714         p_SetExp(q,i,1,r);
    2715         p_SetExp(q,j,1,r);
    2716         p_Setm(q,r);
    2717         if (p_LmCmp(q,p,r) != 1) /* i.e. lm(p)==xy < lm(q)==D_ij  */
    2718            {
    2719               Werror("Bad ordering at %d,%d\n",i,j);
     2713        q = p_One(r);
     2714        p_SetExp(q,i,1,r);
     2715        p_SetExp(q,j,1,r);
     2716        p_Setm(q,r);
     2717        if (p_LmCmp(q,p,r) != 1) /* i.e. lm(p)==xy < lm(q)==D_ij  */
     2718           {
     2719              Werror("Bad ordering at %d,%d\n",i,j);
    27202720#if 0 /*Singularg should not differ from Singular except in error case*/
    27212721      p_Write(p,r);
    27222722      p_Write(q,r);
    27232723#endif
    2724               report = 1;
    2725            }
    2726         p_Delete(&q,r);
    2727         p_Delete(&p,r);
    2728         p = NULL;
     2724              report = 1;
     2725           }
     2726        p_Delete(&q,r);
     2727        p_Delete(&p,r);
     2728        p = NULL;
    27292729      }
    27302730    }
     
    29312931          qN = NULL;
    29322932        else
    2933         {
    2934           if (!p_IsConstant(MATELEM(CC,i,j),curr))
     2933        {
     2934          if (!p_IsConstant(MATELEM(CC,i,j),curr))
    29352935          {
    29362936            Werror("Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])", i, j);
    29372937            return TRUE;
    29382938          }
    2939           assume(p_IsConstant(MATELEM(CC,i,j),curr));
     2939          assume(p_IsConstant(MATELEM(CC,i,j),curr));
    29402940          qN = p_GetCoeff(MATELEM(CC,i,j),curr);
    2941         }
     2941        }
    29422942
    29432943
     
    33063306      for (i=n+1; i<=rN; i++)
    33073307      {
    3308         SUF[i] = PRE[i];
    3309         PRE[i] = 0;
     3308        SUF[i] = PRE[i];
     3309        PRE[i] = 0;
    33103310      }
    33113311      res =  p_Power(p_Copy(e, r),pow, r);
  • libpolys/polys/templates/p_kBucketSetLm__T.cc

    r412c61 r2bf04b  
    161161      {
    162162        if(p_LmEqual(bucket->buckets[i], copy,r))
    163         {
     163        {
    164164          poly q=kBucketExtractLmOfBucket(bucket,i);
    165165          assume(p!=q);
  • libpolys/reporter/si_signals.h

    r412c61 r2bf04b  
    2929static inline return_type newfunc decl   \
    3030{                                        \
    31   int res = -1;                          \
     31  int res = -1;                                 \
    3232  do                                     \
    3333  {                                      \
    34     res = func args;                     \
     34    res = func args;                         \
    3535  } while((res err_domain) && (errno == EINTR));\
    3636  return res;                            \
     
    122122SI_EINTR_SAVE_FUNC(int, dup2, (int oldfd, int newfd), (oldfd, newfd))
    123123//SI_EINTR_SAVE_FUNC(int, dup3, (int oldfd, int newfd, int flags),
    124 //                 (oldfd, newfd, flags))
     124//                   (oldfd, newfd, flags))
    125125
    126126SI_EINTR_SAVE_FUNC(int, unlink, (const char *pathname), (pathname))
    127127
    128128SI_EINTR_SAVE_SCANF(int, vscanf,
    129                    (const char *format, va_list ap),
    130                    (format, ap))
     129                   (const char *format, va_list ap),
     130                   (format, ap))
    131131
    132132static inline
     
    141141
    142142SI_EINTR_SAVE_SCANF(int, vfscanf,
    143                    (FILE *stream, const char *format, va_list ap),
    144                    (stream, format, ap))
     143                   (FILE *stream, const char *format, va_list ap),
     144                   (stream, format, ap))
    145145
    146146static inline int
     
    155155
    156156SI_EINTR_SAVE_SCANF(int, vsscanf,
    157                    (const char *str, const char *format, va_list ap),
    158                    (str, format, ap))
     157                   (const char *str, const char *format, va_list ap),
     158                   (str, format, ap))
    159159
    160160static inline int
  • libpolys/tests/cxxtest/Win32Gui.h

    r412c61 r2bf04b  
    2929    public:
    3030        void enterGui( int &argc, char **argv )
    31         {
    32             parseCommandLine( argc, argv );
    33         }
     31        {
     32            parseCommandLine( argc, argv );
     33        }
    3434
    3535        void enterWorld( const WorldDescription &wd )
     
    4040        }
    4141
    42         void guiEnterSuite( const char *suiteName )
    43         {
    44             showSuiteName( suiteName );
     42        void guiEnterSuite( const char *suiteName )
     43        {
     44            showSuiteName( suiteName );
    4545            reset( _suiteStart );
    46         }
     46        }
    4747
    4848        void guiEnterTest( const char *suiteName, const char *testName )
     
    5151            setTestCaption( suiteName, testName );
    5252            showTestName( testName );
    53             showTestsDone();
     53            showTestsDone();
    5454            progressBarMessage( PBM_STEPIT );
    5555            reset( _testStart );
     
    5858        void yellowBar()
    5959        {
    60             setColor( 255, 255, 0 );
     60            setColor( 255, 255, 0 );
    6161            setIcon( IDI_WARNING );
    6262            getTotalTests();
     
    6767            if ( _startMinimized )
    6868                showMainWindow( SW_SHOWNORMAL );
    69             setColor( 255, 0, 0 );
    70             setIcon( IDI_ERROR );
     69            setColor( 255, 0, 0 );
     70            setIcon( IDI_ERROR );
    7171            getTotalTests();
    7272        }
     
    107107        {
    108108            _startMinimized = _keep = false;
    109             _title = argv[0];
     109            _title = argv[0];
    110110
    111111            for ( int i = 1; i < argc; ++ i )
     
    134134        {
    135135            _canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL );
    136                         DWORD threadId;
     136                        DWORD threadId;
    137137            _gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId );
    138138            WaitForSingleObject( _canStartTests, INFINITE );
     
    187187            HMODULE dll = LoadLibraryA( "comctl32.dll" );
    188188            if ( !dll )
    189                 return;
    190 
    191             typedef void (WINAPI *FUNC)( void );
    192             FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" );
    193             if ( !func )
    194189                return;
    195190
    196             func();
     191            typedef void (WINAPI *FUNC)( void );
     192            FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" );
     193            if ( !func )
     194                return;
     195
     196            func();
    197197        }
    198198
     
    204204            progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests );
    205205#else // No PBM_SETRANGE32, use PBM_SETRANGE
    206             progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) );
     206            progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) );
    207207#endif // PBM_SETRANGE32
    208208            progressBarMessage( PBM_SETPOS, 0 );
     
    433433        {
    434434            setStatusPart( STATUS_SUITE_NAME, suiteName );
    435         }
    436 
    437         void showTestName( const char *testName )
    438         {
     435        }
     436
     437        void showTestName( const char *testName )
     438        {
    439439            setStatusPart( STATUS_TEST_NAME, testName );
    440         }
    441 
    442         void showTestsDone()
    443         {
     440        }
     441
     442        void showTestsDone()
     443        {
    444444            wsprintfA( _statusTestsDone, "%u of %s (%u%%)",
    445445                       _testsDone, _strTotalTests,
  • old_modgen/modgen/getopt.c

    r412c61 r2bf04b  
    44   before changing it!
    55   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
    6         Free Software Foundation, Inc.
     6           Free Software Foundation, Inc.
    77   This file is part of the GNU C Library.
    88
     
    6666/* This needs to come after some library #include
    6767   to get __GNU_LIBRARY__ defined.  */
    68 #ifdef  __GNU_LIBRARY__
     68#ifdef        __GNU_LIBRARY__
    6969/* Don't include stdlib.h for non-GNU C libraries because some of them
    7070   contain conflicting prototypes for getopt.  */
    7171# include <stdlib.h>
    7272# include <unistd.h>
    73 #endif  /* GNU C library.  */
     73#endif        /* GNU C library.  */
    7474
    7575#ifdef VMS
     
    8585#  include <libintl.h>
    8686#  ifndef _
    87 #   define _(msgid)     gettext (msgid)
     87#   define _(msgid)        gettext (msgid)
    8888#  endif
    8989# else
    90 #  define _(msgid)      (msgid)
     90#  define _(msgid)        (msgid)
    9191# endif
    9292#endif
     
    195195
    196196
    197 #ifdef  __GNU_LIBRARY__
     197#ifdef        __GNU_LIBRARY__
    198198/* We want to avoid inclusion of string.h with non-GNU libraries
    199199   because there are many ways it can cause trouble.
     
    201201   in GCC.  */
    202202# include <string.h>
    203 # define my_index       strchr
     203# define my_index        strchr
    204204#else
    205205
     
    225225    {
    226226      if (*str == chr)
    227         return (char *) str;
     227        return (char *) str;
    228228      str++;
    229229    }
     
    275275# ifdef USE_NONOPTION_FLAGS
    276276#  define SWAP_FLAGS(ch1, ch2) \
    277   if (nonoption_flags_len > 0)                                                \
    278     {                                                                         \
    279       char __tmp = __getopt_nonoption_flags[ch1];                             \
    280       __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \
    281       __getopt_nonoption_flags[ch2] = __tmp;                                  \
     277  if (nonoption_flags_len > 0)                                                      \
     278    {                                                                              \
     279      char __tmp = __getopt_nonoption_flags[ch1];                              \
     280      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];              \
     281      __getopt_nonoption_flags[ch2] = __tmp;                                      \
    282282    }
    283283# else
    284284#  define SWAP_FLAGS(ch1, ch2)
    285285# endif
    286 #else   /* !_LIBC */
     286#else        /* !_LIBC */
    287287# define SWAP_FLAGS(ch1, ch2)
    288 #endif  /* _LIBC */
     288#endif        /* _LIBC */
    289289
    290290/* Exchange two adjacent subsequences of ARGV.
     
    322322    {
    323323      /* We must extend the array.  The user plays games with us and
    324         presents new arguments.  */
     324        presents new arguments.  */
    325325      char *new_str = malloc (top + 1);
    326326      if (new_str == NULL)
    327         nonoption_flags_len = nonoption_flags_max_len = 0;
     327        nonoption_flags_len = nonoption_flags_max_len = 0;
    328328      else
    329         {
    330           memset (__mempcpy (new_str, __getopt_nonoption_flags,
    331                              nonoption_flags_max_len),
    332                   '\0', top + 1 - nonoption_flags_max_len);
    333           nonoption_flags_max_len = top + 1;
    334           __getopt_nonoption_flags = new_str;
    335         }
     329        {
     330          memset (__mempcpy (new_str, __getopt_nonoption_flags,
     331                             nonoption_flags_max_len),
     332                  '\0', top + 1 - nonoption_flags_max_len);
     333          nonoption_flags_max_len = top + 1;
     334          __getopt_nonoption_flags = new_str;
     335        }
    336336    }
    337337#endif
     
    340340    {
    341341      if (top - middle > middle - bottom)
    342         {
    343           /* Bottom segment is the short one.  */
    344           int len = middle - bottom;
    345           register int i;
    346 
    347           /* Swap it with the top part of the top segment.  */
    348           for (i = 0; i < len; i++)
    349             {
    350               tem = argv[bottom + i];
    351               argv[bottom + i] = argv[top - (middle - bottom) + i];
    352               argv[top - (middle - bottom) + i] = tem;
    353               SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
    354             }
    355           /* Exclude the moved bottom segment from further swapping.  */
    356           top -= len;
    357         }
     342        {
     343          /* Bottom segment is the short one.  */
     344          int len = middle - bottom;
     345          register int i;
     346
     347          /* Swap it with the top part of the top segment.  */
     348          for (i = 0; i < len; i++)
     349            {
     350              tem = argv[bottom + i];
     351              argv[bottom + i] = argv[top - (middle - bottom) + i];
     352              argv[top - (middle - bottom) + i] = tem;
     353              SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
     354            }
     355          /* Exclude the moved bottom segment from further swapping.  */
     356          top -= len;
     357        }
    358358      else
    359         {
    360           /* Top segment is the short one.  */
    361           int len = top - middle;
    362           register int i;
    363 
    364           /* Swap it with the bottom part of the bottom segment.  */
    365           for (i = 0; i < len; i++)
    366             {
    367               tem = argv[bottom + i];
    368               argv[bottom + i] = argv[middle + i];
    369               argv[middle + i] = tem;
    370               SWAP_FLAGS (bottom + i, middle + i);
    371             }
    372           /* Exclude the moved top segment from further swapping.  */
    373           bottom += len;
    374         }
     359        {
     360          /* Top segment is the short one.  */
     361          int len = top - middle;
     362          register int i;
     363
     364          /* Swap it with the bottom part of the bottom segment.  */
     365          for (i = 0; i < len; i++)
     366            {
     367              tem = argv[bottom + i];
     368              argv[bottom + i] = argv[middle + i];
     369              argv[middle + i] = tem;
     370              SWAP_FLAGS (bottom + i, middle + i);
     371            }
     372          /* Exclude the moved top segment from further swapping.  */
     373          bottom += len;
     374        }
    375375    }
    376376
     
    424424    {
    425425      if (nonoption_flags_max_len == 0)
    426         {
    427           if (__getopt_nonoption_flags == NULL
    428               || __getopt_nonoption_flags[0] == '\0')
    429             nonoption_flags_max_len = -1;
    430           else
    431             {
    432               const char *orig_str = __getopt_nonoption_flags;
    433               int len = nonoption_flags_max_len = strlen (orig_str);
    434               if (nonoption_flags_max_len < argc)
    435                 nonoption_flags_max_len = argc;
    436               __getopt_nonoption_flags =
    437                 (char *) malloc (nonoption_flags_max_len);
    438               if (__getopt_nonoption_flags == NULL)
    439                 nonoption_flags_max_len = -1;
    440               else
    441                 memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
    442                         '\0', nonoption_flags_max_len - len);
    443             }
    444         }
     426        {
     427          if (__getopt_nonoption_flags == NULL
     428              || __getopt_nonoption_flags[0] == '\0')
     429            nonoption_flags_max_len = -1;
     430          else
     431            {
     432              const char *orig_str = __getopt_nonoption_flags;
     433              int len = nonoption_flags_max_len = strlen (orig_str);
     434              if (nonoption_flags_max_len < argc)
     435                nonoption_flags_max_len = argc;
     436              __getopt_nonoption_flags =
     437                (char *) malloc (nonoption_flags_max_len);
     438              if (__getopt_nonoption_flags == NULL)
     439                nonoption_flags_max_len = -1;
     440              else
     441                memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
     442                        '\0', nonoption_flags_max_len - len);
     443            }
     444        }
    445445      nonoption_flags_len = nonoption_flags_max_len;
    446446    }
     
    530530    {
    531531      if (optind == 0)
    532         optind = 1;     /* Don't scan ARGV[0], the program name.  */
     532        optind = 1;        /* Don't scan ARGV[0], the program name.  */
    533533      optstring = _getopt_initialize (argc, argv, optstring);
    534534      __getopt_initialized = 1;
     
    540540     is only used when the used in the GNU libc.  */
    541541#if defined _LIBC && defined USE_NONOPTION_FLAGS
    542 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \
    543                       || (optind < nonoption_flags_len                        \
    544                           && __getopt_nonoption_flags[optind] == '1'))
     542# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'              \
     543                      || (optind < nonoption_flags_len                              \
     544                          && __getopt_nonoption_flags[optind] == '1'))
    545545#else
    546546# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
     
    552552
    553553      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
    554         moved back by the user (who may also have changed the arguments).  */
     554        moved back by the user (who may also have changed the arguments).  */
    555555      if (last_nonopt > optind)
    556         last_nonopt = optind;
     556        last_nonopt = optind;
    557557      if (first_nonopt > optind)
    558         first_nonopt = optind;
     558        first_nonopt = optind;
    559559
    560560      if (ordering == PERMUTE)
    561         {
    562           /* If we have just processed some options following some non-options,
    563              exchange them so that the options come first.  */
    564 
    565           if (first_nonopt != last_nonopt && last_nonopt != optind)
    566             exchange ((char **) argv);
    567           else if (last_nonopt != optind)
    568             first_nonopt = optind;
    569 
    570           /* Skip any additional non-options
    571              and extend the range of non-options previously skipped.  */
    572 
    573           while (optind < argc && NONOPTION_P)
    574             optind++;
    575           last_nonopt = optind;
    576         }
     561        {
     562          /* If we have just processed some options following some non-options,
     563             exchange them so that the options come first.  */
     564
     565          if (first_nonopt != last_nonopt && last_nonopt != optind)
     566            exchange ((char **) argv);
     567          else if (last_nonopt != optind)
     568            first_nonopt = optind;
     569
     570          /* Skip any additional non-options
     571             and extend the range of non-options previously skipped.  */
     572
     573          while (optind < argc && NONOPTION_P)
     574            optind++;
     575          last_nonopt = optind;
     576        }
    577577
    578578      /* The special ARGV-element `--' means premature end of options.
    579         Skip it like a null option,
    580         then exchange with previous non-options as if it were an option,
    581         then skip everything else like a non-option.  */
     579        Skip it like a null option,
     580        then exchange with previous non-options as if it were an option,
     581        then skip everything else like a non-option.  */
    582582
    583583      if (optind != argc && !strcmp (argv[optind], "--"))
    584         {
    585           optind++;
    586 
    587           if (first_nonopt != last_nonopt && last_nonopt != optind)
    588             exchange ((char **) argv);
    589           else if (first_nonopt == last_nonopt)
    590             first_nonopt = optind;
    591           last_nonopt = argc;
    592 
    593           optind = argc;
    594         }
     584        {
     585          optind++;
     586
     587          if (first_nonopt != last_nonopt && last_nonopt != optind)
     588            exchange ((char **) argv);
     589          else if (first_nonopt == last_nonopt)
     590            first_nonopt = optind;
     591          last_nonopt = argc;
     592
     593          optind = argc;
     594        }
    595595
    596596      /* If we have done all the ARGV-elements, stop the scan
    597         and back over any non-options that we skipped and permuted.  */
     597        and back over any non-options that we skipped and permuted.  */
    598598
    599599      if (optind == argc)
    600         {
    601           /* Set the next-arg-index to point at the non-options
    602              that we previously skipped, so the caller will digest them.  */
    603           if (first_nonopt != last_nonopt)
    604             optind = first_nonopt;
    605           return -1;
    606         }
     600        {
     601          /* Set the next-arg-index to point at the non-options
     602             that we previously skipped, so the caller will digest them.  */
     603          if (first_nonopt != last_nonopt)
     604            optind = first_nonopt;
     605          return -1;
     606        }
    607607
    608608      /* If we have come to a non-option and did not permute it,
    609         either stop the scan or describe it to the caller and pass it by.  */
     609        either stop the scan or describe it to the caller and pass it by.  */
    610610
    611611      if (NONOPTION_P)
    612         {
    613           if (ordering == REQUIRE_ORDER)
    614             return -1;
    615           optarg = argv[optind++];
    616           return 1;
    617         }
     612        {
     613          if (ordering == REQUIRE_ORDER)
     614            return -1;
     615          optarg = argv[optind++];
     616          return 1;
     617        }
    618618
    619619      /* We have found another option-ARGV-element.
    620         Skip the initial punctuation.  */
     620        Skip the initial punctuation.  */
    621621
    622622      nextchar = (argv[optind] + 1
    623                   + (longopts != NULL && argv[optind][1] == '-'));
     623                  + (longopts != NULL && argv[optind][1] == '-'));
    624624    }
    625625
     
    641641  if (longopts != NULL
    642642      && (argv[optind][1] == '-'
    643           || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
     643          || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
    644644    {
    645645      char *nameend;
     
    652652
    653653      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
    654         /* Do nothing.  */ ;
     654        /* Do nothing.  */ ;
    655655
    656656      /* Test all long options for either exact match
    657         or abbreviated matches.  */
     657        or abbreviated matches.  */
    658658      for (p = longopts, option_index = 0; p->name; p++, option_index++)
    659         if (!strncmp (p->name, nextchar, nameend - nextchar))
    660           {
    661             if ((unsigned int) (nameend - nextchar)
    662                 == (unsigned int) strlen (p->name))
    663               {
    664                 /* Exact match found.  */
    665                 pfound = p;
    666                 indfound = option_index;
    667                 exact = 1;
    668                 break;
    669               }
    670             else if (pfound == NULL)
    671               {
    672                 /* First nonexact match found.  */
    673                 pfound = p;
    674                 indfound = option_index;
    675               }
    676             else if (long_only
    677                      || pfound->has_arg != p->has_arg
    678                      || pfound->flag != p->flag
    679                      || pfound->val != p->val)
    680               /* Second or later nonexact match found.  */
    681               ambig = 1;
    682           }
     659        if (!strncmp (p->name, nextchar, nameend - nextchar))
     660          {
     661            if ((unsigned int) (nameend - nextchar)
     662                == (unsigned int) strlen (p->name))
     663              {
     664                /* Exact match found.  */
     665                pfound = p;
     666                indfound = option_index;
     667                exact = 1;
     668                break;
     669              }
     670            else if (pfound == NULL)
     671              {
     672                /* First nonexact match found.  */
     673                pfound = p;
     674                indfound = option_index;
     675              }
     676            else if (long_only
     677                     || pfound->has_arg != p->has_arg
     678                     || pfound->flag != p->flag
     679                     || pfound->val != p->val)
     680              /* Second or later nonexact match found.  */
     681              ambig = 1;
     682          }
    683683
    684684      if (ambig && !exact)
    685         {
    686           if (print_errors)
    687             fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
    688                      argv[0], argv[optind]);
    689           nextchar += strlen (nextchar);
    690           optind++;
    691           optopt = 0;
    692           return '?';
    693         }
     685        {
     686          if (print_errors)
     687            fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
     688                     argv[0], argv[optind]);
     689          nextchar += strlen (nextchar);
     690          optind++;
     691          optopt = 0;
     692          return '?';
     693        }
    694694
    695695      if (pfound != NULL)
    696         {
    697           option_index = indfound;
    698           optind++;
    699           if (*nameend)
    700             {
    701               /* Don't test has_arg with >, because some C compilers don't
    702                 allow it to be used on enums.  */
    703               if (pfound->has_arg)
    704                 optarg = nameend + 1;
    705               else
    706                 {
    707                   if (print_errors)
    708                     {
    709                       if (argv[optind - 1][1] == '-')
    710                         /* --option */
    711                         fprintf (stderr,
    712                                 _("%s: option `--%s' doesn't allow an argument\n"),
    713                                 argv[0], pfound->name);
    714                       else
    715                         /* +option or -option */
    716                         fprintf (stderr,
    717                                 _("%s: option `%c%s' doesn't allow an argument\n"),
    718                                 argv[0], argv[optind - 1][0], pfound->name);
    719                     }
    720 
    721                   nextchar += strlen (nextchar);
    722 
    723                   optopt = pfound->val;
    724                   return '?';
    725                 }
    726             }
    727           else if (pfound->has_arg == 1)
    728             {
    729               if (optind < argc)
    730                 optarg = argv[optind++];
    731               else
    732                 {
    733                   if (print_errors)
    734                     fprintf (stderr,
    735                            _("%s: option `%s' requires an argument\n"),
    736                            argv[0], argv[optind - 1]);
    737                   nextchar += strlen (nextchar);
    738                   optopt = pfound->val;
    739                   return optstring[0] == ':' ? ':' : '?';
    740                 }
    741             }
    742           nextchar += strlen (nextchar);
    743           if (longind != NULL)
    744             *longind = option_index;
    745           if (pfound->flag)
    746             {
    747               *(pfound->flag) = pfound->val;
    748               return 0;
    749             }
    750           return pfound->val;
    751         }
     696        {
     697          option_index = indfound;
     698          optind++;
     699          if (*nameend)
     700            {
     701              /* Don't test has_arg with >, because some C compilers don't
     702                allow it to be used on enums.  */
     703              if (pfound->has_arg)
     704                optarg = nameend + 1;
     705              else
     706                {
     707                  if (print_errors)
     708                    {
     709                      if (argv[optind - 1][1] == '-')
     710                        /* --option */
     711                        fprintf (stderr,
     712                                _("%s: option `--%s' doesn't allow an argument\n"),
     713                                argv[0], pfound->name);
     714                      else
     715                        /* +option or -option */
     716                        fprintf (stderr,
     717                                _("%s: option `%c%s' doesn't allow an argument\n"),
     718                                argv[0], argv[optind - 1][0], pfound->name);
     719                    }
     720
     721                  nextchar += strlen (nextchar);
     722
     723                  optopt = pfound->val;
     724                  return '?';
     725                }
     726            }
     727          else if (pfound->has_arg == 1)
     728            {
     729              if (optind < argc)
     730                optarg = argv[optind++];
     731              else
     732                {
     733                  if (print_errors)
     734                    fprintf (stderr,
     735                           _("%s: option `%s' requires an argument\n"),
     736                           argv[0], argv[optind - 1]);
     737                  nextchar += strlen (nextchar);
     738                  optopt = pfound->val;
     739                  return optstring[0] == ':' ? ':' : '?';
     740                }
     741            }
     742          nextchar += strlen (nextchar);
     743          if (longind != NULL)
     744            *longind = option_index;
     745          if (pfound->flag)
     746            {
     747              *(pfound->flag) = pfound->val;
     748              return 0;
     749            }
     750          return pfound->val;
     751        }
    752752
    753753      /* Can't find it as a long option.  If this is not getopt_long_only,
    754         or the option starts with '--' or is not a valid short
    755         option, then it's an error.
    756         Otherwise interpret it as a short option.  */
     754        or the option starts with '--' or is not a valid short
     755        option, then it's an error.
     756        Otherwise interpret it as a short option.  */
    757757      if (!long_only || argv[optind][1] == '-'
    758           || my_index (optstring, *nextchar) == NULL)
    759         {
    760           if (print_errors)
    761             {
    762               if (argv[optind][1] == '-')
    763                 /* --option */
    764                 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
    765                         argv[0], nextchar);
    766               else
    767                 /* +option or -option */
    768                 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
    769                         argv[0], argv[optind][0], nextchar);
    770             }
    771           nextchar = (char *) "";
    772           optind++;
    773           optopt = 0;
    774           return '?';
    775         }
     758          || my_index (optstring, *nextchar) == NULL)
     759        {
     760          if (print_errors)
     761            {
     762              if (argv[optind][1] == '-')
     763                /* --option */
     764                fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
     765                        argv[0], nextchar);
     766              else
     767                /* +option or -option */
     768                fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
     769                        argv[0], argv[optind][0], nextchar);
     770            }
     771          nextchar = (char *) "";
     772          optind++;
     773          optopt = 0;
     774          return '?';
     775        }
    776776    }
    777777
     
    788788    if (temp == NULL || c == ':')
    789789      {
    790         if (print_errors)
    791           {
    792             if (posixly_correct)
    793               /* 1003.2 specifies the format of this message.  */
    794               fprintf (stderr, _("%s: illegal option -- %c\n"),
    795                        argv[0], c);
    796             else
    797               fprintf (stderr, _("%s: invalid option -- %c\n"),
    798                        argv[0], c);
    799           }
    800         optopt = c;
    801         return '?';
     790        if (print_errors)
     791          {
     792            if (posixly_correct)
     793              /* 1003.2 specifies the format of this message.  */
     794              fprintf (stderr, _("%s: illegal option -- %c\n"),
     795                       argv[0], c);
     796            else
     797              fprintf (stderr, _("%s: invalid option -- %c\n"),
     798                       argv[0], c);
     799          }
     800        optopt = c;
     801        return '?';
    802802      }
    803803    /* Convenience. Treat POSIX -W foo same as long option --foo */
    804804    if (temp[0] == 'W' && temp[1] == ';')
    805805      {
    806         char *nameend;
    807         const struct option *p;
    808         const struct option *pfound = NULL;
    809         int exact = 0;
    810         int ambig = 0;
    811         int indfound = 0;
    812         int option_index;
    813 
    814         /* This is an option that requires an argument.  */
    815         if (*nextchar != '\0')
    816           {
    817             optarg = nextchar;
    818             /* If we end this ARGV-element by taking the rest as an arg,
    819                we must advance to the next element now.  */
    820             optind++;
    821           }
    822         else if (optind == argc)
    823           {
    824             if (print_errors)
    825               {
    826                 /* 1003.2 specifies the format of this message.  */
    827                 fprintf (stderr, _("%s: option requires an argument -- %c\n"),
    828                         argv[0], c);
    829               }
    830             optopt = c;
    831             if (optstring[0] == ':')
    832               c = ':';
    833             else
    834               c = '?';
    835             return c;
    836           }
    837         else
    838           /* We already incremented `optind' once;
    839              increment it again when taking next ARGV-elt as argument.  */
    840           optarg = argv[optind++];
    841 
    842         /* optarg is now the argument, see if it's in the
    843            table of longopts.  */
    844 
    845         for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
    846           /* Do nothing.  */ ;
    847 
    848         /* Test all long options for either exact match
    849            or abbreviated matches.  */
    850         for (p = longopts, option_index = 0; p->name; p++, option_index++)
    851           if (!strncmp (p->name, nextchar, nameend - nextchar))
    852             {
    853               if ((unsigned int) (nameend - nextchar) == strlen (p->name))
    854                 {
    855                   /* Exact match found.  */
    856                   pfound = p;
    857                   indfound = option_index;
    858                   exact = 1;
    859                   break;
    860                 }
    861               else if (pfound == NULL)
    862                 {
    863                   /* First nonexact match found.  */
    864                   pfound = p;
    865                   indfound = option_index;
    866                 }
    867               else
    868                 /* Second or later nonexact match found.  */
    869                 ambig = 1;
    870             }
    871         if (ambig && !exact)
    872           {
    873             if (print_errors)
    874               fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
    875                        argv[0], argv[optind]);
    876             nextchar += strlen (nextchar);
    877             optind++;
    878             return '?';
    879           }
    880         if (pfound != NULL)
    881           {
    882             option_index = indfound;
    883             if (*nameend)
    884               {
    885                 /* Don't test has_arg with >, because some C compilers don't
    886                    allow it to be used on enums.  */
    887                 if (pfound->has_arg)
    888                   optarg = nameend + 1;
    889                 else
    890                   {
    891                     if (print_errors)
    892                       fprintf (stderr, _("\
     806        char *nameend;
     807        const struct option *p;
     808        const struct option *pfound = NULL;
     809        int exact = 0;
     810        int ambig = 0;
     811        int indfound = 0;
     812        int option_index;
     813
     814        /* This is an option that requires an argument.  */
     815        if (*nextchar != '\0')
     816          {
     817            optarg = nextchar;
     818            /* If we end this ARGV-element by taking the rest as an arg,
     819               we must advance to the next element now.  */
     820            optind++;
     821          }
     822        else if (optind == argc)
     823          {
     824            if (print_errors)
     825              {
     826                /* 1003.2 specifies the format of this message.  */
     827                fprintf (stderr, _("%s: option requires an argument -- %c\n"),
     828                        argv[0], c);
     829              }
     830            optopt = c;
     831            if (optstring[0] == ':')
     832              c = ':';
     833            else
     834              c = '?';
     835            return c;
     836          }
     837        else
     838          /* We already incremented `optind' once;
     839             increment it again when taking next ARGV-elt as argument.  */
     840          optarg = argv[optind++];
     841
     842        /* optarg is now the argument, see if it's in the
     843           table of longopts.  */
     844
     845        for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
     846          /* Do nothing.  */ ;
     847
     848        /* Test all long options for either exact match
     849           or abbreviated matches.  */
     850        for (p = longopts, option_index = 0; p->name; p++, option_index++)
     851          if (!strncmp (p->name, nextchar, nameend - nextchar))
     852            {
     853              if ((unsigned int) (nameend - nextchar) == strlen (p->name))
     854                {
     855                  /* Exact match found.  */
     856                  pfound = p;
     857                  indfound = option_index;
     858                  exact = 1;
     859                  break;
     860                }
     861              else if (pfound == NULL)
     862                {
     863                  /* First nonexact match found.  */
     864                  pfound = p;
     865                  indfound = option_index;
     866                }
     867              else
     868                /* Second or later nonexact match found.  */
     869                ambig = 1;
     870            }
     871        if (ambig && !exact)
     872          {
     873            if (print_errors)
     874              fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
     875                       argv[0], argv[optind]);
     876            nextchar += strlen (nextchar);
     877            optind++;
     878            return '?';
     879          }
     880        if (pfound != NULL)
     881          {
     882            option_index = indfound;
     883            if (*nameend)
     884              {
     885                /* Don't test has_arg with >, because some C compilers don't
     886                   allow it to be used on enums.  */
     887                if (pfound->has_arg)
     888                  optarg = nameend + 1;
     889                else
     890                  {
     891                    if (print_errors)
     892                      fprintf (stderr, _("\
    893893%s: option `-W %s' doesn't allow an argument\n"),
    894                                argv[0], pfound->name);
    895 
    896                     nextchar += strlen (nextchar);
    897                     return '?';
    898                   }
    899               }
    900             else if (pfound->has_arg == 1)
    901               {
    902                 if (optind < argc)
    903                   optarg = argv[optind++];
    904                 else
    905                   {
    906                     if (print_errors)
    907                       fprintf (stderr,
    908                                _("%s: option `%s' requires an argument\n"),
    909                                argv[0], argv[optind - 1]);
    910                     nextchar += strlen (nextchar);
    911                     return optstring[0] == ':' ? ':' : '?';
    912                   }
    913               }
    914             nextchar += strlen (nextchar);
    915             if (longind != NULL)
    916               *longind = option_index;
    917             if (pfound->flag)
    918               {
    919                 *(pfound->flag) = pfound->val;
    920                 return 0;
    921               }
    922             return pfound->val;
    923           }
    924           nextchar = NULL;
    925           return 'W';   /* Let the application handle it.   */
     894                               argv[0], pfound->name);
     895
     896                    nextchar += strlen (nextchar);
     897                    return '?';
     898                  }
     899              }
     900            else if (pfound->has_arg == 1)
     901              {
     902                if (optind < argc)
     903                  optarg = argv[optind++];
     904                else
     905                  {
     906                    if (print_errors)
     907                      fprintf (stderr,
     908                               _("%s: option `%s' requires an argument\n"),
     909                               argv[0], argv[optind - 1]);
     910                    nextchar += strlen (nextchar);
     911                    return optstring[0] == ':' ? ':' : '?';
     912                  }
     913              }
     914            nextchar += strlen (nextchar);
     915            if (longind != NULL)
     916              *longind = option_index;
     917            if (pfound->flag)
     918              {
     919                *(pfound->flag) = pfound->val;
     920                return 0;
     921              }
     922            return pfound->val;
     923          }
     924          nextchar = NULL;
     925          return 'W';        /* Let the application handle it.   */
    926926      }
    927927    if (temp[1] == ':')
    928928      {
    929         if (temp[2] == ':')
    930           {
    931             /* This is an option that accepts an argument optionally.  */
    932             if (*nextchar != '\0')
    933               {
    934                 optarg = nextchar;
    935                 optind++;
    936               }
    937             else
    938               optarg = NULL;
    939             nextchar = NULL;
    940           }
    941         else
    942           {
    943             /* This is an option that requires an argument.  */
    944             if (*nextchar != '\0')
    945               {
    946                 optarg = nextchar;
    947                 /* If we end this ARGV-element by taking the rest as an arg,
    948                    we must advance to the next element now.  */
    949                 optind++;
    950               }
    951             else if (optind == argc)
    952               {
    953                 if (print_errors)
    954                   {
    955                     /* 1003.2 specifies the format of this message.  */
    956                     fprintf (stderr,
    957                              _("%s: option requires an argument -- %c\n"),
    958                              argv[0], c);
    959                   }
    960                 optopt = c;
    961                 if (optstring[0] == ':')
    962                   c = ':';
    963                 else
    964                   c = '?';
    965               }
    966             else
    967               /* We already incremented `optind' once;
    968                 increment it again when taking next ARGV-elt as argument.  */
    969               optarg = argv[optind++];
    970             nextchar = NULL;
    971           }
     929        if (temp[2] == ':')
     930          {
     931            /* This is an option that accepts an argument optionally.  */
     932            if (*nextchar != '\0')
     933              {
     934                optarg = nextchar;
     935                optind++;
     936              }
     937            else
     938              optarg = NULL;
     939            nextchar = NULL;
     940          }
     941        else
     942          {
     943            /* This is an option that requires an argument.  */
     944            if (*nextchar != '\0')
     945              {
     946                optarg = nextchar;
     947                /* If we end this ARGV-element by taking the rest as an arg,
     948                   we must advance to the next element now.  */
     949                optind++;
     950              }
     951            else if (optind == argc)
     952              {
     953                if (print_errors)
     954                  {
     955                    /* 1003.2 specifies the format of this message.  */
     956                    fprintf (stderr,
     957                             _("%s: option requires an argument -- %c\n"),
     958                             argv[0], c);
     959                  }
     960                optopt = c;
     961                if (optstring[0] == ':')
     962                  c = ':';
     963                else
     964                  c = '?';
     965              }
     966            else
     967              /* We already incremented `optind' once;
     968                increment it again when taking next ARGV-elt as argument.  */
     969              optarg = argv[optind++];
     970            nextchar = NULL;
     971          }
    972972      }
    973973    return c;
     
    982982{
    983983  return _getopt_internal (argc, argv, optstring,
    984                            (const struct option *) 0,
    985                            (int *) 0,
    986                            0);
     984                           (const struct option *) 0,
     985                           (int *) 0,
     986                           0);
    987987}
    988988
    989 #endif  /* Not ELIDE_CODE.  */
     989#endif        /* Not ELIDE_CODE.  */
    990990
    991991
     
    10091009      c = getopt (argc, argv, "abc:d:0123456789");
    10101010      if (c == -1)
    1011         break;
     1011        break;
    10121012
    10131013      switch (c)
    1014         {
    1015         case '0':
    1016         case '1':
    1017         case '2':
    1018         case '3':
    1019         case '4':
    1020         case '5':
    1021         case '6':
    1022         case '7':
    1023         case '8':
    1024         case '9':
    1025           if (digit_optind != 0 && digit_optind != this_option_optind)
    1026             printf ("digits occur in two different argv-elements.\n");
    1027           digit_optind = this_option_optind;
    1028           printf ("option %c\n", c);
    1029           break;
    1030 
    1031         case 'a':
    1032           printf ("option a\n");
    1033           break;
    1034 
    1035         case 'b':
    1036           printf ("option b\n");
    1037           break;
    1038 
    1039         case 'c':
    1040           printf ("option c with value `%s'\n", optarg);
    1041           break;
    1042 
    1043         case '?':
    1044           break;
    1045 
    1046         default:
    1047           printf ("?? getopt returned character code 0%o ??\n", c);
    1048         }
     1014        {
     1015        case '0':
     1016        case '1':
     1017        case '2':
     1018        case '3':
     1019        case '4':
     1020        case '5':
     1021        case '6':
     1022        case '7':
     1023        case '8':
     1024        case '9':
     1025          if (digit_optind != 0 && digit_optind != this_option_optind)
     1026            printf ("digits occur in two different argv-elements.\n");
     1027          digit_optind = this_option_optind;
     1028          printf ("option %c\n", c);
     1029          break;
     1030
     1031        case 'a':
     1032          printf ("option a\n");
     1033          break;
     1034
     1035        case 'b':
     1036          printf ("option b\n");
     1037          break;
     1038
     1039        case 'c':
     1040          printf ("option c with value `%s'\n", optarg);
     1041          break;
     1042
     1043        case '?':
     1044          break;
     1045
     1046        default:
     1047          printf ("?? getopt returned character code 0%o ??\n", c);
     1048        }
    10491049    }
    10501050
     
    10531053      printf ("non-option ARGV-elements: ");
    10541054      while (optind < argc)
    1055         printf ("%s ", argv[optind++]);
     1055        printf ("%s ", argv[optind++]);
    10561056      printf ("\n");
    10571057    }
  • old_modgen/modgen/main.cc

    r412c61 r2bf04b  
    117117                   break;
    118118         default:
    119                    printf("\t-%c (--%s) %s\n", long_options[i].val,
    120                       long_options[i].name, "<argument>");
     119                   printf("\t-%c (--%s) %s\n", long_options[i].val,
     120                      long_options[i].name, "<argument>");
    121121      }
    122122    } else
     
    147147        case 'v' : trace=1; break;
    148148        case 'm' : do_create_makefile = 0; break;
    149         case 'i' : inst_dir=optarg; break;
    150         case 's' : do_create_srcdir = 0; break;
     149        case 'i' : inst_dir=optarg; break;
     150        case 's' : do_create_srcdir = 0; break;
    151151
    152152