Changeset 609334 in git
- Timestamp:
- Feb 26, 2009, 12:14:16 PM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 3a852046e44ceaad99faf50863adfab42f049b2c
- Parents:
- 61944d0a0689203f1f85c43b1610be266ec31371
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/polys1.cc
r61944d0 r609334 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1.3 2 2008-07-25 14:37:55 SingularExp $ */4 /* $Id: polys1.cc,v 1.33 2009-02-26 11:14:16 levandov Exp $ */ 5 5 6 6 /* … … 26 26 #ifdef HAVE_FACTORY 27 27 #include "clapsing.h" 28 #endif 29 30 #ifdef HAVE_RATGRING 31 #include "ratgring.h" 28 32 #endif 29 33 … … 1048 1052 } 1049 1053 if (h!=NULL) nDelete(&h); 1050 pContent(ph); 1054 1055 #ifdef HAVE_RATGRING 1056 if (rIsRatGRing(currRing)) 1057 { 1058 pContentRat(ph); 1059 } 1060 else 1061 #endif 1062 pContent(ph); 1051 1063 } 1052 1064 } -
kernel/ratgring.cc
r61944d0 r609334 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: ratgring.cc,v 1.1 7 2009-02-25 17:01:00 SingularExp $9 * Version: $Id: ratgring.cc,v 1.18 2009-02-26 11:14:16 levandov Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 100 100 } 101 101 102 /* TO TEST!!! */103 102 /* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials 104 103 have the same D-part … … 110 109 poly q = pNext(p); 111 110 poly res; // = p_Head(p,r); 112 res = p_GetExp_k_n(p, ishift+1, r->N, r); 111 res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally 113 112 p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r); 114 113 poly s; … … 129 128 p_LmCheckPolyRing2(*p, r); 130 129 poly q = p_Head(*p,r); 131 // in the next line ishift is correct 132 while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift, r) )) 130 while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) )) 133 131 { 134 132 p_LmDelete(p,r); … … 464 462 id_Delete(&ncsyz,r); 465 463 466 p_LmDeleteAndNextRat(&p1, is +1, r); // t_f467 p_LmDeleteAndNextRat(&HF, is +1, r); // r_f = h_f - lt_D(h_f)468 469 p_LmDeleteAndNextRat(&p2, is +1, r); // t_g470 p_LmDeleteAndNextRat(&HG, is +1, r); // r_g = h_g - lt_D(h_g)464 p_LmDeleteAndNextRat(&p1, is, r); // t_f 465 p_LmDeleteAndNextRat(&HF, is, r); // r_f = h_f - lt_D(h_f) 466 467 p_LmDeleteAndNextRat(&p2, is, r); // t_g 468 p_LmDeleteAndNextRat(&HG, is, r); // r_g = h_g - lt_D(h_g) 471 469 472 470 … … 506 504 #endif 507 505 508 if ( out!=NULL ) pContent(out);506 // if ( out!=NULL ) pContent(out); // postponed to enterS 509 507 return(out); 510 508 } … … 560 558 // alt: 561 559 poly out = p_Copy(p1,r); 562 p_LmDeleteAndNextRat(&out, is +1, r); // out == t_g560 p_LmDeleteAndNextRat(&out, is, r); // out == t_g 563 561 564 562 ideal ncsyz = ncGCD(P,K,r); … … 572 570 #endif 573 571 id_Delete(&ncsyz,r); 574 p_LmDeleteAndNextRat(&p2, is +1, r); // t_f575 p_LmDeleteAndNextRat(&H, is +1, r); // r_g = h_g - lt_D(h_g)572 p_LmDeleteAndNextRat(&p2, is, r); // t_f 573 p_LmDeleteAndNextRat(&H, is, r); // r_g = h_g - lt_D(h_g) 576 574 577 575 #ifdef PDEBUG … … 608 606 #endif 609 607 610 if ( out!=NULL ) pContent(out);608 // if ( out!=NULL ) pContent(out); // postponed to enterS 611 609 return(out); 612 610 } … … 687 685 } 688 686 689 polypContentRat(poly ph)690 // destroys ph687 void pContentRat(poly ph) 688 // changes ph 691 689 // for rat coefficients in K(x1,..xN) 692 690 { … … 701 699 int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs 702 700 int k = 0; 703 poly p = p h;701 poly p = pCopy(ph); // ph will be needed below 704 702 int HasConstantCoef = 0; 705 703 int mintdeg = pTotaldegree(p); 706 704 int minlen = len; 705 int is = currRing->real_var_start - 1; 707 706 while (p!=NULL) 708 707 { 709 LM[k] = p_ HeadRat(p, currRing->real_var_start, currRing);710 C[k] = p_GetCoeffRat(p, currRing->real_var_start, currRing);708 LM[k] = p_GetExp_k_n(p,1,is,currRing); // need LmRat istead of p_HeadRat(p, is, currRing); ! 709 C[k] = p_GetCoeffRat(p, is, currRing); 711 710 D[k] = pTotaldegree(C[k]); 712 711 mintdeg = si_min(mintdeg,D[k]); … … 719 718 // smth like goto cleanup and return(pContent(p)); 720 719 } 721 p_LmDeleteAndNextRat(&p, currRing->real_var_start, currRing);720 p_LmDeleteAndNextRat(&p, is, currRing); 722 721 k++; 723 722 } … … 734 733 if (L[i] < mindeglen) 735 734 { 736 735 mindeglen=L[i]; 737 736 pmindeglen = i; 738 737 } … … 759 758 pDelete(&LM[k]); 760 759 } 761 p =pContent(ph);760 pContent(ph); 762 761 goto cleanup; 763 762 } … … 774 773 for(i=0; i<=k; i++) 775 774 { 776 p =pAdd(p,pMult(C[i],LM[i]));775 p = pAdd(p, pMult(C[i],LM[i]) ); 777 776 C[i]=NULL; LM[i]=NULL; 778 777 } 778 pDelete(&ph); // do not need it anymore 779 ph = p; 779 780 // aufraeumen, return 780 781 cleanup: … … 783 784 omFree(D); 784 785 omFree(L); 785 return p; 786 } 787 #endif 786 } 787 #endif -
kernel/ratgring.h
r61944d0 r609334 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ratgring.h,v 1. 9 2009-02-25 16:37:34levandov Exp $ */6 /* $Id: ratgring.h,v 1.10 2009-02-26 11:14:16 levandov Exp $ */ 7 7 /* 8 8 * ABSTRACT additional defines etc for --with-plural … … 12 12 #ifdef HAVE_RATGRING 13 13 #include "structs.h" 14 #include "gring.h" 14 15 15 16 /* MACROS */ … … 114 115 // Content stuff 115 116 116 poly pInitContentRat_a(poly ph);117 117 void pContentRat(poly ph); 118 118
Note: See TracChangeset
for help on using the changeset viewer.