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

◆ findPreviousReducerPrefix()

std::pair< bool, int > NCF4::findPreviousReducerPrefix ( const Word & w)
private

Definition at line 769 of file NCF4.cpp.

770{
771 // build the largest proper prefix of m and look it up in previous
772 // mColumnMonomials table. we will return (true, row index) if
773 // found and (false, -1) if not.
774
775 // note that just because the second coordinate of an
776 // mColumnMonomials entry is -1 does not mean there isn't a reducer
777 // in the row -- in this case it is a new GB element and already
778 // added to the mGroebner list. In this case, we will be using that
779 // entry anyway so no need to make the additional effort to find it
780 // in the mRows table.
781
782 // get prefix of m as a monom
783 // search for prefix in mPreviousColumnMonomials
784 // if it.second.second != -1, then return (true,it.second.first)
785 // else return (false, -1)
786
787 // if the monom is the empty monomial, return false
788 if (w.size() == 0) return std::make_pair(false,-1);
789
790 std::pair<bool,int> retval;
791
792 Word prefix(w.begin(),w.end()-1);
793 const auto it = mPreviousColumnMonomials.find(prefix);
794 if (it == mPreviousColumnMonomials.end()) // not in table
795 retval = std::make_pair(false,-1);
796 else
797 {
798 int colNum = (*it).second.first;
799 if (mPreviousColumns[colNum].pivotRow == -1) // in column table and not a reducer monomial
800 retval = std::make_pair(false,-1);
801 else // in table and a reducer monomial
802 retval = std::make_pair(true,mPreviousColumns[colNum].pivotRow);
803 }
804 return retval;
805}
Word prefix(const Word vec, int lengthOfPrefix)
ColumnsVector mPreviousColumns
Definition NCF4.hpp:241
MonomialHash mPreviousColumnMonomials
Definition NCF4.hpp:236
const int * begin() const
Definition Word.hpp:72
const int * end() const
Definition Word.hpp:73
int size() const
Definition Word.hpp:74

References Word::begin(), Word::end(), mPreviousColumnMonomials, mPreviousColumns, prefix(), and Word::size().

Referenced by findDivisor().