Changeset 273fed in git for kernel/ring.cc
- Timestamp:
- Mar 15, 2011, 7:17:45 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 1ed3466deda30d9e243b441fb4bc4e0c4729cf69
- Parents:
- 22579cf2576a536b5b44f1a1f2a2d773444baeda
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ring.cc
r22579cf r273fed 352 352 else if (r->order[l] == ringorder_IS) 353 353 { 354 #ifndef NDEBUG 355 if(r->block0[l] == 0 ) 356 PrintS("::prefix"); 357 else 358 Print("::suffix (sign: %d)", r->block0[l]); 359 #endif 354 assume( r->block0[l] == r->block1[l] ); 355 const int s = r->block0[l]; 356 assume( (-2 < s) && (s < 2) ); 357 Print("(%d)", s); // 0 => prefix! +/-1 => suffix! 360 358 continue; 361 359 } … … 559 557 { 560 558 StringAppendS((char *)rSimpleOrdStr(r->order[l])); 561 if ((r->order[l] != ringorder_c) && (r->order[l] != ringorder_C)) 559 if ( 560 (r->order[l] != ringorder_c) 561 && (r->order[l] != ringorder_C) 562 && (r->order[l] != ringorder_s) 563 && (r->order[l] != ringorder_S) 564 && (r->order[l] != ringorder_IS) 565 ) 562 566 { 563 567 if (r->wvhdl[l]!=NULL) … … 599 603 StringAppend("(%d)",r->block1[l]-r->block0[l]+1); 600 604 } 605 else if (r->order[l] == ringorder_IS) 606 { 607 assume( r->block0[l] == r->block1[l] ); 608 const int s = r->block0[l]; 609 assume( (-2 < s) && (s < 2) ); 610 611 StringAppend("(%d)", s); 612 } 613 601 614 if (l==nblocks) return omStrDup(StringAppendS("")); 602 615 StringAppendS(","); … … 1891 1904 assume(blocks >= 1); 1892 1905 if (blocks == 1) return TRUE; 1893 if (blocks > 2) return FALSE; 1894 if ((r->order[0] != ringorder_c) 1895 && (r->order[0] != ringorder_C) 1896 && (r->order[1] != ringorder_c) 1897 && (r->order[1] != ringorder_C)) 1906 1907 int s = 0; 1908 while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) ) 1909 { 1910 s++; 1911 blocks--; 1912 } 1913 1914 if ((blocks - s) > 2) return FALSE; 1915 1916 assume( blocks == s + 2 ); 1917 1918 if ( 1919 (r->order[s] != ringorder_c) 1920 && (r->order[s] != ringorder_C) 1921 && (r->order[s+1] != ringorder_c) 1922 && (r->order[s+1] != ringorder_C) 1923 ) 1898 1924 return FALSE; 1899 if ((r->order[ 1] == ringorder_M)1900 || (r->order[ 0] == ringorder_M))1925 if ((r->order[s+1] == ringorder_M) 1926 || (r->order[s] == ringorder_M)) 1901 1927 return FALSE; 1902 1928 return TRUE; … … 1949 1975 BOOLEAN rHasSimpleOrderAA(ring r) 1950 1976 { 1977 if (r->order[0] == ringorder_unspec) return TRUE; 1951 1978 int blocks = rBlocks(r) - 1; 1952 if ((blocks > 3) || (blocks < 2)) return FALSE; 1953 if (blocks == 3) 1954 { 1955 return (((r->order[0] == ringorder_aa) && (r->order[1] != ringorder_M) && 1956 ((r->order[2] == ringorder_c) || (r->order[2] == ringorder_C))) || 1957 (((r->order[0] == ringorder_c) || (r->order[0] == ringorder_C)) && 1958 (r->order[1] == ringorder_aa) && (r->order[2] != ringorder_M))); 1979 assume(blocks >= 1); 1980 if (blocks == 1) return TRUE; 1981 1982 int s = 0; 1983 while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) ) 1984 { 1985 s++; 1986 blocks--; 1987 } 1988 1989 if ((blocks - s) > 3) return FALSE; 1990 1991 // if ((blocks > 3) || (blocks < 2)) return FALSE; 1992 if ((blocks - s) == 3) 1993 { 1994 return (((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M) && 1995 ((r->order[s+2] == ringorder_c) || (r->order[s+2] == ringorder_C))) || 1996 (((r->order[s] == ringorder_c) || (r->order[s] == ringorder_C)) && 1997 (r->order[s+1] == ringorder_aa) && (r->order[s+2] != ringorder_M))); 1959 1998 } 1960 1999 else 1961 2000 { 1962 return ((r->order[ 0] == ringorder_aa) && (r->order[1] != ringorder_M));2001 return ((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M)); 1963 2002 } 1964 2003 } … … 3249 3288 ||( 3250 3289 ((order[1]==ringorder_c)||(order[1]==ringorder_C) 3251 ||(order[1]==ringorder_S) ||(order[1]==ringorder_IS)3290 ||(order[1]==ringorder_S) 3252 3291 ||(order[1]==ringorder_s)) 3253 3292 && (order[0]!=ringorder_M) … … 3256 3295 { 3257 3296 if ((order[0]!=ringorder_unspec) 3258 && ((order[1]==ringorder_C)||(order[1]==ringorder_S)|| (order[1]==ringorder_IS)||3297 && ((order[1]==ringorder_C)||(order[1]==ringorder_S)|| 3259 3298 (order[1]==ringorder_s))) 3260 3299 r->ComponentOrder=-1; … … 3281 3320 else if (((order[0]==ringorder_c) 3282 3321 ||(order[0]==ringorder_C) 3283 ||(order[0]==ringorder_S) ||(order[0]==ringorder_IS)3322 ||(order[0]==ringorder_S) 3284 3323 ||(order[0]==ringorder_s)) 3285 3324 && (order[1]!=ringorder_M) 3286 3325 && (order[2]==0)) 3287 3326 { 3288 if ((order[0]==ringorder_C)||(order[0]==ringorder_S)|| (order[0]==ringorder_IS) ||3327 if ((order[0]==ringorder_C)||(order[0]==ringorder_S)|| 3289 3328 order[0]==ringorder_s) 3290 3329 r->ComponentOrder=-1; … … 3310 3349 else 3311 3350 { 3312 if ((r->VectorOut)||(order[0]==ringorder_C)||(order[0]==ringorder_S)||(order[0]==ringorder_s) ||(order[0]==ringorder_IS))3351 if ((r->VectorOut)||(order[0]==ringorder_C)||(order[0]==ringorder_S)||(order[0]==ringorder_s)) 3313 3352 { 3314 3353 rSetFirstWv(r, 1, order, block1, wvhdl); … … 3329 3368 if ((order[0]!=ringorder_c) 3330 3369 && (order[0]!=ringorder_C) 3331 && (order[0]!=ringorder_S) && (order[0]!=ringorder_IS)3370 && (order[0]!=ringorder_S) 3332 3371 && (order[0]!=ringorder_s)) 3333 3372 { … … 3652 3691 case ringorder_IS: 3653 3692 { 3693 3694 assume( r->block0[i] == r->block1[i] ); 3654 3695 const int s = r->block0[i]; 3655 assume( s >= -1 && s <= 1); 3656 3657 assume( r->block0[i] == r->block1[i] ); 3696 assume( -2 < s && s < 2); 3658 3697 3659 3698 if(s == 0) // Prefix IS … … 3989 4028 Print(" typ %s", TYP[r->typ[j].ord_typ]); 3990 4029 3991 if (r->typ[j].ord_typ==ro_isTemp) 4030 4031 if (r->typ[j].ord_typ==ro_syz) 4032 { 4033 const short place = r->typ[j].data.syz.place; 4034 const int limit = r->typ[j].data.syz.limit; 4035 const int curr_index = r->typ[j].data.syz.curr_index; 4036 const int* syz_index = r->typ[j].data.syz.syz_index; 4037 4038 Print(" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index); 4039 4040 if( syz_index == NULL ) 4041 PrintS("(NULL)"); 4042 else 4043 { 4044 Print("{"); 4045 for( i=0; i <= limit; i++ ) 4046 Print("%d ", syz_index[i]); 4047 Print("}"); 4048 } 4049 4050 } 4051 else if (r->typ[j].ord_typ==ro_isTemp) 3992 4052 { 3993 4053 Print(" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos); … … 3999 4059 #endif 4000 4060 } 4001 else 4002 if (r->typ[j].ord_typ==ro_is) 4061 else if (r->typ[j].ord_typ==ro_is) 4003 4062 { 4004 4063 Print(" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end); … … 4093 4152 Print(" %s,\n", ((char**) &proc_names)[i]); 4094 4153 } 4154 4155 { 4156 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" ) 4157 Print("\npFDeg : "); 4158 4159 pFDeg_CASE(p_Totaldegree); else 4160 pFDeg_CASE(pWFirstTotalDegree); else 4161 pFDeg_CASE(pWTotaldegree); else 4162 pFDeg_CASE(pDeg); else 4163 Print("(%p)", r->pFDeg); // default case 4164 4165 PrintS("\n"); 4166 #undef pFDeg_CASE 4167 } 4168 4095 4169 } 4096 4170 … … 4299 4373 { 4300 4374 if ( (r->order[0] == ringorder_s) ) return r; 4375 4301 4376 if ( (r->order[0] == ringorder_IS) ) 4302 4377 { 4303 4378 #ifndef NDEBUG 4304 WarnS("rAssure_SyzComp in an ISring!");4379 WarnS("rAssure_SyzComp: input ring has an IS-ordering!"); 4305 4380 #endif 4306 4381 // return r; … … 4747 4822 PrintLn(); 4748 4823 #endif 4749 4824 assume((sgn == 1) || (sgn == -1)); 4750 4825 4751 4826 ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy. … … 4765 4840 int j = 0; 4766 4841 res->order[j] = ringorder_IS; // Prefix 4767 //res->block0[j] = res->block1[j] = 0;4842 res->block0[j] = res->block1[j] = 0; 4768 4843 // wvhdl[j] = NULL; 4769 4844 j++; … … 4879 4954 return rCurrRingAssure_Global(ringorder_C, ringorder_dp); 4880 4955 } 4956 4957 4958 4959 /// Finds p^th IS ordering, and returns its position in r->typ[] 4960 /// returns -1 if something went wrong! 4961 int rGetISPos(const int p = 0, const ring r = currRing) 4962 { 4963 // Put the reference set F into the ring -ordering -recor 4964 #if MYTEST 4965 Print("rIsIS(p: %d)\nF:", p); 4966 PrintLn(); 4967 #endif 4968 4969 if (r->typ==NULL) 4970 { 4971 dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)"); 4972 return -1; 4973 } 4974 4975 int j = p; // Which IS record to use... 4976 for( int pos = 0; pos < r->OrdSize; pos++ ) 4977 if( r->typ[pos].ord_typ == ro_is) 4978 if( j-- == 0 ) 4979 { 4980 return pos; 4981 } 4982 4983 return -1; 4984 } 4985 4986 4987 4988 4989 4881 4990 4882 4991 /// Changes r by setting induced ordering parameters: limit and reference leading terms … … 4912 5021 } 4913 5022 4914 int j = p; // Which IS record to use... 4915 for( int pos = 0; pos < r->OrdSize; pos++ ) 4916 if( r->typ[pos].ord_typ == ro_is) 4917 if( j-- == 0 ) 4918 { 5023 5024 int pos = rGetISPos(p, r); 5025 5026 if( pos == -1 ) 5027 { 5028 dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" ); 5029 return false; 5030 } 5031 4919 5032 #if MYTEST 4920 Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i); 4921 #endif 4922 4923 const ideal FF = idrHeadR(F, r, r); 4924 4925 4926 if( r->typ[pos].data.is.F != NULL) 4927 { 5033 if( i != r->typ[pos].data.is.limit ) 5034 Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i); 5035 #endif 5036 5037 const ideal FF = id_Copy(F, r); // idrHeadR(F, r, r); 5038 5039 5040 if( r->typ[pos].data.is.F != NULL) 5041 { 4928 5042 #if MYTEST 4929 4930 #endif 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 5043 PrintS("Deleting old reference set F... \n"); // idShow(r->typ[pos].data.is.F, r); PrintLn(); 5044 #endif 5045 id_Delete(&r->typ[pos].data.is.F, r); 5046 r->typ[pos].data.is.F = NULL; 5047 } 5048 5049 assume(r->typ[pos].data.is.F == NULL); 5050 5051 r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end! 5052 5053 if(r->typ[pos].data.is.componentWeights != NULL) 5054 { 4941 5055 #if MYTEST 4942 4943 #endif 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 5056 PrintS("Deleting old componentWeights: "); r->typ[pos].data.is.componentWeights->show(); PrintLn(); 5057 #endif 5058 delete r->typ[pos].data.is.componentWeights; 5059 r->typ[pos].data.is.componentWeights = NULL; 5060 } 5061 5062 5063 assume(r->typ[pos].data.is.componentWeights == NULL); 5064 5065 if( componentWeights != NULL ) 5066 componentWeights = ivCopy(componentWeights); // componentWeights is owened by ring now! TODO: delete at the end! 5067 5068 r->typ[pos].data.is.componentWeights = componentWeights; 5069 5070 r->typ[pos].data.is.limit = i; // First induced component 4957 5071 4958 5072 #if MYTEST 4959 PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn(); 4960 #endif 4961 4962 return true; 4963 } 4964 4965 dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" ); 4966 return false; 5073 PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn(); 5074 #endif 5075 5076 return true; 4967 5077 } 4968 5078 … … 4970 5080 void rSetSyzComp(int k) 4971 5081 { 5082 if(k < 0) 5083 { 5084 dReportError("rSetSyzComp with negative limit!"); 5085 return; 5086 } 5087 5088 assume( k >= 0 ); 4972 5089 if (TEST_OPT_PROT) Print("{%d}", k); 4973 5090 if ((currRing->typ!=NULL) && (currRing->typ[0].ord_typ==ro_syz)) 4974 5091 { 4975 assume(k > currRing->typ[0].data.syz.limit); 5092 if( k == currRing->typ[0].data.syz.limit ) 5093 return; // nothing to do 5094 4976 5095 int i; 4977 5096 if (currRing->typ[0].data.syz.limit == 0) … … 4993 5112 currRing->typ[0].data.syz.curr_index; 4994 5113 } 5114 if(k < currRing->typ[0].data.syz.limit) // ? 5115 { 5116 #ifndef NDEBUG 5117 Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, currRing->typ[0].data.syz.limit); 5118 #endif 5119 currRing->typ[0].data.syz.curr_index = 1 + currRing->typ[0].data.syz.syz_index[k]; 5120 } 5121 5122 4995 5123 currRing->typ[0].data.syz.limit = k; 4996 5124 currRing->typ[0].data.syz.curr_index++;
Note: See TracChangeset
for help on using the changeset viewer.