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

◆ vec_scale()

template<typename CoeffRing>
void SMat< CoeffRing >::vec_scale ( sparsevec *& v,
const elem & a ) const
private

Definition at line 461 of file smat.hpp.

462{
463 if (ring().is_zero(a))
464 {
465 vec_remove(v);
466 v = 0;
467 return;
468 }
470 head.next = v;
471 for (sparsevec *p = &head; p->next != 0; p = p->next)
472 {
473 ring().mult(p->next->coeff, a, p->next->coeff);
474 if (ring().is_zero(p->next->coeff))
475 {
476 sparsevec *tmp = p->next;
477 p->next = tmp->next;
479 if (p->next == 0) break;
480 }
481 }
482 v = head.next;
483}
const CoeffRing & ring() const
Definition smat.hpp:104
void vec_remove(sparsevec *&v) const
Definition smat.hpp:294
bool is_zero() const
Definition smat.hpp:1107
void vec_remove_node(sparsevec *&v) const
Definition smat.hpp:287
Definition smat.hpp:43

References is_zero(), SMat< ACoeffRing >::sparsevec::next, p, ring(), vec_remove(), and vec_remove_node().

Referenced by column2by2(), scalarMultInPlace(), scale_column(), and vec_column_op().