Changeset 1f6812 in git
- Timestamp:
- Feb 14, 2003, 9:18:18 PM (21 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 2217b4e28cf2e51884ba5badccb31db717fd34f5
- Parents:
- 335eeed94f74c9b1536e445cd619be96c31754b8
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/tgb.cc
r335eee r1f6812 6 6 #include "tgb.h" 7 7 #define OM_KEEP 0 8 #define LEN_VAR 48 #define LEN_VAR1 9 9 10 10 #ifdef LEN_VAR1 … … 277 277 278 278 279 #ifdef RANDOM_WALK280 int my_rand(int n){281 //RANDOM integer beetween 0,..,n-1282 int erg=(double(rand())/RAND_MAX) *n;283 return ((erg>=n)?erg-1:erg);284 }285 #endif286 279 287 280 static BOOLEAN is_empty(calc_dat* c){ … … 356 349 return s; 357 350 } 358 static BOOLEAN find_next_pair(calc_dat* c, BOOLEAN go_higher) 359 { 360 int start_i,start_j,i,j; 361 start_i=0; 362 start_j=-1; 363 #ifndef HOMOGENEOUS_EXAMPLE 364 if (c->misses_series>80){ 365 c->current_degree++; 366 c->misses_series=0; 367 } 368 #endif 369 start_i=c->continue_i; 370 start_j=c->continue_j; 371 372 for (int i=start_i;i<c->n;i++){ 373 if (c->T_deg[i]>c->current_degree) 374 { 375 c->skipped_pairs++; 376 continue; 377 } 378 for(int j=(i==start_i)?start_j+1:0;j<i;j++){ 379 // printf("searching at %d,%d",i,j); 380 if (c->misses_counter>=2) { 381 c->skipped_pairs++; 382 break; 383 } 384 if (c->states[i][j]==UNCALCULATED){ 385 if(c->deg[i][j]<=c->current_degree) 386 { 387 c->continue_i=c->found_i=i; 388 c->continue_j=c->found_j=j; 389 return TRUE; 390 } 391 else 392 { 393 ++(c->skipped_pairs); 394 } 395 } 396 } 397 c->misses_counter=0; 398 } 399 400 if (!((start_i==1) &&(start_j==0))){ 401 c->continue_i=1; 402 c->continue_j=0; 403 return find_next_pair(c); 404 } 405 406 if ((c->skipped_pairs>0) && go_higher){ 407 ++(c->current_degree); 408 c->skipped_pairs=0; 409 c->continue_i=0; 410 c->continue_j=0; 411 return find_next_pair(c); 412 } 413 return FALSE; 414 } 351 415 352 static void move_forward_in_S(int old_pos, int new_pos,kStrategy strat, BOOLEAN is_char0) 416 353 { … … 1541 1478 } 1542 1479 1480 static BOOLEAN redNF2_pseudo (redNF_inf* obj,calc_dat* c, int n){ 1481 if(obj->P->p==NULL) {obj->h=NULL; return TRUE;} 1482 LObject** P= (LObject**) omalloc(sizeof(LObject*)); 1483 P[0]=obj->P; 1484 int nonzero=1; 1485 multi_reduction(P, nonzero, c); 1486 if(nonzero) { 1487 int len; 1488 kBucketClear(P[0]->bucket,&(obj->h), & len); 1489 } else 1490 { 1491 obj->h=NULL; 1492 obj->P=NULL; 1493 } 1494 omfree(P); 1495 return TRUE; 1496 } 1543 1497 static BOOLEAN redNF2_n_steps (redNF_inf* obj,calc_dat* c, int n) 1544 1498 { … … 2037 1991 if (!c->work_on[i].is_free){ 2038 1992 // Print("Computing i=%i,j=%i",c->work_on[i].i,c->work_on[i].j); 2039 if(redNF2_ n_steps(&(c->work_on[i]),c,((c->reduction_steps+50)/(c->normal_forms+1))/4+5)){1993 if(redNF2_pseudo(&(c->work_on[i]),c,((c->reduction_steps+50)/(c->normal_forms+1))/4+5)){ 2040 1994 2041 1995 … … 2579 2533 erg.swap_roles=FALSE; 2580 2534 } 2581 return;2535 2582 2536 } 2583 2537 else … … 2654 2608 } 2655 2609 if(erg.swap_roles){ 2610 PrintS("b"); 2656 2611 poly clear_into; 2657 2612 int dummy_len; … … 2695 2650 else 2696 2651 pNorm(clear_into); 2697 if (new_pos<j) 2652 if (new_pos<j){ 2698 2653 move_forward_in_S(j,new_pos,c->strat,c->is_char0); 2699 2654 erg.reduce_by=new_pos; 2655 } 2700 2656 } 2701 2657 } … … 2724 2680 //not reduceable, try to use this for reducing higher terms 2725 2681 int i2; 2726 for (i2=i+1;i2< =losl;i2++){2682 for (i2=i+1;i2<losl;i2++){ 2727 2683 if (p_LmShortDivisibleBy(los[i]->p,los[i]->sev,los[i2]->p,los[i2]->sev, 2728 2684 c->r)){ … … 2811 2767 los[i]->p=kBucketGetLm(los[i]->bucket); 2812 2768 } 2813 poly h=kBucketGetLm(los[i]->bucket); 2769 2814 2770 kStrategy strat=c->strat; 2815 2771 int curr_pos=losl-1; … … 2841 2797 for(i=erg.to_reduce_l;i<=erg.to_reduce_u;i++) 2842 2798 { 2843 assume((!erg.fromS)||(i!=erg.reduce_by)); 2799 2800 assume((erg.fromS)||(i!=erg.reduce_by)); 2801 assume(reductor!=NULL); 2844 2802 number coef=kBucketPolyRed(los[i]->bucket,reductor, 2845 2803 len, -
Singular/tgb.h
r335eee r1f6812 135 135 BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, calc_dat* c); 136 136 static poly kBucketGcd(kBucket* b, ring r); 137 static void multi_reduction(LObject** los, int & losl, calc_dat* c); 137 138 #endif
Note: See TracChangeset
for help on using the changeset viewer.