| 360 | } |
| 361 | |
| 362 | void p_mLPshift(poly m, int sh, const ring ri) |
| 363 | { |
| 364 | if (sh == 0 || m == NULL || p_LmIsConstantComp(m,ri)) return; |
| 365 | |
| 366 | int lV = ri->isLPring; |
| 367 | |
| 368 | assume(p_mFirstVblock(m,ri) + sh >= 1); |
| 369 | assume(p_mLastVblock(m,ri) + sh <= ri->N/lV); |
| 370 | |
| 371 | int *e=(int *)omAlloc((ri->N+1)*sizeof(int)); |
| 372 | int *s=(int *)omAlloc0((ri->N+1)*sizeof(int)); |
| 373 | p_GetExpV(m,e,ri); |
| 374 | |
| 375 | if (p_mLastVblock(m, e, ri) + sh > ri->N/lV) |
| 376 | { |
| 377 | Werror("degree bound of Letterplace ring is %d, but at least %d is needed for this shift", ri->N/lV, p_mLastVblock(m, e, ri) + sh); |
| 378 | } |
| 379 | for (int i = ri->N - sh*lV; i > 0; i--) |
| 380 | { |
| 381 | assume(e[i]<=1); |
| 382 | if (e[i]==1) |
| 383 | { |
| 384 | s[i + (sh*lV)] = e[i]; /* actually 1 */ |
| 385 | } |
| 386 | } |
| 387 | p_SetExpV(m,s,ri); |
| 388 | omFreeSize((ADDRESS) e, (ri->N+1)*sizeof(int)); |
| 389 | omFreeSize((ADDRESS) s, (ri->N+1)*sizeof(int)); |
| 390 | } |
| 391 | |
| 392 | void p_LPshift(poly p, int sh, const ring ri) |
| 393 | { |
no test coverage detected