| 495 | } |
| 496 | |
| 497 | void maPoly_Eval(mapoly root, ring src_r, ideal dest_id, ring dest_r, int total_cost) |
| 498 | { |
| 499 | // invert the list rooted at root: |
| 500 | if ((root!=NULL) && (root->next!=NULL)) |
| 501 | { |
| 502 | mapoly q=root->next; |
| 503 | mapoly qn; |
| 504 | root->next=NULL; |
| 505 | do |
| 506 | { |
| 507 | qn=q->next; |
| 508 | q->next=root; |
| 509 | root=q; |
| 510 | q=qn; |
| 511 | } |
| 512 | while (qn !=NULL); |
| 513 | } |
| 514 | |
| 515 | total_cost /= 10; |
| 516 | int next_print_cost = total_cost; |
| 517 | |
| 518 | // the evaluation ----------------------------------------- |
| 519 | mapoly p=root; |
| 520 | int cost = 0; |
| 521 | |
| 522 | while (p!=NULL) |
| 523 | { |
| 524 | // look at each mapoly: compute its value in ->dest |
| 525 | assume (p->dest==NULL); |
| 526 | { |
| 527 | if ((p->f1!=NULL)&&(p->f2!=NULL)) |
| 528 | { |
| 529 | poly f1=p->f1->dest; |
| 530 | poly f2=p->f2->dest; |
| 531 | if (p->f1->ref>0) f1=p_Copy(f1,dest_r); |
| 532 | else |
| 533 | { |
| 534 | // we own p->f1->dest now (in f1) |
| 535 | p->f1->dest=NULL; |
| 536 | } |
| 537 | if (p->f2->ref>0) f2=p_Copy(f2,dest_r); |
| 538 | else |
| 539 | { |
| 540 | // we own p->f2->dest now (in f2) |
| 541 | p->f2->dest=NULL; |
| 542 | } |
| 543 | maMonomial_Free(p->f1,src_r, dest_r); |
| 544 | maMonomial_Free(p->f2,src_r, dest_r); |
| 545 | p->dest=p_Mult_q(f1,f2,dest_r); |
| 546 | } /* factors : 2 */ |
| 547 | else |
| 548 | { |
| 549 | assume((p->f1==NULL) && (p->f2==NULL)); |
| 550 | // no factorization provided, use the classical method: |
| 551 | p->dest=maPoly_EvalMon(p->src,src_r,dest_id->m,dest_r); |
| 552 | } |
| 553 | } /* p->dest==NULL */ |
| 554 | // substitute the monomial: go through macoeff |
no test coverage detected