Changeset 737e25 in git for kernel/gr_kstd2.cc
- Timestamp:
- Jul 26, 2008, 8:11:42 PM (15 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 54be36409272b75d61e671da16ead0f5de675693
- Parents:
- 5bc4103ee51a6a028666ee3c666059e950974fb1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gr_kstd2.cc
r5bc4103 r737e25 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: gr_kstd2.cc,v 1.1 4 2008-06-10 10:17:31 motsakExp $ */4 /* $Id: gr_kstd2.cc,v 1.15 2008-07-26 18:11:42 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: noncomm. alg. of Buchberger … … 145 145 j++; 146 146 } 147 } 148 } 149 void ratGB_divide_out(poly p) 150 { 151 if (p==NULL) return; 152 poly root=p; 153 assume(currRing->real_var_start>0); 154 poly f=pHead(p); 155 int i; 156 for (i=currRing->real_var_start;i<=currRing->real_var_end;i++) 157 { 158 pSetExp(f,i,0); 159 } 160 loop 161 { 162 pIter(p); 163 if (p==NULL) { pSetm(f); break;} 164 for (i=1;i<=rVar(currRing);i++) 165 { 166 pSetExp(f,i,si_min(pGetExp(f,i),pGetExp(p,i))); 167 } 168 } 169 if (!pIsConstant(f)) 170 { 171 if (TEST_OPT_DEBUG) 172 { 173 PrintS("divide out:");p_wrp(f,currRing); 174 PrintS(" from ");pWrite(root); 175 } 176 p=root; 177 loop 178 { 179 if (p==NULL) break; 180 for (i=1;i<=rVar(currRing);i++) 181 { 182 pSetExp(p,i,pGetExp(p,i)-pGetExp(f,i)); 183 } 184 pSetm(p); 185 pIter(p); 186 } 187 } 188 pDelete(&f); 189 } 190 /*2 191 *reduces h with elements from T choosing the first possible 192 * element in t with respect to the given pDivisibleBy 193 * for use in ratGB 194 */ 195 int redGrRatGB (LObject* h,kStrategy strat) 196 { 197 int at,reddeg,d,i; 198 int pass = 0; 199 int j = 0; 200 int c_j=-1, c_e=-1; 201 poly c_p=NULL; 202 assume(strat->tailRing==currRing); 203 204 ratGB_divide_out((*h).p); 205 d = pFDeg((*h).p,currRing)+(*h).ecart; 206 reddeg = strat->LazyDegree+d; 207 if (!TEST_OPT_INTSTRATEGY) 208 { 209 if (rField_is_Zp_a()) pContent(h->p); 210 else pCleardenom(h->p);// also does a pContent 211 } 212 loop 213 { 214 if (j > strat->sl) 215 { 216 if (c_j>=0) 217 { 218 /* 219 * the polynomial to reduce with is; 220 * S[c_j] 221 */ 222 if (!TEST_OPT_INTSTRATEGY) 223 pNorm(strat->S[c_j]); 224 if (TEST_OPT_DEBUG) 225 { 226 wrp(h->p); 227 PrintS(" with "); 228 wrp(strat->S[c_j]); 229 } 230 //poly hh = nc_CreateSpoly(strat->S[c_j],(*h).p, currRing); 231 poly hh=c_p; c_p=NULL; 232 pDelete(&((*h).p)); 233 (*h).p=hh; 234 if (!TEST_OPT_INTSTRATEGY) 235 { 236 if (rField_is_Zp_a()) pContent(h->p); 237 else pCleardenom(h->p);// also does a pContent 238 } 239 240 if (TEST_OPT_DEBUG) 241 { 242 PrintS(" to "); 243 wrp(h->p); 244 } 245 if ((*h).p == NULL) 246 { 247 if (h->lcm!=NULL) p_LmFree((*h).lcm, currRing); 248 return 0; 249 } 250 ratGB_divide_out((*h).p); 251 d = pLDeg((*h).p,&((*h).length),currRing); 252 (*h).FDeg=pFDeg((*h).p,currRing); 253 (*h).ecart = d-(*h).FDeg; /*pFDeg((*h).p);*/ 254 /*- try to reduce the s-polynomial again -*/ 255 pass++; 256 j=0; 257 } 258 else 259 { // nothing found 260 return 0; 261 } 262 } 263 if (p_LmDivisibleByPart(strat->S[j],(*h).p,currRing, 264 currRing->real_var_start,currRing->real_var_end)) 265 { 266 int a_e=(pTotaldegree(strat->S[j],currRing)-pFDeg(strat->S[j],currRing)); 267 if (TEST_OPT_DEBUG) { Print("j=%d, e=%d\n",j,a_e); } 268 if ((c_e==-1)||(c_e>a_e)) 269 { 270 c_e=a_e; c_j=j; 271 pDelete(&c_p); 272 c_p = nc_CreateSpoly(pCopy(strat->S[c_j]),pCopy((*h).p), currRing); 273 } 274 else if (c_e == a_e) 275 { 276 poly cc_pp= nc_CreateSpoly(pCopy(strat->S[j]),pCopy((*h).p), currRing); 277 if (((cc_pp==NULL)&&(c_p!=NULL)) || (pCmp(cc_pp,c_p)==-1)) 278 { 279 assume(pTotaldegree(cc_pp)<=pTotaldegree(c_p)); 280 c_e=a_e; c_j=j; 281 pDelete(&c_p); 282 c_p = cc_pp; 283 } 284 } 285 /*computes the ecart*/ 286 if ((strat->syzComp!=0) && !strat->honey) 287 { 288 if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp)) 289 { 290 if (TEST_OPT_DEBUG) PrintS(" > sysComp\n"); 291 return 0; 292 } 293 } 294 } 295 else 296 { 297 if (TEST_OPT_DEBUG) PrintS("-\n"); 298 } 299 j++; 147 300 } 148 301 } … … 776 929 // if (rIsPluralRing(currRing)) 777 930 strat->red = redGrFirst; 931 if (currRing->real_var_start>0) 932 strat->red=redGrRatGB; 778 933 779 934 if (pLexOrder && strat->honey) … … 831 986 832 987 PrintS("F: \n"); 833 idPrint(F); 834 PrintS("Q: \n"); 988 idPrint(F); 989 PrintS("Q: \n"); 835 990 idPrint(Q); 836 991 #endif … … 838 993 839 994 840 995 841 996 assume(pOrdSgn != -1); // no mora!!! it terminates only for global ordering!!! (?) 842 997 … … 897 1052 /* prod.crit itself in nc_CreateSpoly */ 898 1053 } 899 1054 900 1055 strat->P.p = nc_CreateSpoly(strat->P.p1,strat->P.p2,currRing); 901 1056 … … 911 1066 PrintS("SPoly: "); pWrite(strat->P.p); 912 1067 } 913 #endif 914 } 915 916 1068 #endif 1069 } 1070 1071 917 1072 if (strat->P.p != NULL) 918 1073 { … … 981 1136 Print("s: "); pWrite(strat->P.p); 982 1137 #endif 983 1138 984 1139 } 985 1140 // kTest(strat); 986 1141 // 987 1142 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat); 988 1143 989 1144 if (strat->sl==-1) pos=0; 990 1145 else pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart); 991 1146 992 1147 strat->enterS(strat->P,pos,strat,-1); 993 1148 }
Note: See TracChangeset
for help on using the changeset viewer.