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

◆ reduceTail()

bool BRP::reduceTail ( const BRP & g)

Definition at line 159 of file franzi-brp.cpp.

160{
161 // cout << "reduceTail: this = " << (*this) << ", by g = " << g << endl;
162 // if ( (*this) == 0 ) {
163 // cerr << "Called reduceTail on 0 brp" << endl;
164 // return false;
165 // }
166 brMonomial lt = g.LT();
167 bool ret = false;
168 monomials::iterator it = m.begin();
169 ++it; // really only reduce tail
170 monomials::iterator end = m.end();
171 for (; it != end;)
172 {
173 brMonomial mono = *it;
174 if (isDivisibleBy(mono, lt))
175 {
176 // cout << mono << " is divisible by " << lt << endl;
177 addition(g * (mono ^ lt), it--);
178 // cout << *this << endl;
179 ++it;
180 ret = true;
181 }
182 if (lt > mono)
183 { // stop iterating because smaller are never divisible by larger
184 return ret;
185 }
186 ++it;
187 }
188 // cout << "at the end of reduceTail, this = " << (*this) << endl;
189 return ret;
190}
static bool isDivisibleBy(const brMonomial &a, const brMonomial &b)
void addition(const BRP &other, monomials::iterator pos)
brMonomial LT() const
monomials m
unsigned long brMonomial
TermIterator< Nterm > end(Nterm *)
Definition ringelem.cpp:5

References addition(), BRP(), end(), isDivisibleBy(), LT(), and m.

Referenced by reduceTail().