Changeset 0d9122 in git


Ignore:
Timestamp:
Sep 26, 2016, 11:33:31 AM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
f9b975ad27b583d3227de1370bf9e4f15adc8b3d
Parents:
e7280459b6e5e470329f3501903627ef40236156
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-26 11:33:31+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-26 11:59:23+02:00
Message:
moved all checks for r->OrdSgn to rCheckOrdSgn, remove rHighSet
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/ring.cc

    re72804 r0d9122  
    30253025}
    30263026
    3027 /*2
    3028 * sets r->MixedOrder and r->ComponentOrder for orderings with more than one block
    3029 * block of variables (ip is the block number, o_r the number of the ordering)
    3030 * o is the position of the orderingering in r
    3031 */
    3032 static void rHighSet(ring r, int o_r, int o)
    3033 {
    3034   switch(o_r)
    3035   {
    3036     case ringorder_lp:
    3037     case ringorder_dp:
    3038     case ringorder_Dp:
    3039     case ringorder_wp:
    3040     case ringorder_Wp:
    3041     case ringorder_rp:
    3042     case ringorder_a:
    3043     case ringorder_aa:
    3044     case ringorder_am:
    3045     case ringorder_a64:
    3046       if (r->OrdSgn==-1) r->MixedOrder=TRUE;
    3047       break;
    3048     case ringorder_ls:
    3049     case ringorder_rs:
    3050     case ringorder_ds:
    3051     case ringorder_Ds:
    3052     case ringorder_s:
    3053       break;
    3054     case ringorder_ws:
    3055     case ringorder_Ws:
    3056       if (r->wvhdl[o]!=NULL)
    3057       {
    3058         int i;
    3059         for(i=r->block1[o]-r->block0[o];i>=0;i--)
    3060           if (r->wvhdl[o][i]<0) { r->MixedOrder=2; break; }
    3061       }
    3062       break;
    3063     case ringorder_c:
    3064       r->ComponentOrder=1;
    3065       break;
    3066     case ringorder_C:
    3067     case ringorder_S:
    3068       r->ComponentOrder=TRUE;
    3069       break;
    3070     case ringorder_M:
    3071       r->LexOrder=TRUE;
    3072       break;
    3073     case ringorder_IS:
    3074     { // TODO: What is r->ComponentOrder???
    3075 //      r->MixedOrder=TRUE;
    3076       if( r->block0[o] != 0 ) // Suffix has the component
    3077         r->ComponentOrder = r->block0[o];
    3078 /*      else // Prefix has level...
    3079         r->ComponentOrder=-1;
    3080 */
    3081       // TODO: think about this a bit...!?
    3082       break;
    3083     }
    3084 
    3085     default:
    3086       dReportError("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
    3087   }
    3088 }
    3089 
    30903027static void rSetFirstWv(ring r, int i, int* order, int* block1, int** wvhdl)
    30913028{
     
    31473084}
    31483085
    3149 // set pFDeg, pLDeg, MixOrder, ComponentOrder, etc
     3086// set pFDeg, pLDeg, requires OrdSgn already set
    31503087static void rSetDegStuff(ring r)
    31513088{
     
    31633100  }
    31643101  r->LexOrder = FALSE;
    3165   r->MixedOrder = FALSE;
    3166   r->ComponentOrder = 1;
    31673102  r->pFDeg = p_Totaldegree;
    31683103  r->pLDeg = (r->OrdSgn == 1 ? pLDegb : pLDeg0);
     
    32823217      rSetFirstWv(r, 0, order, block1, wvhdl);
    32833218
    3284     /*the number of orderings:*/
    3285     int i = 0; while (order[++i] != 0);
    3286 
    3287     do
    3288     {
    3289       i--;
    3290       rHighSet(r, order[i],i);
    3291     }
    3292     while (i != 0);
    3293 
    32943219    if ((order[0]!=ringorder_c)
    32953220        && (order[0]!=ringorder_C)
     
    33273252  // in Old/sre.tst
    33283253  rOptimizeLDeg(r); // also sets r->pLDegOrig
    3329 
    33303254}
    33313255
     
    33943318}
    33953319
    3396 static void rCheckOrdSgn(ring r,int i/*current block*/);
     3320static void rCheckOrdSgn(ring r,int i/*last block*/);
    33973321
    33983322/* -------------------------------------------------------- */
     
    34473371  r->ExpPerLong = BIT_SIZEOF_LONG / bits;
    34483372  r->divmask=rGetDivMask(bits);
    3449   if (r->OrdSgn!=-1) r->OrdSgn=1; //rCheckOrdSgn will changed that, if needed
    34503373
    34513374  // will be used for ordsgn:
     
    34763399        rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
    34773400                   r->wvhdl[i]);
    3478         rCheckOrdSgn(r,i);
    34793401        typ_i++;
    34803402        break;
     
    34833405        rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
    34843406                   r->wvhdl[i]);
    3485         rCheckOrdSgn(r,i);
    34863407        typ_i++;
    34873408        break;
     
    34963417        rO_Align(j, j_bits);
    34973418        rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
     3419        r->ComponentOrder=1;
    34983420        break;
    34993421
     
    35013423        rO_Align(j, j_bits);
    35023424        rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
     3425        r->ComponentOrder=-1;
    35033426        break;
    35043427
     
    35143437            typ_i++;
    35153438          }
    3516           rCheckOrdSgn(r,i);
    35173439          break;
    35183440        }
     
    35263448        rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
    35273449                       tmp_ordsgn,v, bits, -1);
    3528         rCheckOrdSgn(r,i);
    35293450        break;
    35303451
     
    35323453        rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
    35333454                       tmp_ordsgn,v, bits, -1);
    3534         rCheckOrdSgn(r,i);
    35353455        break;
    35363456
     
    35863506                         prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
    35873507        }
    3588         rCheckOrdSgn(r,i);
    35893508        break;
    35903509
     
    36033522                     tmp_ordsgn,v, bits, r->block1[i]);
    36043523        }
    3605         rCheckOrdSgn(r,i);
    36063524        break;
    36073525
     
    36223540                                     tmp_typ[typ_i]);
    36233541             typ_i++;
    3624              rCheckOrdSgn(r,i);
    36253542          }
    36263543        }
     
    36483565                                     tmp_typ[typ_i]);
    36493566             typ_i++;
    3650              rCheckOrdSgn(r,i);
    36513567          }
    36523568        }
     
    36673583                         tmp_ordsgn, v,bits, r->block0[i]);
    36683584        }
    3669         rCheckOrdSgn(r,i);
    36703585        break;
    36713586
     
    36793594                     tmp_ordsgn,v, bits, r->block1[i]);
    36803595        }
    3681         rCheckOrdSgn(r,i);
    36823596        break;
    36833597
     
    36873601        rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
    36883602        need_to_add_comp=TRUE;
     3603        r->ComponentOrder=-1;
    36893604        typ_i++;
    36903605        break;
     
    36943609        rO_Syz(j, j_bits, prev_ordsgn, tmp_ordsgn, tmp_typ[typ_i]); // set syz-limit?
    36953610        need_to_add_comp=TRUE;
     3611        r->ComponentOrder=-1;
    36963612        typ_i++;
    36973613        break;
     
    37213637    }
    37223638  }
     3639  rCheckOrdSgn(r,n-1);
    37233640
    37243641  int j0=j; // save j
     
    38163733
    38173734  // ----------------------------
    3818   rSetDegStuff(r);
     3735  rSetDegStuff(r); // OrdSgn etc already set
    38193736  rSetOption(r);
    38203737  // ----------------------------
     
    38453762}
    38463763
    3847 static void rCheckOrdSgn(ring r,int b/*current block*/)
    3848 { // set r->OrdSgn, return, if already checked
    3849   if (r->OrdSgn==-1) return;
     3764static void rCheckOrdSgn(ring r,int b/*last block*/)
     3765{ // set r->OrdSgn, r->MixedOrder
    38503766  // for each variable:
     3767  int nonpos=0;
     3768  int nonneg=0;
    38513769  for(int i=1;i<=r->N;i++)
    38523770  {
     
    38673785        {
    38683786          r->OrdSgn=-1;
    3869           return;
    3870         }
    3871         if((r->order[j]==ringorder_a)
     3787          nonpos++;
     3788          found=1;
     3789        }
     3790        else if((r->order[j]==ringorder_a)
    38723791        ||(r->order[j]==ringorder_aa))
    38733792        {
    3874           // <0: local/mixed ordering return
     3793          // <0: local/mixed ordering
    38753794          // >0: var(i) is okay, look at other vars
    38763795          // ==0: look at other blocks for var(i)
    3877           if(r->wvhdl[j][i-r->block0[j]]<0) { r->OrdSgn=-1; return;}
    3878           if(r->wvhdl[j][i-r->block0[j]]>0) { found=1; break;}
    3879         }
    3880       }
    3881     }
    3882   }
    3883   // no local var found in 1..N:
    3884   r->OrdSgn=1;
     3796          if(r->wvhdl[j][i-r->block0[j]]<0)
     3797          {
     3798            r->OrdSgn=-1;
     3799            nonpos++;
     3800            found=1;
     3801          }
     3802          else if(r->wvhdl[j][i-r->block0[j]]>0)
     3803          {
     3804            nonneg++;
     3805            found=1;
     3806          }
     3807        }
     3808        else if(r->order[j]==ringorder_M)
     3809        {
     3810          // <0: local/mixed ordering
     3811          // >0: var(i) is okay, look at other vars
     3812          // ==0: look at other blocks for var(i)
     3813          if(r->wvhdl[j][i-r->block0[j]]<0)
     3814          {
     3815            r->OrdSgn=-1;
     3816            nonpos++;
     3817            found=1;
     3818          }
     3819          else if(r->wvhdl[j][i-r->block0[j]]>0)
     3820          {
     3821            nonneg++;
     3822            found=1;
     3823          }
     3824          else
     3825          {
     3826            // very bad:
     3827            nonpos++;
     3828            nonneg++;
     3829            found=1;
     3830          }
     3831        }
     3832        else if ((r->order[j]==ringorder_lp)
     3833        || (r->order[j]==ringorder_dp)
     3834        || (r->order[j]==ringorder_Dp)
     3835        || (r->order[j]==ringorder_wp)
     3836        || (r->order[j]==ringorder_Wp)
     3837        || (r->order[j]==ringorder_rp))
     3838        {
     3839          found=1;
     3840          nonneg++;
     3841        }
     3842      }
     3843    }
     3844  }
     3845  if (nonpos>0)
     3846  {
     3847    r->OrdSgn=-1;
     3848    if (nonneg>0) r->MixedOrder=1;
     3849  }
     3850  else
     3851  {
     3852    r->OrdSgn=1;
     3853    r->MixedOrder=0;
     3854  }
    38853855}
    38863856
  • libpolys/polys/monomials/ring.h

    re72804 r0d9122  
    329329  BOOLEAN   pLexOrder; /* TRUE if the monomial ordering is not compatible with pFDeg */
    330330
    331   BOOLEAN   ComponentOrder; // ???
     331  BOOLEAN   ComponentOrder; // 1 if ringorder_c, -1 for ringorder_C,ringorder_S,ringorder_s
    332332
    333333  // what follows below here should be set by rComplete, _only_
Note: See TracChangeset for help on using the changeset viewer.