Macaulay2 Engine
Loading...
Searching...
No Matches

◆ quotient_as_vp()

void ResMonoidSparse::quotient_as_vp ( res_const_packed_monomial m,
res_const_packed_monomial n,
res_varpower_monomial result ) const
inline

Definition at line 519 of file res-moninfo-sparse.hpp.

525 {
527
528 const int* vm = m + mFirstVar;
529 const int* vn = n + mFirstVar;
530 const int* vend = n + *n;
531 int* vresult = result + mFirstVar;
532 for (; vn != vend; ++vn)
533 {
534 if (*vn > *vm) continue;
535 if (*vn == *vm) ++vm;
536 *vresult++ = *vm++;
537 }
538 // now make these into a varpower monomial.
539 int len = 0;
540 res_varpower_word* r = result + 1;
541
542 int currentvar = result[mFirstVar];
543 int deg = 1;
544 for (auto p = result + mFirstVar + 1; p != vresult; ++p)
545 {
546 if (*p == currentvar)
547 deg++;
548 else
549 {
550 *r++ = currentvar;
551 *r++ = deg;
552 len++;
553 currentvar = *p;
554 deg = 1;
555 }
556 }
557 result[0] = len;
558 }
unsigned long ncalls_quotient_as_vp
int p
VALGRIND_MAKE_MEM_DEFINED & result(result)
res_varpower_monomials::Exponent res_varpower_word

References mFirstVar, ncalls_quotient_as_vp, p, and result().