| 526 | |
| 527 | |
| 528 | static void MC_iterate(poly f, int n, ring r, int f_len,number* facult, int* exp,poly* f_terms,kBucket_pt erg_bucket,int pos,int sum, number coef, poly & zw, poly tmp, poly** term_pot){ |
| 529 | int i; |
| 530 | |
| 531 | if (pos<f_len-1) |
| 532 | { |
| 533 | poly zw_l=NULL; |
| 534 | number new_coef; |
| 535 | for(i=0;i<=n-sum;i++) |
| 536 | { |
| 537 | exp[pos]=i; |
| 538 | if(i==0) |
| 539 | { |
| 540 | new_coef=n_Copy(coef,r->cf); |
| 541 | } |
| 542 | else |
| 543 | { |
| 544 | number old=new_coef; |
| 545 | number old_rest=n_Init(n-sum-(i-1),r->cf); |
| 546 | new_coef=n_Mult(new_coef,old_rest,r->cf); |
| 547 | n_Delete(&old_rest,r->cf); |
| 548 | n_Delete(&old,r->cf); |
| 549 | number i_number=n_Init(i,r->cf); |
| 550 | old=new_coef; |
| 551 | new_coef=n_Div(new_coef,i_number,r->cf); |
| 552 | n_Normalize(new_coef,r->cf); |
| 553 | n_Delete(&old,r->cf); |
| 554 | n_Delete(&i_number,r->cf); |
| 555 | } |
| 556 | //new_coef is |
| 557 | //(n ) |
| 558 | //(exp[0]..exp[pos] 0 0 0 rest) |
| 559 | poly zw_real=NULL; |
| 560 | MC_iterate(f, n, r, f_len,facult, exp,f_terms,erg_bucket,pos+1,sum+i,new_coef,zw_real,tmp,term_pot); |
| 561 | if (pos==f_len-2) |
| 562 | { |
| 563 | //get first small polys |
| 564 | |
| 565 | zw_real->next=zw_l; |
| 566 | zw_l=zw_real; |
| 567 | } |
| 568 | //n_Delete(& new_coef,r->cf); |
| 569 | } |
| 570 | n_Delete(&new_coef,r->cf); |
| 571 | if (pos==f_len-2) |
| 572 | { |
| 573 | int len=n-sum+1; |
| 574 | kBucket_Add_q(erg_bucket,zw_l,&len); |
| 575 | } |
| 576 | return; |
| 577 | } |
| 578 | if(pos==f_len-1) |
| 579 | { |
| 580 | i=n-sum; |
| 581 | exp[pos]=i; |
| 582 | number new_coef=n_Copy(coef,r->cf);//n_IntDiv(coef,facult[i],r); //really consumed??????? |
| 583 | buildTermAndAdd(n,facult,f_terms,exp,f_len,erg_bucket,r, new_coef,zw, tmp,term_pot); |
| 584 | // n_Delete(& new_coef,r); |
| 585 | } |
no test coverage detected