- Timestamp:
- Nov 19, 2018, 2:19:50 PM (5 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
- Children:
- 38554beb085c7b26c5d00d8dd399ee6b5bb7bca8
- Parents:
- 1bbd47fd39d8d0bee713b13b974dba118d689cd3
- Location:
- libpolys/polys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/shiftop.cc
r1bbd47 r6b15a76 735 735 } 736 736 737 /// substitute weights from orderings a,wp,Wp 738 /// by d copies of it at position p 739 static BOOLEAN freeAlgebra_weights(const ring old_ring, ring new_ring, int p, int d) 740 { 741 omFree(new_ring->wvhdl[p]); 742 int *w=(int*)omAlloc(new_ring->N*sizeof(int)); 743 for(int b=0;b<d;b++) 744 { 745 for(int i=old_ring->N-1;i>=0;i--) 746 { 747 if (old_ring->wvhdl[p][i]<-0) return TRUE; 748 w[b*old_ring->N+i]=old_ring->wvhdl[p][i]; 749 } 750 } 751 new_ring->wvhdl[p]=w; 752 new_ring->block1[p]=new_ring->N; 753 return FALSE; 754 } 755 737 756 ring freeAlgebra(ring r, int d) 738 757 { … … 747 766 R->N=r->N*d; 748 767 R->isLPring=r->N; 768 // create R->order 769 BOOLEAN has_order_a=FALSE; 770 while (r->order[p]==ringorder_a) 771 { 772 if (freeAlgebra_weights(r,R,p,d)) 773 { 774 WerrorS("weights must be positive"); 775 return NULL; 776 } 777 has_order_a=TRUE; 778 p++; 779 } 749 780 R->block1[p]=R->N; /* only dp,Dp,wp,Wp; will be discarded for lp*/ 750 // create R->order751 781 switch(r->order[p]) 752 782 { … … 756 786 case ringorder_wp: 757 787 case ringorder_Wp: 758 { 759 omFree(R->wvhdl[p]); 760 int *w=(int*)omAlloc(R->N*sizeof(int)); 761 for(int b=1;b<d;b++) 788 if (freeAlgebra_weights(r,R,p,d)) 762 789 { 763 for(int i=r->N-1;i>=0;i--)764 w[b*r->N+i]=r->wvhdl[p][i];790 WerrorS("weights must be positive"); 791 return NULL; 765 792 } 766 R->wvhdl[p]=w;767 793 break; 768 }769 794 case ringorder_lp: 770 795 case ringorder_rp: 771 796 { 797 if(has_order_a) 798 { 799 WerrorS("ordering (a(..),lp/rp not implemented for LP-rings"); 800 return NULL; 801 } 772 802 int ** wvhdl=(int**)omAlloc0((r->N+2)*sizeof(int*)); 773 803 rRingOrder_t* ord=(rRingOrder_t*)omAlloc0((r->N+2)*sizeof(rRingOrder_t)); … … 798 828 // copy component order 799 829 if (p==1) ord[0]=r->order[0]; 800 else /*p==0*/ ord[r->N+1]=r->order[1]; 830 else if (p==0) ord[r->N+1]=r->order[1]; 831 else 832 { // should never happen: 833 WerrorS("ordering not implemented for LP-rings"); 834 return NULL; 835 } 801 836 break; 802 837 } -
libpolys/polys/shiftop.h
r1bbd47 r6b15a76 54 54 poly p_LPVarAt(poly p, int pos, const ring r); 55 55 56 /// create the letterplace ring corresponding to r up to degree d 56 57 ring freeAlgebra(ring r, int d); 57 58 #endif
Note: See TracChangeset
for help on using the changeset viewer.