Skip to content

num::scaled

Defined in header <container/matrix_expr.hpp>, <linear/sparse/sparse.hpp>

mat<real> scaled(const mat<real> &A, real alpha);  // (1)

vec<real> scaled(const vec<real> &x, real alpha);  // (2)

template <class M>
requires repr::csr<M>
spmat scaled(const M &A, real alpha);  // (3)

(1) Return alpha*A, matching the value-returning scaled for sparse matrices.

Allocates; prefer in-place scaling in hot loops.

(2) Return alpha*x for vectors.

(3) Undocumented.