Changeset 74021a in git
- Timestamp:
- Nov 10, 2010, 5:52:40 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c18334b998a8adbf0013b8e1ce0824774019443e')
- Children:
- cc336ab2c31ee68cf38ff3e276930dbbc62d1b69
- Parents:
- cd246b32ff1d71ef365e9ae2dd3c16bc4a01a36e
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-11-10 17:52:40+01:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:38+01:00
- Location:
- polys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
polys/monomials/p_polys.cc
rcd246b r74021a 2707 2707 return result; 2708 2708 } 2709 2710 poly p_TakeOutComp(poly * p, int k, const ring r) 2711 { 2712 poly q = *p,qq=NULL,result = NULL; 2713 2714 if (q==NULL) return NULL; 2715 BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r); 2716 if (p_GetComp(q,r)==k) 2717 { 2718 result = q; 2719 do 2720 { 2721 p_SetComp(q,0,r); 2722 if (use_setmcomp) p_SetmComp(q,r); 2723 qq = q; 2724 pIter(q); 2725 } 2726 while ((q!=NULL) && (p_GetComp(q,r)==k)); 2727 *p = q; 2728 pNext(qq) = NULL; 2729 } 2730 if (q==NULL) return result; 2731 if (p_GetComp(q,r) > k) 2732 { 2733 p_SubComp(q,1,r); 2734 if (use_setmcomp) p_SetmComp(q,r); 2735 } 2736 poly pNext_q; 2737 while ((pNext_q=pNext(q))!=NULL) 2738 { 2739 if (p_GetComp(pNext_q,r)==k) 2740 { 2741 if (result==NULL) 2742 { 2743 result = pNext_q; 2744 qq = result; 2745 } 2746 else 2747 { 2748 pNext(qq) = pNext_q; 2749 pIter(qq); 2750 } 2751 pNext(q) = pNext(pNext_q); 2752 pNext(qq) =NULL; 2753 p_SetComp(qq,0,r); 2754 if (use_setmcomp) p_SetmComp(qq,r); 2755 } 2756 else 2757 { 2758 /*pIter(q);*/ q=pNext_q; 2759 if (p_GetComp(q,r) > k) 2760 { 2761 p_SubComp(q,1,r); 2762 if (use_setmcomp) p_SetmComp(q,r); 2763 } 2764 } 2765 } 2766 return result; 2767 } 2768 2769 // Splits *p into two polys: *q which consists of all monoms with 2770 // component == comp and *p of all other monoms *lq == pLength(*q) 2771 void p_TakeOutComp(poly *r_p, long comp, poly *r_q, int *lq, const ring r) 2772 { 2773 spolyrec pp, qq; 2774 poly p, q, p_prev; 2775 int l = 0; 2776 2777 #ifdef HAVE_ASSUME 2778 int lp = pLength(*r_p); 2779 #endif 2780 2781 pNext(&pp) = *r_p; 2782 p = *r_p; 2783 p_prev = &pp; 2784 q = &qq; 2785 2786 while(p != NULL) 2787 { 2788 while (p_GetComp(p,r) == comp) 2789 { 2790 pNext(q) = p; 2791 pIter(q); 2792 p_SetComp(p, 0,r); 2793 p_SetmComp(p,r); 2794 pIter(p); 2795 l++; 2796 if (p == NULL) 2797 { 2798 pNext(p_prev) = NULL; 2799 goto Finish; 2800 } 2801 } 2802 pNext(p_prev) = p; 2803 p_prev = p; 2804 pIter(p); 2805 } 2806 2807 Finish: 2808 pNext(q) = NULL; 2809 *r_p = pNext(&pp); 2810 *r_q = pNext(&qq); 2811 *lq = l; 2812 #ifdef HAVE_ASSUME 2813 assume(pLength(*r_p) + pLength(*r_q) == lp); 2814 #endif 2815 p_Test(*r_p,r); 2816 p_Test(*r_q,r); 2817 } 2818 2819 void p_DecrOrdTakeOutComp(poly *r_p, long comp, long order, 2820 poly *r_q, int *lq, const ring r) 2821 { 2822 spolyrec pp, qq; 2823 poly p, q, p_prev; 2824 int l = 0; 2825 2826 pNext(&pp) = *r_p; 2827 p = *r_p; 2828 p_prev = &pp; 2829 q = &qq; 2830 2831 #ifdef HAVE_ASSUME 2832 if (p != NULL) 2833 { 2834 while (pNext(p) != NULL) 2835 { 2836 assume(p_GetOrder(p,r) >= p_GetOrder(pNext(p),r)); 2837 pIter(p); 2838 } 2839 } 2840 p = *r_p; 2841 #endif 2842 2843 while (p != NULL && p_GetOrder(p,r) > order) pIter(p); 2844 2845 while(p != NULL && p_GetOrder(p,r) == order) 2846 { 2847 while (p_GetComp(p,r) == comp) 2848 { 2849 pNext(q) = p; 2850 pIter(q); 2851 pIter(p); 2852 p_SetComp(p, 0,r); 2853 p_SetmComp(p,r); 2854 l++; 2855 if (p == NULL || p_GetOrder(p,r) != order) 2856 { 2857 pNext(p_prev) = p; 2858 goto Finish; 2859 } 2860 } 2861 pNext(p_prev) = p; 2862 p_prev = p; 2863 pIter(p); 2864 } 2865 2866 Finish: 2867 pNext(q) = NULL; 2868 *r_p = pNext(&pp); 2869 *r_q = pNext(&qq); 2870 *lq = l; 2871 } 2872 2873 void p_DeleteComp(poly * p,int k, const ring r) 2874 { 2875 poly q; 2876 2877 while ((*p!=NULL) && (p_GetComp(*p,r)==k)) p_LmDelete(p,r); 2878 if (*p==NULL) return; 2879 q = *p; 2880 if (p_GetComp(q,r)>k) 2881 { 2882 p_SubComp(q,1,r); 2883 p_SetmComp(q,r); 2884 } 2885 while (pNext(q)!=NULL) 2886 { 2887 if (p_GetComp(pNext(q),r)==k) 2888 p_LmDelete(&(pNext(q)),r); 2889 else 2890 { 2891 pIter(q); 2892 if (p_GetComp(q,r)>k) 2893 { 2894 p_SubComp(q,1,r); 2895 p_SetmComp(q,r); 2896 } 2897 } 2898 } 2899 } 2709 2900 /*************************************************************** 2710 2901 * -
polys/monomials/p_polys.h
rcd246b r74021a 1785 1785 void p_VectorHasUnit(poly p, int * k, int * len, const ring r); 1786 1786 poly p_TakeOutComp1(poly * p, int k, const ring r); 1787 // Splits *p into two polys: *q which consists of all monoms with 1788 // component == comp and *p of all other monoms *lq == pLength(*q) 1789 // On return all components pf *q == 0 1790 void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r); 1791 1792 // Similar to pTakeOutComp, except that only those components are 1793 // taken out whose Order == order 1794 // ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then 1795 // m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2) 1796 void p_DecrOrdTakeOutComp(poly *r_p, long comp, long order, 1797 poly *r_q, int *lq, const ring r) 1798 1799 // This is something weird -- Don't use it, unless you know what you are doing 1800 poly p_TakeOutComp(poly * p, int k); 1801 1802 void p_DeleteComp(poly * p,int k, const ring r); 1803 1787 1804 #endif // P_POLYS_H 1788 1805 -
polys/polys.h
rcd246b r74021a 331 331 // This is something weird -- Don't use it, unless you know what you are doing 332 332 poly pTakeOutComp(poly * p, int k); 333 /* old spielwiese 334 #define pTakeOutComp(p,k,q,lq) p_TakeOutComp(p,k,q,lq,currRing) 335 336 // Similar to pTakeOutComp, except that only those components are 337 // taken out whose Order == order 338 // ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then 339 // m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2) 340 #define pDecrOrdTakeOutComp(p,c,o,q,lq) p_DecrOrdTakeOutComp(p,c,o,q,lq,currRing) 341 */ 333 342 void pSetPolyComp(poly p, int comp); 334 void pDeleteComp(poly * p,int k); 343 #define pDeleteComp(p,k) p_DeleteComp(p,k,currRing) 335 344 void pNorm(poly p); 336 345 poly pSubst(poly p, int n, poly e);
Note: See TracChangeset
for help on using the changeset viewer.