966 B
966 B
[linalg.scaled.intro]
29 Numerics library [numerics]
29.9 Basic linear algebra algorithms [linalg]
29.9.8 Scaled in-place transformation [linalg.scaled]
29.9.8.1 Introduction [linalg.scaled.intro]
The scaled function takes a value alpha and an mdspan x, and returns a new read-only mdspan that represents the elementwise product of alpha with each element of x.
[Example 1: using Vec = mdspan<double, dextents<size_t, 1>>;
// z = alpha * x + yvoid z_equals_alpha_times_x_plus_y(double alpha, Vec x, Vec y, Vec z) { add(scaled(alpha, x), y, z);}// z = alpha * x + beta * yvoid z_equals_alpha_times_x_plus_beta_times_y(double alpha, Vec x, double beta, Vec y, Vec z) { add(scaled(alpha, x), scaled(beta, y), z);} â end example]