// processMonomialProduct // m is a monomial, component is ignored (it determined the possible n's // being used here) // n is a monomial at level 'mThisLevel-1' // compute their product, and return the column index of this product // or -1, if the monomial is not needed. // additionally: the product monomial is inserted into the hash table // and column array (if it is not already there). // caveats: this function is only to be used during construction // of the coeff matrices. It uses mThisLevel. // // If the ring has skew commuting variables, then result_sign_if_skew is set to // 0, 1, or -1. ComponentIndex F4Res::processMonomialProduct(res_const_packed_monomial m, res_const_packed_monomial n, int& result_sign_if_skew) { result_sign_if_skew = 1; auto x = monoid().get_component(n); auto& p = mFrame.level(mThisLevel - 2)[x]; if (p.mBegin == p.mEnd) return -1; int* thisMonom = mMonomSpace2.allocate(1 + monoid().max_monomial_size()); thisMonom++; // so thisMonom[-1] exists, but is not part of the monomial, as far as monoid().unchecked_mult(m, n, thisMonom); monoid().set_component(x, thisMonom); if (ring().isSkewCommutative()) { result_sign_if_skew = monoid().skew_mult_sign(ring().skewInfo(), m, n); if (result_sign_if_skew == 0) { mMonomSpace2.popLastAlloc(thisMonom-1); // we did not need this monomial! return -1; } } return processCurrentMonomial(thisMonom); }
// processMonomialProduct // m is a monomial, component is ignored (it determined the possible n's being used here) // n is a monomial at level 'mThisLevel-1' // compute their product, and return the column index of this product // or -1, if the monomial is not needed. // additionally: the product monomial is inserted into the hash table // and column array (if it is not already there). // caveats: this function is only to be used during construction // of the coeff matrices. It uses mThisLevel. // // If the ring has skew commuting variables, then result_sign_if_skew is set to 0, 1, or -1. ComponentIndex F4Res::processMonomialProduct(packed_monomial m, packed_monomial n, int& result_sign_if_skew) { result_sign_if_skew = 1; auto x = monoid().get_component(n); auto& p = mFrame.level(mThisLevel-2)[x]; if (p.mBegin == p.mEnd) return -1; monoid().unchecked_mult(m,n,mNextMonom); // the component is wrong, after this operation, as it adds components // So fix that: monoid().set_component(x, mNextMonom); if (ring().isSkewCommutative()) { result_sign_if_skew = monoid().skew_mult_sign(ring().skewInfo(), m, n); if (result_sign_if_skew == 0) return -1; } return processCurrentMonomial(); }