Changeset 9cb2646 in git


Ignore:
Timestamp:
Feb 14, 2005, 4:29:33 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
2664d0fccb132e3077f9f8feee90ee2ce139ee26
Parents:
aa07a05c3a08e7bfc7d1e1326b8bfe6f74ab6430
Message:
*bricken: + multivariate


git-svn-id: file:///usr/local/Singular/svn/trunk@7725 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/fast_mult.cc

    raa07a0 r9cb2646  
    2727  if(erg2_i){
    2828    pNext(erg2_i)=NULL;
    29       }
     29  }
    3030  if (erg1_i){
    3131    pNext(erg1_i)=NULL;
     
    4242}
    4343
    44 poly do_unifastmult(poly f,int df,poly g,int dg, int vn, fastmultrec rec){
     44static poly do_unifastmult(poly f,int df,poly g,int dg, int vn, fastmultrec rec){
    4545  int n=1;
    4646  if ((f==NULL)||(g==NULL)) return NULL;
     
    9494 
    9595  if((f1!=NULL) &&(f0!=NULL) &&(g0!=NULL) && (g1!=NULL)){
    96   //if(true){
    97 //eat up f0,f1,g0,g1
     96    //if(true){
     97    //eat up f0,f1,g0,g1
    9898    poly s1=pAdd(f0,f1);
    9999    poly s2=pAdd(g0,g1);
    100   poly pbig=rec(s1,s2);
    101   pDelete(&s1);
    102   pDelete(&s2);
    103 
    104  
    105   //eat up pbig
    106   poly sum=pbig;
    107   pSetExp(factor,vn,pot);
    108  
    109   //eat up p00
    110   sum=pAdd(sum,pNeg(p00));
    111  
    112   //eat up p11
    113   sum=pAdd(sum,pNeg(p11));
    114 
    115  
    116   sum=pMult_mm(sum,factor);
    117 
    118 
    119   //eat up sum
    120   erg=pAdd(sum,erg);
     100    poly pbig=rec(s1,s2);
     101    pDelete(&s1);
     102    pDelete(&s2);
     103
     104 
     105    //eat up pbig
     106    poly sum=pbig;
     107    pSetExp(factor,vn,pot);
     108 
     109    //eat up p00
     110    sum=pAdd(sum,pNeg(p00));
     111 
     112    //eat up p11
     113    sum=pAdd(sum,pNeg(p11));
     114
     115 
     116    sum=pMult_mm(sum,factor);
     117
     118
     119    //eat up sum
     120    erg=pAdd(sum,erg);
    121121  } else {
    122122    //eat up f0,f1,g0,g1
     
    223223//   return erg;
    224224// }
     225
     226static inline int max(int a, int b){
     227  return (a>b)? a:b;
     228}
     229static inline int min(int a, int b){
     230  return (a>b)? b:a;
     231}
    225232poly unifastmult(poly f,poly g){
    226233  int vn=1;
     
    240247}
    241248
     249poly multifastmult(poly f, poly g){
     250  if((f==NULL)||(g==NULL)) return NULL;
     251  if (pLength(f)*pLength(g)<100)
     252    return ppMult_qq(f,g);
     253  //find vn
     254  //determine df,dg simultaneously
     255  int i;
     256  int can_i=-1;
     257  int can_df=0;
     258  int can_dg=0;
     259  int can_crit=0;
     260  for(i=1;i<=pVariables;i++){
     261    poly p;
     262    int df=0;
     263    int dg=0;
     264    //max min max Strategie
     265    p=f;
     266    while(p){
     267      df=max(df,pGetExp(p,i));
     268      p=pNext(p);
     269    }
     270    if(df>can_crit){
     271      p=g;
     272      while(p){
     273        dg=max(dg,pGetExp(p,i));
     274        p=pNext(p);
     275      }
     276      int crit=min(df,dg);
     277      if (crit>can_crit){
     278        can_crit=crit;
     279        can_i=i;
     280        can_df=df;
     281        can_dg=dg;
     282      }
     283    }
     284  }
     285  if(can_crit==0)
     286    return ppMult_qq(f,g);
     287  else
     288    return do_unifastmult(f,can_df,g,can_dg,can_i,multifastmult);
     289}
  • kernel/fast_mult.h

    raa07a0 r9cb2646  
    44#include "polys.h"
    55poly unifastmult(poly f,poly g);
    6 
     6poly multifastmult(poly f, poly g);
    77#endif
Note: See TracChangeset for help on using the changeset viewer.