num::matvec¶
Defined in header <container/matrix_expr.hpp>, <container/matrix_ops.hpp>
template <class M>
requires repr::dense_row_major<M>
void matvec(const M &A, const vec<real> &x, vec<real> &y); // (1)
vec<real> matvec(const mat<real> &A, const vec<real> &x); // (2)
(1) \(y \leftarrow Ax\) for any row-major dense matrix.
Constrained on num::repr::dense_row_major, so a foreign matrix with data(), rows() and cols() works. num::mat<real> takes the configured backend, anything else the kernel. The CSR overload in linear/sparse/sparse.hpp is selected by the disjoint num::repr::csr.
(2) Return A*x.
Allocates; prefer the out-param form in hot loops.