Changeset c94036 in git
 Timestamp:
 Feb 25, 2005, 11:56:59 AM (19 years ago)
 Branches:
 (u'spielwiese', 'ec94ef7a30b928574c0c3daf41f6804dff5f6b69')
 Children:
 e36a2c02d04f328d5cb0f65d06c9645636bd53c3
 Parents:
 dc6b576eab156ea960b83a3ed8a822d14adab0b7
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/fast_mult.cc
rdc6b57 rc94036 400 400 p_ExpVectorAdd(p,q,r); 401 401 } 402 /*3 403 * compute for monomials p*q 404 * keeps p, q 405 * uses bin only available in MCPower 406 */ 407 static poly p_MonMultCMB(poly p, poly q, ring r) 408 { 409 number x; 410 int i; 411 poly res = p_Init(r,lm_bin); 412 413 x = n_Mult(p_GetCoeff(p,r),p_GetCoeff(q,r),r); 414 p_SetCoeff0(res,x,r); 415 p_ExpVectorSum(res,p, q,r); 416 return res; 417 } 402 418 static poly p_MonPowerMB(poly p, int exp, ring r) 403 419 { … … 419 435 return p; 420 436 } 421 static void buildTermAndAdd(int n,number* facult,poly* f_terms,int* exp,int f_len,kBucket_pt erg_bucket,ring r, number coef, poly & zw, poly tmp ){437 static void buildTermAndAdd(int n,number* facult,poly* f_terms,int* exp,int f_len,kBucket_pt erg_bucket,ring r, number coef, poly & zw, poly tmp, poly** term_pot){ 422 438 423 439 int i; … … 442 458 if(exp[i]!=0){ 443 459 ///poly term=p_Copy(f_terms[i],r); 444 poly term=tmp; 445 p_ExpVectorCopy(term,f_terms[i],r); 446 p_SetCoeff(term, n_Copy(p_GetCoeff(f_terms[i],r),r),r); 460 poly term=term_pot[i][exp[i]]; 461 //tmp; 462 //p_ExpVectorCopy(term,f_terms[i],r); 463 //p_SetCoeff(term, n_Copy(p_GetCoeff(f_terms[i],r),r),r); 464 447 465 //term>next=NULL; 448 466 449 p_MonPowerMB(term, exp[i],r);467 //p_MonPowerMB(term, exp[i],r); 450 468 p_MonMultMB(erg,term,r); 451 469 //p_Delete(&term,r); … … 460 478 461 479 462 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 ){480 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){ 463 481 int i; 464 482 … … 469 487 number new_coef=n_IntDiv(coef,facult[i],r); 470 488 poly zw_real=NULL; 471 MC_iterate(f, n, r, f_len,facult, exp,f_terms,erg_bucket,pos+1,sum+i,new_coef,zw_real,tmp );489 MC_iterate(f, n, r, f_len,facult, exp,f_terms,erg_bucket,pos+1,sum+i,new_coef,zw_real,tmp,term_pot); 472 490 if (pos==f_len2){ 473 491 //get first small polys … … 488 506 exp[pos]=i; 489 507 number new_coef=n_IntDiv(coef,facult[i],r); 490 buildTermAndAdd(n,facult,f_terms,exp,f_len,erg_bucket,r, new_coef,zw, tmp );508 buildTermAndAdd(n,facult,f_terms,exp,f_len,erg_bucket,r, new_coef,zw, tmp,term_pot); 491 509 // n_Delete(& new_coef,r); 492 510 } … … 518 536 //poly f_terms[f_len]; 519 537 poly* f_terms=(poly*)omalloc(f_len*sizeof(poly)); 538 poly** term_potences=(poly**) omalloc(f_len*sizeof(poly*)); 539 520 540 poly f_iter=f; 521 541 for(i=0;i<f_len;i++){ … … 523 543 f_iter=pNext(f_iter); 524 544 } 545 for(i=0;i<f_len;i++){ 546 term_potences[i]=(poly*)omalloc((n+1)*sizeof(poly)); 547 term_potences[i][0]=p_ISet(1,r); 548 int j; 549 for(j=1;j<=n;j++){ 550 term_potences[i][j]=p_MonMultCMB(f_terms[i],term_potences[i][j1],r); 551 } 552 } 525 553 assume(f_iter==NULL); 526 554 poly zw=NULL; 527 555 poly tmp=p_Init(r); 528 MC_iterate(f,n,r,f_len,&facult[0], &exp[0], &f_terms[0],erg_bucket,0,0,facult[n],zw,tmp );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); 529 557 530 558 … … 539 567 n_Delete(&facult[i],r); 540 568 } 569 int i2; 570 for (i=0;i<f_len;i++){ 571 for(i2=0;i2<=n;i2++){ 572 p_Delete(&term_potences[i][i2],r); 573 } 574 omfree(term_potences[i]); 575 576 } 577 omfree(term_potences); 541 578 p_Delete(&tmp,r); 542 579 omfree(exp);
Note: See TracChangeset
for help on using the changeset viewer.