Changeset 5f4463 in git for kernel/tgb.cc
- Timestamp:
- Apr 11, 2011, 6:39:34 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 5beac5a8a177a4d4938cbc1e887bbd115a393f3a
- Parents:
- 16733868763266ec04dae72db238bced32663735
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/tgb.cc
r1673386 r5f4463 1105 1105 int* i_con =make_connections(i,j,lm,c); 1106 1106 1107 for (int n=0;((n<c->n) && (i_con[n]>=0));n++){ 1108 if (i_con[n]==j){ 1107 for (int n=0;((n<c->n) && (i_con[n]>=0));n++) 1108 { 1109 if (i_con[n]==j) 1110 { 1109 1111 now_t_rep(i,j,c); 1110 1112 omfree(i_con); … … 1127 1129 int sugar=c->pTotaldegree(lm); 1128 1130 p_Delete(&lm, c->r); 1129 if(c->T_deg_full)//Sugar 1130 { 1131 int t_i=c->T_deg_full[i]-c->T_deg[i]; 1132 int t_j=c->T_deg_full[j]-c->T_deg[j]; 1133 sugar+=si_max(t_i,t_j); 1134 //Print("\n max: %d\n",max(t_i,t_j)); 1135 } 1136 1137 1138 1139 1140 1141 for (int m=0;((m<c->n) && (i_con[m]>=0));m++){ 1142 if(c->T_deg_full!=NULL){ 1131 if(c->T_deg_full)//Sugar 1132 { 1133 int t_i=c->T_deg_full[i]-c->T_deg[i]; 1134 int t_j=c->T_deg_full[j]-c->T_deg[j]; 1135 sugar+=si_max(t_i,t_j); 1136 //Print("\n max: %d\n",max(t_i,t_j)); 1137 } 1138 1139 for (int m=0;((m<c->n) && (i_con[m]>=0));m++) 1140 { 1141 if(c->T_deg_full!=NULL) 1142 { 1143 1143 int s1=c->T_deg_full[i_con[m]]+syz_deg-c->T_deg[i_con[m]]; 1144 1144 if (s1>sugar) continue; … … 1146 1146 if (c->weighted_lengths[i_con[m]]<c->weighted_lengths[i]) 1147 1147 i=i_con[m]; 1148 } 1149 for (int m=0;((m<c->n) && (j_con[m]>=0));m++){ 1150 if (c->T_deg_full!=NULL){ 1151 int s1=c->T_deg_full[j_con[m]]+syz_deg-c->T_deg[j_con[m]]; 1152 if (s1>sugar) continue;} 1153 if (c->weighted_lengths[j_con[m]]<c->weighted_lengths[j]) 1154 j=j_con[m]; 1155 } 1156 1157 //can also try dependend search 1148 } 1149 for (int m=0;((m<c->n) && (j_con[m]>=0));m++) 1150 { 1151 if (c->T_deg_full!=NULL) 1152 { 1153 int s1=c->T_deg_full[j_con[m]]+syz_deg-c->T_deg[j_con[m]]; 1154 if (s1>sugar) continue; 1155 } 1156 if (c->weighted_lengths[j_con[m]]<c->weighted_lengths[j]) 1157 j=j_con[m]; 1158 } 1159 1160 //can also try dependend search 1158 1161 omfree(i_con); 1159 1162 omfree(j_con); 1160 return;1161 1163 } 1162 1164 … … 1210 1212 1211 1213 1212 static int iq_crit(const void* ap,const void* bp) {1213 1214 static int iq_crit(const void* ap,const void* bp) 1215 { 1214 1216 sorted_pair_node* a=*((sorted_pair_node**)ap); 1215 1217 sorted_pair_node* b=*((sorted_pair_node**)bp); … … 1537 1539 for(upper=lower+1;upper<spc;upper++) 1538 1540 { 1539 1540 1541 if(!pLmEqual(nodes[lower]->lcm_of_lm,nodes[upper]->lcm_of_lm)) 1541 1542 { … … 1543 1544 } 1544 1545 if (has_t_rep(nodes[upper]->i,nodes[upper]->j,c)) 1545 has=TRUE; 1546 1546 has=TRUE; 1547 1547 } 1548 1548 upper=upper-1; … … 2865 2865 omfree(si_array); 2866 2866 } 2867 slimgb_alg::slimgb_alg(ideal I, int syz_comp,BOOLEAN F4,int deg_pos){ 2868 this->deg_pos=deg_pos; 2867 slimgb_alg::slimgb_alg(ideal I, int ssyz_comp,BOOLEAN F4,int ddeg_pos) 2868 { 2869 this->deg_pos=ddeg_pos; 2869 2870 lastCleanedDeg=-1; 2870 2871 completed=FALSE; 2871 this->syz_comp=s yz_comp;2872 this->syz_comp=ssyz_comp; 2872 2873 r=currRing; 2873 2874 nc=rIsPluralRing(r); … … 2877 2878 { 2878 2879 int hzz; 2879 for(hzz=0;hzz<IDELEMS(I);hzz++){ 2880 for(hzz=0;hzz<IDELEMS(I);hzz++) 2881 { 2880 2882 assume(I->m[hzz]!=NULL); 2881 2883 int d=this->pTotaldegree(I->m[hzz]); … … 2930 2932 pair_top=-1; 2931 2933 2932 int n=IDELEMS(I); 2933 array_lengths=n; 2934 2934 int nn=IDELEMS(I); 2935 array_lengths=nn; 2935 2936 2936 2937 i=0; 2937 2938 this->n=0; 2938 T_deg=(int*) omalloc(n *sizeof(int));2939 T_deg=(int*) omalloc(nn*sizeof(int)); 2939 2940 if(eliminationProblem) 2940 T_deg_full=(int*) omalloc(n *sizeof(int));2941 T_deg_full=(int*) omalloc(nn*sizeof(int)); 2941 2942 else 2942 2943 T_deg_full=NULL; 2943 tmp_pair_lm=(poly*) omalloc(n *sizeof(poly));2944 tmp_spn=(sorted_pair_node**) omalloc(n *sizeof(sorted_pair_node*));2944 tmp_pair_lm=(poly*) omalloc(nn*sizeof(poly)); 2945 tmp_spn=(sorted_pair_node**) omalloc(nn*sizeof(sorted_pair_node*)); 2945 2946 lm_bin=omGetSpecBin(POLYSIZE + (r->ExpL_Size)*sizeof(long)); 2946 2947 #ifdef HEAD_BIN … … 2951 2952 #ifdef USE_STDVECBOOL 2952 2953 #else 2953 h=omalloc(n *sizeof(char*));2954 h=omalloc(nn*sizeof(char*)); 2954 2955 2955 2956 states=(char**) h; … … 2958 2959 h=omalloc(n*sizeof(int)); 2959 2960 lengths=(int*) h; 2960 weighted_lengths=(wlen_type*)omalloc(n *sizeof(wlen_type));2961 gcd_of_terms=(poly*) omalloc(n *sizeof(poly));2962 2963 short_Exps=(long*) omalloc(n *sizeof(long));2961 weighted_lengths=(wlen_type*)omalloc(nn*sizeof(wlen_type)); 2962 gcd_of_terms=(poly*) omalloc(nn*sizeof(poly)); 2963 2964 short_Exps=(long*) omalloc(nn*sizeof(long)); 2964 2965 if (F4_mode) 2965 S=idInit(n ,I->rank);2966 S=idInit(nn,I->rank); 2966 2967 else 2967 2968 S=idInit(1,I->rank); … … 2976 2977 strat->enterS = enterSBba; 2977 2978 strat->sl = -1; 2978 i=n ;2979 i=nn; 2979 2980 i=1;//some strange bug else 2980 2981 /* initS(c->S,NULL,c->strat); */ … … 2994 2995 strat->lenSw=NULL; 2995 2996 sorted_pair_node* si; 2996 assume(n >0);2997 assume(nn>0); 2997 2998 add_to_basis_ideal_quotient(I->m[0],this,NULL); 2998 2999 … … 3000 3001 if(!(F4_mode)) 3001 3002 { 3002 3003 3004 introduceDelayedPairs(array_arg,n-1);3005 3006 for (i=1;i<n ;i++)//the 1 is wanted, because first element is added to basis3003 poly* array_arg=I->m; 3004 array_arg++; 3005 introduceDelayedPairs(array_arg,nn-1); 3006 /* 3007 for (i=1;i<nn;i++)//the 1 is wanted, because first element is added to basis 3007 3008 { 3008 3009 // add_to_basis(I->m[i],-1,-1,c); … … 3018 3019 si->lcm_of_lm=I->m[i]; 3019 3020 3020 // c->apairs[n -1-i]=si;3021 apairs[n -i-1]=si;3021 // c->apairs[nn-1-i]=si; 3022 apairs[nn-i-1]=si; 3022 3023 ++(pair_top); 3023 3024 }*/ … … 3025 3026 else 3026 3027 { 3027 for (i=1;i<n ;i++)//the 1 is wanted, because first element is added to basis3028 for (i=1;i<nn;i++)//the 1 is wanted, because first element is added to basis 3028 3029 add_to_basis_ideal_quotient(I->m[i],this,NULL); 3029 3030 } … … 3037 3038 use_noro=((!(nc))&&(S->rank<=1)&&(rField_is_Zp(r)) &&(!(eliminationProblem))&&(npPrimeM<=32003)); 3038 3039 use_noro_last_block=false; 3039 if ((!(use_noro))&&(lastDpBlockStart<=pVariables)){ 3040 if ((!(use_noro))&&(lastDpBlockStart<=pVariables)) 3041 { 3040 3042 use_noro_last_block=((!(nc))&&(S->rank<=1)&&(rField_is_Zp(r)) &&(npPrimeM<=32003)); 3041 3043 } … … 3047 3049 memset(add_later->m,0,ADD_LATER_SIZE*sizeof(poly)); 3048 3050 } 3049 slimgb_alg::~slimgb_alg(){ 3050 3051 if (!(completed)){ 3052 poly* add=(poly*) omalloc((pair_top+2)*sizeof(poly)); 3053 int piter; 3054 int pos=0; 3055 for(piter=0;piter<=pair_top;piter++){ 3056 sorted_pair_node* s=apairs[piter]; 3057 if (s->i<0){ 3058 //delayed element 3059 if (s->lcm_of_lm!=NULL){ 3060 add[pos]=s->lcm_of_lm; 3061 pos++; 3062 3063 } 3051 slimgb_alg::~slimgb_alg() 3052 { 3053 if (!(completed)) 3054 { 3055 poly* add=(poly*) omalloc((pair_top+2)*sizeof(poly)); 3056 int piter; 3057 int pos=0; 3058 for(piter=0;piter<=pair_top;piter++) 3059 { 3060 sorted_pair_node* s=apairs[piter]; 3061 if (s->i<0) 3062 { 3063 //delayed element 3064 if (s->lcm_of_lm!=NULL) 3065 { 3066 add[pos]=s->lcm_of_lm; 3067 pos++; 3064 3068 } 3065 3066 free_sorted_pair_node(s,r); 3067 apairs[piter]=NULL; 3068 } 3069 pair_top=-1; 3070 add[pos]=NULL; 3071 pos=0; 3072 while(add[pos]!=NULL){ 3073 add_to_basis_ideal_quotient(add[pos],this,NULL); 3074 pos++; 3075 } 3076 for(piter=0;piter<=pair_top;piter++){ 3077 sorted_pair_node* s=apairs[piter]; 3078 assume(s->i>=0); 3079 free_sorted_pair_node(s,r); 3080 apairs[piter]=NULL; 3081 } 3082 pair_top=-1; 3069 } 3070 3071 free_sorted_pair_node(s,r); 3072 apairs[piter]=NULL; 3073 } 3074 pair_top=-1; 3075 add[pos]=NULL; 3076 pos=0; 3077 while(add[pos]!=NULL) 3078 { 3079 add_to_basis_ideal_quotient(add[pos],this,NULL); 3080 pos++; 3081 } 3082 for(piter=0;piter<=pair_top;piter++) 3083 { 3084 sorted_pair_node* s=apairs[piter]; 3085 assume(s->i>=0); 3086 free_sorted_pair_node(s,r); 3087 apairs[piter]=NULL; 3088 } 3089 pair_top=-1; 3083 3090 } 3084 3091 id_Delete(&add_later,r); … … 3094 3101 while(c->F) 3095 3102 { 3096 for(i=0;i<c->F->size;i++){ 3103 for(i=0;i<c->F->size;i++) 3104 { 3097 3105 pDelete(&(c->F->mp[i].m)); 3098 3106 } … … 3105 3113 while(c->F_minus) 3106 3114 { 3107 for(i=0;i<c->F_minus->size;i++){ 3115 for(i=0;i<c->F_minus->size;i++) 3116 { 3108 3117 pDelete(&(c->F_minus->p[i])); 3109 3118 } … … 3116 3125 #ifndef HAVE_BOOST 3117 3126 #ifndef USE_STDVECBOOL 3118 for(int z=1 /* zero length at 0 */;z<c->n;z++){ 3127 for(int z=1 /* zero length at 0 */;z<c->n;z++) 3128 { 3119 3129 omfree(c->states[z]); 3120 3130 } … … 3142 3152 omFree(c->strat->S_2_R); 3143 3153 3144 3145 3154 omFree(c->strat->lenS); 3146 3155 3147 3156 if(c->strat->lenSw) omFree(c->strat->lenSw); 3148 3157 3149 3150 3151 3152 for(i=0;i<c->n;i++){ 3158 for(i=0;i<c->n;i++) 3159 { 3153 3160 if(c->gcd_of_terms[i]) 3154 3161 pDelete(&(c->gcd_of_terms[i])); … … 3166 3173 int deleted_form_c_s=0; 3167 3174 3168 for(i=0;i<=c->strat->sl;i++){ 3175 for(i=0;i<=c->strat->sl;i++) 3176 { 3169 3177 if (!c->strat->S[i]) continue; 3170 3178 BOOLEAN found=FALSE; 3171 for(j=0;j<c->n;j++){ 3172 if (c->S->m[j]==c->strat->S[i]){ 3179 for(j=0;j<c->n;j++) 3180 { 3181 if (c->S->m[j]==c->strat->S[i]) 3182 { 3173 3183 found=TRUE; 3174 3184 break; … … 3190 3200 // } 3191 3201 3192 if (completed){ 3193 for(i=0;i<c->n;i++) 3194 { 3195 assume(c->S->m[i]!=NULL); 3196 if (p_GetComp(c->S->m[i],currRing)>this->syz_comp) continue; 3197 for(j=0;j<c->n;j++) 3198 { 3199 if((c->S->m[j]==NULL)||(i==j)) 3200 continue; 3201 assume(p_LmShortDivisibleBy(c->S->m[j],c->short_Exps[j], 3202 if (completed) 3203 { 3204 for(i=0;i<c->n;i++) 3205 { 3206 assume(c->S->m[i]!=NULL); 3207 if (p_GetComp(c->S->m[i],currRing)>this->syz_comp) continue; 3208 for(j=0;j<c->n;j++) 3209 { 3210 if((c->S->m[j]==NULL)||(i==j)) 3211 continue; 3212 assume(p_LmShortDivisibleBy(c->S->m[j],c->short_Exps[j], 3202 3213 c->S->m[i],~c->short_Exps[i], 3203 3214 c->r)==p_LmDivisibleBy(c->S->m[j], 3204 3215 c->S->m[i], 3205 3216 c->r)); 3206 if (p_LmShortDivisibleBy(c->S->m[j],c->short_Exps[j],3217 if (p_LmShortDivisibleBy(c->S->m[j],c->short_Exps[j], 3207 3218 c->S->m[i],~c->short_Exps[i], 3208 3219 c->r)) 3209 {3210 pDelete(&c->S->m[i]);3211 break;3212 }3213 }3214 }3220 { 3221 pDelete(&c->S->m[i]); 3222 break; 3223 } 3224 } 3225 } 3215 3226 } 3216 3227 omfree(c->short_Exps); 3217 3218 3228 3219 3229 ideal I=c->S;
Note: See TracChangeset
for help on using the changeset viewer.