prepends m2ExpV to m1ExpV, also adds their components (one of them is always zero)
| 536 | |
| 537 | // prepends m2ExpV to m1ExpV, also adds their components (one of them is always zero) |
| 538 | void p_LPExpVprepend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri) |
| 539 | { |
| 540 | #ifdef SHIFT_MULT_DEBUG |
| 541 | PrintLn(); PrintS("Prepend"); |
| 542 | PrintLn(); WriteLPExpV(m1ExpV, ri); |
| 543 | PrintLn(); WriteLPExpV(m2ExpV, ri); |
| 544 | #endif |
| 545 | int last = m1Length + m2Length; |
| 546 | if (last > ri->N) |
| 547 | { |
| 548 | Werror("degree bound of Letterplace ring is %d, but at least %d is needed for this multiplication", ri->N/ri->isLPring, last/ri->isLPring); |
| 549 | last = ri->N; |
| 550 | } |
| 551 | |
| 552 | // shift m1 by m2Length |
| 553 | for (int i = last; i >= 1 + m2Length; --i) |
| 554 | { |
| 555 | m1ExpV[i] = m1ExpV[i - m2Length]; |
| 556 | } |
| 557 | |
| 558 | // write m2 to m1 |
| 559 | for (int i = 1; i < 1 + m2Length; ++i) |
| 560 | { |
| 561 | assume(m2ExpV[i] <= 1); |
| 562 | m1ExpV[i] = m2ExpV[i]; |
| 563 | } |
| 564 | |
| 565 | assume(m1ExpV[0] == 0 || m2ExpV[0] == 0); // one component should be zero (otherwise this doesn't make any sense) |
| 566 | m1ExpV[0] += m2ExpV[0]; // as in the commutative variant (they use MemAdd) |
| 567 | #ifdef SHIFT_MULT_DEBUG |
| 568 | PrintLn(); WriteLPExpV(m1ExpV, ri); |
| 569 | #endif |
| 570 | assume(_p_mLPNCGenValid(m1ExpV, ri)); |
| 571 | } |
| 572 | |
| 573 | void WriteLPExpV(int *expV, ring ri) |
| 574 | { |
no test coverage detected