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

◆ divide_vec_to()

void Ring::divide_vec_to ( vec & v,
const ring_elem a ) const

Definition at line 484 of file ring-vecs.cpp.

485{
486 if (this->is_zero(a))
487 {
488 remove_vec(v);
489 v = nullptr;
490 }
491 vecterm head;
492 head.next = v;
493 vec p = &head;
494 while (p->next != nullptr)
495 {
496 // old version: this->mult_to(p->next->coeff, a);
497 ring_elem c =
498 this->divide(p->next->coeff, a); // exact or quotient?? MES MES
499 p->next->coeff = c;
500 if (this->is_zero(p->next->coeff))
501 {
502 vec tmp = p->next;
503 p->next = tmp->next;
504 remove_vec_node(tmp);
505 }
506 else
507 p = p->next;
508 }
509 v = head.next;
510}
virtual ring_elem divide(const ring_elem f, const ring_elem g) const =0
void remove_vec_node(vec n) const
Definition ring-vecs.cpp:55
void remove_vec(vec v) const
virtual bool is_zero(const ring_elem f) const =0
int p

References divide(), is_zero(), vec::next, p, remove_vec(), and remove_vec_node().