Changeset 9cb2646 in git
- Timestamp:
- Feb 14, 2005, 4:29:33 PM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
- Children:
- 2664d0fccb132e3077f9f8feee90ee2ce139ee26
- Parents:
- aa07a05c3a08e7bfc7d1e1326b8bfe6f74ab6430
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/fast_mult.cc
raa07a0 r9cb2646 27 27 if(erg2_i){ 28 28 pNext(erg2_i)=NULL; 29 29 } 30 30 if (erg1_i){ 31 31 pNext(erg1_i)=NULL; … … 42 42 } 43 43 44 poly do_unifastmult(poly f,int df,poly g,int dg, int vn, fastmultrec rec){44 static poly do_unifastmult(poly f,int df,poly g,int dg, int vn, fastmultrec rec){ 45 45 int n=1; 46 46 if ((f==NULL)||(g==NULL)) return NULL; … … 94 94 95 95 if((f1!=NULL) &&(f0!=NULL) &&(g0!=NULL) && (g1!=NULL)){ 96 //if(true){97 //eat up f0,f1,g0,g196 //if(true){ 97 //eat up f0,f1,g0,g1 98 98 poly s1=pAdd(f0,f1); 99 99 poly s2=pAdd(g0,g1); 100 poly pbig=rec(s1,s2);101 pDelete(&s1);102 pDelete(&s2);103 104 105 //eat up pbig106 poly sum=pbig;107 pSetExp(factor,vn,pot);108 109 //eat up p00110 sum=pAdd(sum,pNeg(p00));111 112 //eat up p11113 sum=pAdd(sum,pNeg(p11));114 115 116 sum=pMult_mm(sum,factor);117 118 119 //eat up sum120 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); 121 121 } else { 122 122 //eat up f0,f1,g0,g1 … … 223 223 // return erg; 224 224 // } 225 226 static inline int max(int a, int b){ 227 return (a>b)? a:b; 228 } 229 static inline int min(int a, int b){ 230 return (a>b)? b:a; 231 } 225 232 poly unifastmult(poly f,poly g){ 226 233 int vn=1; … … 240 247 } 241 248 249 poly 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 4 4 #include "polys.h" 5 5 poly unifastmult(poly f,poly g); 6 6 poly multifastmult(poly f, poly g); 7 7 #endif
Note: See TracChangeset
for help on using the changeset viewer.