Changeset b45ae02 in git
- Timestamp:
- Oct 12, 2018, 3:07:52 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- c5079ecb99f453ef9b68c8f71391a4d24e9f9122ccc4a179b32a4db6b33e8a45864fd61e8e78aaad
- Parents:
- a6ea1d3a85e5c6294a5867c84399d54d8f5651ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/shiftop.cc
ra6ea1d rb45ae02 12 12 * -> wait until the new interface is released 13 13 */ 14 #define SHIFT_MULT_COMPAT_MODE 14 #define SHIFT_MULT_COMPAT_MODE 15 15 16 16 #ifdef SHIFT_MULT_DEBUG … … 55 55 p_GetExpV(_m,mExpV,ri); 56 56 int mLength = p_mLastVblock(_m, mExpV, ri) * lV; 57 int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int)); 57 58 do 58 59 { 60 memset(pExpV,0,(ri->N+1)*sizeof(int)); 59 61 p_AllocBin(pNext(q), bin, ri); 60 62 pIter(q); 61 63 pSetCoeff0(q, n_Mult(mCoeff, pGetCoeff(p), ri->cf)); 62 64 63 int *pExpV = (int *) omAlloc0((ri->N+1)*sizeof(int));64 65 p_GetExpV(p, pExpV, ri); 65 66 p_LPExpVappend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri); 66 67 p_MemCopy_LengthGeneral(q->exp, p->exp, ri->ExpL_Size); // otherwise q is not initialized correctly 67 68 p_SetExpV(q, pExpV, ri); 68 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));69 69 70 70 pIter(p); 71 71 } 72 72 while (p != NULL); 73 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int)); 73 74 omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int)); 74 75 pNext(q) = NULL; … … 116 117 p_GetExpV(_m,mExpV,ri); 117 118 int mLength = p_mLastVblock(_m, mExpV, ri) * lV; 119 int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int)); 118 120 while (p != NULL) 119 121 { 122 memset(pExpV,0,(ri->N+1)*sizeof(int)); 120 123 pCoeff = pGetCoeff(p); 121 124 pSetCoeff0(p, n_Mult(mCoeff, pCoeff, ri->cf)); 122 125 n_Delete(&pCoeff, ri->cf); // delete the old coeff 123 126 124 int *pExpV = (int *) omAlloc0((ri->N+1)*sizeof(int));125 127 p_GetExpV(p,pExpV,ri); 126 128 p_LPExpVappend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri); 127 129 p_SetExpV(p, pExpV, ri); 128 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));129 130 130 131 pIter(p); 131 132 } 133 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int)); 132 134 omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int)); 133 135 #ifdef SHIFT_MULT_COMPAT_MODE … … 178 180 p_GetExpV(_m,mExpV,ri); 179 181 int mLength = p_mLastVblock(_m, mExpV, ri) * lV; 182 int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int)); 180 183 do 181 184 { 185 memset(pExpV,0,(ri->N+1)*sizeof(int)); 182 186 p_AllocBin(pNext(q), bin, ri); 183 187 pIter(q); 184 188 pSetCoeff0(q, n_Mult(mCoeff, pGetCoeff(p), ri->cf)); 185 189 186 int *pExpV = (int *) omAlloc0((ri->N+1)*sizeof(int));187 190 p_GetExpV(p, pExpV, ri); 188 191 p_LPExpVprepend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri); 189 192 p_MemCopy_LengthGeneral(q->exp, p->exp, ri->ExpL_Size); // otherwise q is not initialized correctly 190 193 p_SetExpV(q, pExpV, ri); 191 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));192 194 193 195 pIter(p); 194 196 } 195 197 while (p != NULL); 198 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int)); 196 199 omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int)); 197 200 pNext(q) = NULL; … … 239 242 p_GetExpV(_m,mExpV,ri); 240 243 int mLength = p_mLastVblock(_m, mExpV, ri) * lV; 244 int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int)); 241 245 while (p != NULL) 242 246 { 247 memset(pExpV,0,(ri->N+1)*sizeof(int)); 243 248 pCoeff = pGetCoeff(p); 244 249 pSetCoeff0(p, n_Mult(mCoeff, pCoeff, ri->cf)); 245 250 n_Delete(&pCoeff, ri->cf); // delete the old coeff 246 251 247 int *pExpV = (int *) omAlloc0((ri->N+1)*sizeof(int));248 252 p_GetExpV(p,pExpV,ri); 249 253 p_LPExpVprepend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri); 250 254 p_SetExpV(p, pExpV, ri); 251 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));252 255 253 256 pIter(p); 254 257 } 258 omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int)); 255 259 omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int)); 256 260 #ifdef SHIFT_MULT_COMPAT_MODE … … 286 290 287 291 int pLen = 0; 288 if (ll >= 0) { 292 if (ll >= 0) 293 { 289 294 pLen = pLength(p); 290 295 } … … 292 297 p = shift_pp_Mult_mm(p, m, ri); 293 298 294 if (ll >= 0) { 299 if (ll >= 0) 300 { 295 301 ll = pLen - pLength(p); 296 } else { 302 } 303 else 304 { 297 305 ll = pLength(p); 298 306 } … … 516 524 517 525 // prepends m2ExpV to m1ExpV, also adds their components (one of them is always zero) 518 void p_LPExpVprepend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri) { 526 void p_LPExpVprepend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri) 527 { 519 528 #ifdef SHIFT_MULT_DEBUG 520 529 PrintLn(); PrintS("Prepend"); … … 544 553 } 545 554 546 void WriteLPExpV(int *expV, ring ri) { 547 for (int i = 0; i <= ri->N; ++i) { 555 void WriteLPExpV(int *expV, ring ri) 556 { 557 for (int i = 0; i <= ri->N; ++i) 558 { 548 559 Print("%d", expV[i]); 549 if (i == 0) { 560 if (i == 0) 561 { 550 562 Print("| "); 551 563 } 552 if (i % ri->isLPring == 0) { 564 if (i % ri->isLPring == 0) 565 { 553 566 Print(" "); 554 567 }
Note: See TracChangeset
for help on using the changeset viewer.