Changeset 9a92d97 in git


Ignore:
Timestamp:
Mar 31, 2005, 1:45:00 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '3720ae8bfcff4a4649ee98a15552089151d2d59b')
Children:
1903b7f98b7252fcf5bf02cbecaa4d79d4d87556
Parents:
e707b8e1bd2fb81722355c5ae845fef978f73085
Message:
*bricken: multinomial coeff. clever calculated


git-svn-id: file:///usr/local/Singular/svn/trunk@7803 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/fast_mult.cc

    re707b8 r9a92d97  
    480480static 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){
    481481  int i;
    482 
     482 
    483483  if (pos<f_len-1){
    484484    poly zw_l=NULL;
     485    number new_coef;
    485486    for(i=0;i<=n-sum;i++){
    486487      exp[pos]=i;
    487       number new_coef=n_IntDiv(coef,facult[i],r);
     488      if(i==0){
     489        new_coef=n_Copy(coef,r);
     490      }
     491      else {
     492        number old=new_coef;
     493        number old_rest=n_Init(n-sum-(i-1),r);
     494        new_coef=n_Mult(new_coef,old_rest,r);
     495        n_Delete(&old_rest,r);
     496        n_Delete(&old,r);
     497        number i_number=n_Init(i,r);
     498        old=new_coef;
     499        new_coef=n_IntDiv(new_coef,i_number,r);
     500        n_Delete(&old,r);
     501        n_Delete(&i_number,r);
     502      }
     503      //new_coef is
     504      //(n                          )
     505      //(exp[0]..exp[pos] 0 0 0 rest)
    488506      poly zw_real=NULL;
    489507      MC_iterate(f, n, r, f_len,facult, exp,f_terms,erg_bucket,pos+1,sum+i,new_coef,zw_real,tmp,term_pot);
     
    494512        zw_l=zw_real;
    495513      }
    496       n_Delete(& new_coef,r);
    497     }
     514      //n_Delete(& new_coef,r);
     515    }
     516    n_Delete(&new_coef,r);
    498517    if (pos==f_len-2){
    499518      int len=n-sum+1;
     
    505524    i=n-sum;
    506525    exp[pos]=i;
    507     number new_coef=n_IntDiv(coef,facult[i],r);
     526    number new_coef=nCopy(coef);//n_IntDiv(coef,facult[i],r); //really consumed???????
    508527    buildTermAndAdd(n,facult,f_terms,exp,f_len,erg_bucket,r, new_coef,zw, tmp,term_pot);
    509528    // n_Delete(& new_coef,r);
     
    554573  poly zw=NULL;
    555574  poly tmp=p_Init(r);
    556   MC_iterate(f,n,r,f_len,&facult[0], &exp[0], &f_terms[0],erg_bucket,0,0,facult[n],zw,tmp, term_potences);
    557 
    558 
    559 
     575  number one=n_Init(1,r);
     576  MC_iterate(f,n,r,f_len,&facult[0], &exp[0], &f_terms[0],erg_bucket,0,0,one/*facult[n]*/,zw,tmp, term_potences);
     577
     578
     579  n_Delete(&one,r);
    560580
    561581
Note: See TracChangeset for help on using the changeset viewer.