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

◆ mult_vec_matrix()

vec Ring::mult_vec_matrix ( const Matrix * m,
vec v,
bool opposite_mult ) const

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

467{
468 // Multiply m * v, using left or right mult for each scalar mult.
469
470 // Each loop below should read
471 // result = 0
472 // for each non-zero term f e[component] of the vector v
473 // result += f M[v]
474 vec result = nullptr;
475 for (; v != nullptr; v = v->next)
476 {
477 vec w = this->copy_vec(m->elem(v->comp));
478 mult_vec_to(w, v->coeff, !opposite_mult);
479 this->add_vec_to(result, w);
480 }
481 return result;
482}
ring_elem elem(int i, int j) const
Definition matrix.cpp:307
void mult_vec_to(vec &v, const ring_elem r, bool opposite_mult) const
void add_vec_to(vec &v, vec &w) const
vec copy_vec(const vecterm *v) const
Definition ring-vecs.cpp:91
VALGRIND_MAKE_MEM_DEFINED & result(result)

References add_vec_to(), copy_vec(), Matrix::elem(), Matrix, mult_vec_to(), and result().

Referenced by Matrix::mult().