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

◆ reduce() [3/3]

void GaussElimComputation::reduce ( vec & f,
vec & fsyz,
bool tail_only = false )
private

Definition at line 179 of file gauss.cpp.

180{
181 if (f == nullptr) return;
182 vecterm head;
183 vecterm *result = &head;
184
185 if (tail_only)
186 {
187 // Don't reduce the head term.
188 result->next = f;
189 f = f->next;
190 result = result->next;
191 }
192 while (f != nullptr)
193 {
194 int r = f->comp;
195 if (gb_list[r] != nullptr)
196 {
197 // Reduce w.r.t. this term
198 ring_elem c = f->coeff;
199 c = R->negate(c);
200 vec gsyz = R->mult_vec(c, gb_list[r]->fsyz);
201 vec g = R->mult_vec(c, gb_list[r]->f);
202 R->add_vec_to(f, g);
203 R->add_vec_to(fsyz, gsyz);
204 }
205 else
206 {
207 result->next = f;
208 f = f->next;
209 result = result->next;
210 }
211 }
212
213 result->next = nullptr;
214 f = head.next;
215}
gm_elem ** gb_list
Definition gauss.hpp:63
const Ring * R
Definition gauss.hpp:66
VALGRIND_MAKE_MEM_DEFINED & result(result)

References gb_list, vec::next, R, and result().