Changeset 8eab868 in git
- Timestamp:
- Nov 6, 2002, 6:47:13 PM (21 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 2713491c6c06aabef211b682ac1f5dda2749e54c
- Parents:
- 030fcb083622316619951241eba12a84c7c3cd28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/tgb.cc
r030fcb0 r8eab868 31 31 int b; 32 32 }; 33 BOOLEAN lenS_correct(kStrategy strat){ 34 int i; 35 for(i=0;i<=strat->sl;i++){ 36 if (strat->lenS[i]!=pLength(strat->S[i])) 37 return FALSE; 38 } 39 return TRUE; 40 41 } 33 42 int bucket_guess(kBucket* bucket){ 34 43 int sum=0; … … 203 212 void move_forward_in_S(int old_pos, int new_pos,kStrategy strat) 204 213 { 214 assume(old_pos>=new_pos); 205 215 poly p=strat->S[old_pos]; 206 216 int ecart=strat->ecartS[old_pos]; … … 225 235 strat->S_2_R[new_pos]=s_2_r; 226 236 strat->lenS[new_pos]=length; 237 //assume(lenS_correct(strat)); 227 238 } 228 239 void replace_pair(int & i, int & j, calc_dat* c) … … 685 696 (*at)--; 686 697 (*k)--; 698 // assume(lenS_correct(strat)); 687 699 } 688 700 void add_to_basis(poly h, int i_pos, int j_pos,calc_dat* c) 689 701 { 702 // BOOLEAN corr=lenS_correct(c->strat); 690 703 BOOLEAN R_found=FALSE; 691 704 void* hp; … … 749 762 c->rep[j]=i; 750 763 PrintS("R"); R_found=TRUE; 751 764 if((i_pos>=0) && (j_pos>=0)){ 752 765 c->misses[i_pos]--; 753 766 c->misses[j_pos]--; 767 } 754 768 for(int z=0;z<j;z++){ 755 769 if (c->states[j][z]==UNCALCULATED){ … … 804 818 if (c->lengths[c->n-1]==1) 805 819 shorten_tails(c,c->S->m[c->n-1]); 820 // if (corr){ 821 822 // corr=lenS_correct(c->strat); 823 // if(!corr){ 824 // PrintS("korupted in shorten tails"); 825 // } 826 // } 806 827 //you should really update c->lengths, c->strat->lenS, and the oder of polys in strat if you sort after lengths 807 828 … … 881 902 P.SetShortExpVector(); 882 903 P.bucket = kBucketCreate(currRing); 904 // BOOLEAN corr=lenS_correct(strat); 883 905 kBucketInit(P.bucket,P.p,len /*pLength(P.p)*/); 884 906 //int max_pos=simple_posInS(strat,P.p); 885 907 loop 886 908 { 909 // if (corr){ 910 911 // corr=lenS_correct(strat); 912 // if(!corr){ 913 // PrintS("korupt"); 914 // } 915 // } 887 916 int compare_bound; 888 917 compare_bound=bucket_guess(P.bucket); … … 893 922 poly sec_copy=NULL; 894 923 //pseudo code 895 BOOLEAN must_replace_in_basis=(len_upper_bound<=strat->lenS[j]);//first test 924 BOOLEAN must_expand=FALSE; 925 BOOLEAN must_replace_in_basis=(len_upper_bound<strat->lenS[j]);//first test 896 926 if (must_replace_in_basis) 897 927 { … … 906 936 { 907 937 must_replace_in_basis=FALSE; 938 if ((len_upper_bound==1) 939 ||(len_upper_bound==2) 940 ||(len_upper_bound<strat->lenS[j]/2)) 941 { 942 PrintS("e"); 943 sec_copy=kBucketClear(P.bucket); 944 kBucketInit(P.bucket,pCopy(sec_copy),pLength(sec_copy)); 945 must_expand=TRUE; 946 } 908 947 } 909 948 } 949 // must_expand=FALSE; 950 // must_replace_in_basis=FALSE; 910 951 nNormalize(pGetCoeff(P.p)); 911 952 #ifdef KDEBUG … … 924 965 nDelete(&coef); 925 966 h = kBucketGetLm(P.bucket); 926 //pseudo code967 927 968 if (must_replace_in_basis){ 928 int old_pos_in_c=-1;969 int pos_in_c=-1; 929 970 poly p=strat->S[j]; 930 971 int z; 931 972 932 973 int new_length=pLength(sec_copy); 933 974 Print("%i",strat->lenS[j]-new_length); 934 975 len_upper_bound=new_length +strat->lenS[j]-2;//old entries length 935 976 int new_pos=simple_posInS(c->strat,strat->S[j],new_length);//hack 936 strat->S[j]=sec_copy; 937 c->strat->lenS[j]=new_length; 938 939 for (z=c->n;z;z--) 940 { 941 if(p==c->S->m[z-1]) 942 { 943 c->S->m[z-1]=sec_copy; 944 old_pos_in_c=z-1; 945 c->lengths[z-1]=new_length; 946 if (new_length==1) 947 { 948 int i; 949 for ( i=0;i<z-1;i++) 950 { 951 if (c->lengths[i]==1) 952 c->states[z-1][i]=HASTREP; 953 } 954 for ( i=z;i<c->n;i++){ 955 if (c->lengths[i]==1) 956 c->states[i][z-1]=HASTREP; 957 } 958 shorten_tails(c,sec_copy); 959 } 960 break; 961 } 962 } 963 pDelete(&p); 964 965 // replace_quietly(c,j,sec_copy); 966 // have to do many additional things for consistency 967 { 968 969 970 971 972 int old_pos=j; 973 new_pos=min(old_pos, new_pos); 974 assume(new_pos<=old_pos); 975 976 977 c->strat->lenS[old_pos]=new_length; 978 int i=0; 979 for(i=new_pos;i<old_pos;i++){ 980 if (strat->lenS[i]<=new_length) 981 new_pos++; 982 else 983 break; 984 } 985 if (new_pos<old_pos) 986 move_forward_in_S(old_pos,new_pos,c->strat); 987 988 989 } 990 } 991 if (h==NULL) return NULL; 992 P.p=h; 993 P.t_p=NULL; 994 P.SetShortExpVector(); 977 978 // p=NULL; 979 for (z=c->n;z;z--) 980 { 981 if(p==c->S->m[z-1]) 982 { 983 984 985 pos_in_c=z-1; 986 987 break; 988 } 989 } 990 if (z<=0){ 991 //not in c->S 992 //LEAVE 993 deleteInS(j,c->strat); 994 //ENTER 995 int mlength=pLength(sec_copy); 996 int mi=simple_posInS(c->strat,sec_copy,mlength); 997 998 LObject mP; memset(&mP,0,sizeof(mP)); 999 mP.tailRing=c->r; 1000 mP.p=sec_copy; /*p_Copy(h,c->r);*/ 1001 mP.FDeg=pFDeg(mP.p,c->r); 1002 if (!rField_is_Zp(c->r)) pCleardenom(mP.p); 1003 //enterT(P,c->strat,-1); 1004 c->strat->enterS(mP,mi,c->strat); 1005 c->strat->lenS[mi]=mlength; 1006 pNorm(c->strat->S[mi]); 1007 } 1008 else { 1009 //shorten_tails may alter position (not the length, even not by recursion in GLOBAL case) 1010 1011 strat->S[j]=sec_copy; 1012 c->strat->lenS[j]=new_length; 1013 pDelete(&p); 1014 1015 // replace_quietly(c,j,sec_copy); 1016 // have to do many additional things for consistency 1017 { 1018 1019 1020 1021 1022 int old_pos=j; 1023 new_pos=min(old_pos, new_pos); 1024 assume(new_pos<=old_pos); 1025 1026 1027 c->strat->lenS[old_pos]=new_length; 1028 int i=0; 1029 for(i=new_pos;i<old_pos;i++){ 1030 if (strat->lenS[i]<=new_length) 1031 new_pos++; 1032 else 1033 break; 1034 } 1035 if (new_pos<old_pos) 1036 move_forward_in_S(old_pos,new_pos,c->strat); 1037 1038 c->S->m[pos_in_c]=sec_copy; 1039 1040 c->lengths[pos_in_c]=new_length; 1041 if (new_length==1) 1042 { 1043 int i; 1044 for ( i=0;i<pos_in_c;i++) 1045 { 1046 if (c->lengths[i]==1) 1047 c->states[pos_in_c][i]=HASTREP; 1048 } 1049 for ( i=z;i<c->n;i++){ 1050 if (c->lengths[i]==1) 1051 c->states[i][pos_in_c]=HASTREP; 1052 } 1053 shorten_tails(c,sec_copy); 1054 } 1055 } 1056 } 1057 } 1058 if(must_expand){ 1059 //i=posInS(c->strat,c->strat->sl,h,0 /*ecart*/); 1060 int mlength=pLength(sec_copy); 1061 int mi=simple_posInS(c->strat,sec_copy,mlength); 1062 1063 LObject mP; memset(&mP,0,sizeof(mP)); 1064 mP.tailRing=c->r; 1065 mP.p=sec_copy; /*p_Copy(h,c->r);*/ 1066 mP.FDeg=pFDeg(mP.p,c->r); 1067 if (!rField_is_Zp(c->r)) pCleardenom(mP.p); 1068 //enterT(P,c->strat,-1); 1069 c->strat->enterS(mP,mi,c->strat); 1070 c->strat->lenS[mi]=mlength; 1071 pNorm(c->strat->S[mi]); 1072 1073 } 1074 if (h==NULL) return NULL; 1075 P.p=h; 1076 P.t_p=NULL; 1077 P.SetShortExpVector(); 995 1078 #ifdef KDEBUG 996 if (TEST_OPT_DEBUG)997 998 999 1079 if (TEST_OPT_DEBUG) 1080 { 1081 PrintS("\nto:"); 1082 wrp(h); 1000 1083 PrintLn(); 1001 1084 } 1002 1085 #endif 1003 1086 } 1004 else1087 else 1005 1088 { 1006 1089 kBucketClear(P.bucket,&(P.p),&len); … … 1181 1264 1182 1265 hr=redNF2(h,c,len); 1183 #ifdef HALFREDUCTIONS 1184 int real_sl=c->strat->sl; 1185 int l; 1186 for(l=0;l<c->n;l++){ 1187 if (c->strat->lenS[l]>4) 1188 break; 1189 } 1190 c->strat->sl=l; 1191 #endif 1266 // hr=redNF(h,c->strat,len); 1267 1192 1268 if (hr!=NULL) 1193 1269 #ifdef REDTAIL_S … … 1196 1272 hr = redtailBba(hr,c->strat->sl,c->strat); 1197 1273 #endif 1198 #ifdef HALFREDUCTIONS 1199 c->strat->sl=real_sl; 1200 #endif 1274 1201 1275 } 1202 1276 #else … … 1355 1429 void shorten_tails(calc_dat* c, poly monom) 1356 1430 { 1357 1431 // BOOLEAN corr=lenS_correct(c->strat); 1358 1432 for(int i=0;i<c->n;i++) 1359 1433 { … … 1384 1458 int old_pos=-1; 1385 1459 //assume new_pos<old_pos 1386 for (int z= new_pos;z<=c->strat->sl;z++)1460 for (int z=0;z<=c->strat->sl;z++) 1387 1461 { 1388 1462 if (c->strat->S[z]==c->S->m[i]) … … 1422 1496 } 1423 1497 } 1424 } 1425 } 1498 1499 } 1500 // if (corr){ 1501 1502 // corr=lenS_correct(c->strat); 1503 // if(!corr){ 1504 // PrintS("korupted in shorten tails"); 1505 // } 1506 // } 1507 }
Note: See TracChangeset
for help on using the changeset viewer.