Changeset fc5095 in git for kernel/p_polys.cc
- Timestamp:
- May 4, 2005, 4:13:17 PM (19 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
- Children:
- e94c760bc99c31edb114fb23f26bd5b946df947f
- Parents:
- d96679d03c58aeb42f44e71cab5910f752889f41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/p_polys.cc
rd96679d rfc5095 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_polys.cc,v 1. 2 2005-04-20 17:25:51Singular Exp $9 * Version: $Id: p_polys.cc,v 1.3 2005-05-04 14:08:55 Singular Exp $ 10 10 *******************************************************************/ 11 11 12 12 #include "mod2.h" 13 #include "structs.h" 13 14 #include "structs.h" 14 15 #include "p_polys.h" 15 16 #include "ring.h" 17 #include "int64vec.h" 18 #ifndef NDEBUG 16 19 #include "febase.h" 20 #endif 17 21 18 22 /*************************************************************** … … 25 29 static long* _ShiftedComponents = NULL; 26 30 static int _ExternalComponents = 0; 31 32 BOOLEAN pSetm_error=0; 27 33 28 34 void p_Setm_General(poly p, ring r) … … 56 62 e=o->data.wp.end; 57 63 int *w=o->data.wp.weights; 64 #if 1 58 65 for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r)*w[i-a]; 66 #else 67 long ai; 68 int ei,wi; 69 for(int i=a;i<=e;i++) 70 { 71 ei=p_GetExp(p,i,r); 72 wi=w[i-a]; 73 ai=ei*wi; 74 if (ai/ei!=wi) pSetm_error=TRUE; 75 ord+=ai; 76 if (ord<ai) pSetm_error=TRUE; 77 } 78 #endif 59 79 p->exp[o->data.wp.place]=ord; 80 break; 81 } 82 case ro_wp64: 83 { 84 int64 ord=0; 85 int a,e; 86 a=o->data.wp64.start; 87 e=o->data.wp64.end; 88 int64 *w=o->data.wp64.weights64; 89 int64 ei,wi,ai; 90 for(int i=a;i<=e;i++) { 91 //Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]); 92 //ord+=((int64)p_GetExp(p,i,r))*w[i-a]; 93 ei=(int64)p_GetExp(p,i,r); 94 wi=w[i-a]; 95 ai=ei*wi; 96 if(ei!=0 && ai/ei!=wi){ 97 pSetm_error=TRUE; 98 Print("ai %lld, wi %lld\n",ai,wi); 99 } 100 ord+=ai; 101 if (ord<ai){ 102 pSetm_error=TRUE; 103 Print("ai %lld, ord %lld\n",ai,ord); 104 } 105 } 106 int64 mask=(int64)0x7fffffff; 107 long a_0=(long)(ord&mask); //2^31 108 long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/ 109 110 //Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n" 111 //,(int)mask,(int)ord,(int)a_0,(int)a_1); 112 //Print("mask: %d",mask); 113 114 p->exp[o->data.wp64.place]=a_1; 115 p->exp[o->data.wp64.place+1]=a_0; 116 // if(p_Setm_error) Print("***************************\n 117 // ***************************\n 118 // **WARNING: overflow error**\n 119 // ***************************\n 120 // ***************************\n"); 60 121 break; 61 122 } … … 73 134 int c=p_GetComp(p,r); 74 135 long sc = c; 75 int* Components = (_ExternalComponents ? _Components : 136 int* Components = (_ExternalComponents ? _Components : 76 137 o->data.syzcomp.Components); 77 long* ShiftedComponents = (_ExternalComponents ? _ShiftedComponents: 138 long* ShiftedComponents = (_ExternalComponents ? _ShiftedComponents: 78 139 o->data.syzcomp.ShiftedComponents); 79 140 if (ShiftedComponents != NULL) … … 142 203 p_SetmProc p_GetSetmProc(ring r) 143 204 { 144 // covers lp, rp, ls, 205 // covers lp, rp, ls, 145 206 if (r->typ == NULL) return p_Setm_Dummy; 146 207 147 208 if (r->OrdSize == 1) 148 209 { 149 if (r->typ[0].ord_typ == ro_dp && 210 if (r->typ[0].ord_typ == ro_dp && 150 211 r->typ[0].data.dp.start == 1 && 151 212 r->typ[0].data.dp.end == r->N && 152 213 r->typ[0].data.dp.place == r->pOrdIndex) 153 214 return p_Setm_TotalDegree; 154 if (r->typ[0].ord_typ == ro_wp && 215 if (r->typ[0].ord_typ == ro_wp && 155 216 r->typ[0].data.wp.start == 1 && 156 217 r->typ[0].data.wp.end == r->N && … … 169 230 * the ordering is compatible with degree, use a->order 170 231 */ 171 inline long _pDeg(poly a, constring r)232 inline long _pDeg(poly a, ring r) 172 233 { 173 234 p_LmCheckPolyRing(a, r); … … 176 237 } 177 238 178 long pDeg(poly a, constring r)239 long pDeg(poly a, ring r) 179 240 { 180 241 return _pDeg(a, r); … … 197 258 } 198 259 199 // pWTotalDegree for weighted orderings 260 // pWTotalDegree for weighted orderings 200 261 // whose first block covers all variables 201 262 inline long _pWFirstTotalDegree(poly p, ring r) … … 203 264 int i; 204 265 long sum = 0; 205 266 206 267 for (i=1; i<= r->firstBlockEnds; i++) 207 268 { … … 254 315 } 255 316 break; 317 case ringorder_a64: 318 { 319 int64* w=(int64*)r->wvhdl[i]; 320 for (k=0;k<=(r->block1[i] - r->block0[i]);k++) 321 { 322 //there should be added a line which checks if w[k]>2^31 323 j+= p_GetExp(p,k+1, r)*(long)w[k]; 324 } 325 //break; 326 return j; 327 } 256 328 case ringorder_c: 257 329 case ringorder_C: … … 265 337 j+= p_GetExp(p,k, r)*r->wvhdl[i][ k- r->block0[i]]; 266 338 } 339 //break; 267 340 return j; 341 268 342 #ifndef NDEBUG 269 343 default: … … 353 427 if (! rIsSyzIndexRing(r)) 354 428 { 355 while (pNext(p) != NULL) 429 while (pNext(p) != NULL) 356 430 { 357 431 pIter(p); … … 681 755 ***************************************************************/ 682 756 683 static inline unsigned long 684 p_GetMaxExpL2(unsigned long l1, unsigned long l2, ring r, 757 static inline unsigned long 758 p_GetMaxExpL2(unsigned long l1, unsigned long l2, ring r, 685 759 unsigned long number_of_exp) 686 760 { … … 723 797 unsigned long l_p, l_max; 724 798 unsigned long divmask = r->divmask; 725 799 726 800 do 727 801 { … … 730 804 l_max = max->exp[offset]; 731 805 // do the divisibility trick to find out whether l has an exponent 732 if (l_p > l_max || 806 if (l_p > l_max || 733 807 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask))) 734 808 max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r); … … 740 814 l_max = max->exp[offset]; 741 815 // do the divisibility trick to find out whether l has an exponent 742 if (l_p > l_max || 816 if (l_p > l_max || 743 817 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask))) 744 818 max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r); … … 754 828 unsigned long l_p, divmask = r->divmask; 755 829 int i; 756 830 757 831 while (p != NULL) 758 832 { … … 765 839 l_p = p->exp[r->VarL_Offset[i]]; 766 840 // do the divisibility trick to find out whether l has an exponent 767 if (l_p > l_max || 841 if (l_p > l_max || 768 842 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask))) 769 843 l_max = p_GetMaxExpL2(l_max, l_p, r); … … 774 848 } 775 849 850 851 852 776 853 /*************************************************************** 777 854 * … … 847 924 } 848 925 849 /***************************************************************850 *851 * p_ShallowDelete852 *853 ***************************************************************/854 #undef LINKAGE855 #define LINKAGE856 #undef p_Delete857 #define p_Delete p_ShallowDelete858 #undef n_Delete859 #define n_Delete(n, r) ((void)0)860 861 #include "p_Delete__T.cc"862
Note: See TracChangeset
for help on using the changeset viewer.