Changeset 86aa6a1 in git
- Timestamp:
- Jun 27, 2008, 2:10:58 PM (15 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- bb7a4d8ceb25776da1ef2e024e02fd76ff2928e4
- Parents:
- 3b7e975b373f57a1e6cb135cc3765f937f180e12
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/tgb.cc
r3b7e97 r86aa6a1 5 5 * Computer Algebra System SINGULAR * 6 6 ****************************************/ 7 /* $Id: tgb.cc,v 1.15 6 2008-06-25 08:49:21bricken Exp $ */7 /* $Id: tgb.cc,v 1.157 2008-06-27 12:10:58 bricken Exp $ */ 8 8 /* 9 9 * ABSTRACT: slimgb and F4 implementation … … 24 24 #include "gring.h" 25 25 #include "sca.h" 26 26 #include "prCopy.h" 27 27 #include "longrat.h" 28 28 #include "modulop.h" … … 441 441 } 442 442 int d=ca->pTotaldegree(lm); 443 #if 1443 #if 0 444 444 assume(sugar>=d); 445 445 s=1+(bucket_guess(b)-1)*(sugar-d+1); … … 454 454 if(b->buckets[i]==NULL) continue; 455 455 456 if (( pTotaldegree(b->buckets[i])<=d) &&(elength_is_normal_length(b->buckets[i],ca))){456 if ((ca->pTotaldegree(b->buckets[i])<=d) &&(elength_is_normal_length(b->buckets[i],ca))){ 457 457 s+=b->buckets_length[i]; 458 458 } else … … 1272 1272 sorted_pair_node** add_to_basis_ideal_quotient(poly h, slimgb_alg* c, int* ip) 1273 1273 { 1274 1274 p_Test(h,c->r); 1275 1275 assume(h!=NULL); 1276 1276 poly got=gcd_of_terms(h,c->r); … … 1477 1477 pLcm(c->S->m[i], c->S->m[j], lm); 1478 1478 pSetm(lm); 1479 p_Test(lm,c->r); 1479 1480 s->deg=c->pTotaldegree(lm); 1480 1481 … … 1486 1487 //Print("\n max: %d\n",max(t_i,t_j)); 1487 1488 } 1489 p_Test(lm,c->r); 1488 1490 s->lcm_of_lm=lm; 1489 1491 // pDelete(&short_s); … … 1551 1553 else 1552 1554 { 1555 p_Test(nodes[lower]->lcm_of_lm,c->r); 1553 1556 nodes[lower]->lcm_of_lm=pCopy(nodes[lower]->lcm_of_lm); 1554 1557 assume(_p_GetComp(c->S->m[nodes[lower]->i],c->r)==_p_GetComp(c->S->m[nodes[lower]->j],c->r)); … … 1944 1947 sorted_pair_node*** sbuf=(sorted_pair_node***) omalloc(pn*sizeof(sorted_pair_node**)); 1945 1948 for(j=0;j<pn;j++){ 1949 p_Test(p[j],c->r); 1946 1950 sbuf[j]=add_to_basis_ideal_quotient(p[j],c,ibuf+j); 1947 1951 } … … 2462 2466 if (c->nc){ 2463 2467 h= nc_CreateSpoly(c->S->m[s->i], c->S->m[s->j]/*, NULL*/, c->r); 2468 2464 2469 if (h!=NULL) 2465 2470 pCleardenom(h); … … 2468 2473 #endif 2469 2474 h=ksOldCreateSpoly(c->S->m[s->i], c->S->m[s->j], NULL, c->r); 2470 } 2471 else 2475 p_Test(h,c->r); 2476 } 2477 else{ 2472 2478 h=s->lcm_of_lm; 2479 p_Test(h,c->r); 2480 } 2473 2481 // if(s->i>=0) 2474 2482 // now_t_rep(s->j,s->i,c); 2475 2483 number coef; 2476 2484 int mlen=pLength(h); 2485 p_Test(h,c->r); 2477 2486 if ((!c->nc)&(!(use_noro))){ 2478 2487 h=redNF2(h,c,mlen,coef,2); … … 2480 2489 nDelete(&coef); 2481 2490 } 2491 p_Test(h,c->r); 2482 2492 free_sorted_pair_node(s,c->r); 2483 2493 if(!h) continue; … … 2536 2546 red_object* buf=(red_object*) omalloc(i*sizeof(red_object)); 2537 2547 for(j=0;j<i;j++){ 2548 p_Test(p[j],c->r); 2538 2549 buf[j].p=p[j]; 2539 2550 buf[j].sev=pGetShortExpVector(p[j]); 2540 2551 buf[j].bucket = kBucketCreate(currRing); 2552 p_Test(p[j],c->r); 2541 2553 if (c->eliminationProblem){ 2542 2554 buf[j].sugar=c->pTotaldegree_full(p[j]); … … 2600 2612 kBucketClear(buf[j].bucket,&p, &len); 2601 2613 kBucketDestroy(&buf[j].bucket); 2602 2614 p_Test(p,c->r); 2603 2615 //if (!c->nc) { 2604 2616 if ((c->tailReductions) ||(lies_in_last_dp_block(p,c))){ … … 2608 2620 } 2609 2621 //} 2622 p_Test(p,c->r); 2610 2623 add_those[j]=p; 2611 2624 … … 2809 2822 simplify_poly(p,r); 2810 2823 si->expected_length=pQuality(p,this,pLength(p)); 2824 p_Test(p,r); 2811 2825 si->deg=this->pTotaldegree_full(p); 2812 2826 /*if (!rField_is_Zp(r)){ … … 2814 2828 pCleardenom(p); 2815 2829 }*/ 2830 2816 2831 si->lcm_of_lm=p; 2817 2832 … … 2826 2841 omfree(si_array); 2827 2842 } 2828 slimgb_alg::slimgb_alg(ideal I, int syz_comp,BOOLEAN F4 ){2829 2843 slimgb_alg::slimgb_alg(ideal I, int syz_comp,BOOLEAN F4,int deg_pos){ 2844 this->deg_pos=deg_pos; 2830 2845 lastCleanedDeg=-1; 2831 2846 completed=FALSE; … … 3191 3206 ideal t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode){ 3192 3207 3208 assume(r==currRing); 3209 ring orig_ring=r; 3210 int pos; 3211 ring new_ring=rAssure_TDeg(orig_ring,1,rVar(orig_ring),pos); 3212 3213 3214 ideal s_h; 3215 if (orig_ring != new_ring) 3216 { 3217 rChangeCurrRing(new_ring); 3218 s_h=idrCopyR_NoSort(arg_I,orig_ring); 3219 idTest(s_h); 3220 /*int i; 3221 3222 for(i=0;i<IDELEMS(s_h);i++){ 3223 poly p=s_h->m[i]; 3224 while(p){ 3225 p_Setm(p,new_ring); 3226 pIter(p); 3227 } 3228 }*/ 3229 } 3230 else 3231 { 3232 s_h = id_Copy(arg_I,orig_ring); 3233 } 3234 3235 ideal s_result=do_t_rep_gb(new_ring,s_h,syz_comp,F4_mode,pos); 3236 ideal result; 3237 if(orig_ring != new_ring) 3238 { 3239 3240 idTest(s_result); 3241 rChangeCurrRing(orig_ring); 3242 result = idrMoveR_NoSort(s_result, new_ring); 3243 3244 idTest(result); 3245 //rChangeCurrRing(new_ring); 3246 rKill(new_ring); 3247 //rChangeCurrRing(orig_ring); 3248 } 3249 else 3250 result=s_result; 3251 idTest(result); 3252 return result; 3253 } 3254 3255 3256 3257 ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos){ 3258 3193 3259 // Print("QlogSize(0) %d, QlogSize(1) %d,QlogSize(-2) %d, QlogSize(5) %d\n", QlogSize(nlInit(0)),QlogSize(nlInit(1)),QlogSize(nlInit(-2)),QlogSize(nlInit(5))); 3194 3260 … … 3200 3266 //if (debug_Ideal) PrintS("DebugIdeal received\n"); 3201 3267 // Print("Idelems %i \n----------\n",IDELEMS(arg_I)); 3202 ideal I= idCopy(arg_I);3268 ideal I=arg_I; 3203 3269 idCompactify(I); 3204 3270 if (idIs0(I)) return I; … … 3215 3281 //slimgb_alg* c=(slimgb_alg*) omalloc(sizeof(slimgb_alg)); 3216 3282 //int syz_comp=arg_I->rank; 3217 slimgb_alg* c=new slimgb_alg(I, syz_comp,F4_mode );3283 slimgb_alg* c=new slimgb_alg(I, syz_comp,F4_mode,deg_pos); 3218 3284 3219 3285 … … 3566 3632 t=t->next; 3567 3633 } 3568 3634 p_Setm(m,r); 3569 3635 if (max_g_0>0) 3570 3636 return m; -
kernel/tgb_internal.h
r3b7e97 r86aa6a1 5 5 * Computer Algebra System SINGULAR * 6 6 ****************************************/ 7 /* $Id: tgb_internal.h,v 1.7 1 2008-06-25 08:49:22bricken Exp $ */7 /* $Id: tgb_internal.h,v 1.72 2008-06-27 12:10:58 bricken Exp $ */ 8 8 /* 9 9 * ABSTRACT: tgb internal .h file … … 181 181 { 182 182 public: 183 slimgb_alg(ideal I, int syz_comp,BOOLEAN F4 );183 slimgb_alg(ideal I, int syz_comp,BOOLEAN F4,int deg_pos); 184 184 void introduceDelayedPairs(poly* pa,int s); 185 185 virtual ~slimgb_alg(); … … 241 241 int lastDpBlockStart; 242 242 int lastCleanedDeg; 243 int deg_pos; 243 244 BOOLEAN use_noro; 244 245 BOOLEAN use_noro_last_block; … … 254 255 #endif 255 256 unsigned long pTotaldegree(poly p){ 256 return ::pTotaldegree(p,this->r); 257 pTest(p); 258 //assume(pDeg(p,r)==::pTotaldegree(p,r)); 259 assume(::pTotaldegree(p,r)==p->exp[deg_pos]); 260 return p->exp[deg_pos]; 261 //return ::pTotaldegree(p,this->r); 257 262 } 258 263 int pTotaldegree_full(poly p){ … … 301 306 static void do_this_spoly_stuff(int i,int j,slimgb_alg* c); 302 307 //ideal t_rep_gb(ring r,ideal arg_I); 308 ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos); 303 309 static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state); 304 310 static int* make_connections(int from, poly bound, slimgb_alg* c);
Note: See TracChangeset
for help on using the changeset viewer.