Skip to content
fn

saxpy

void saxpy(int n, float alpha, const float * x, float * y)

Single-precision scaled vector accumulation, y←αx+yy \leftarrow \alpha x + y.

The BLAS name for "add a scaled copy of one vector to another", and the building block of any linear combination of same-shaped buffers. Preferred over a multiply into a temporary followed by an add: it needs no temporary, touches yy once per term instead of three times, and Accelerate's kernel contracts the multiply and the add into a single rounding.

Math

yi←αxi+yiy_i \leftarrow \alpha x_i + y_i

References

Accelerate.framework cblas_saxpy.

Parameters

nint
Element count.
alphafloat
Scale applied to xx.
xconst float*
Vector to accumulate; unchanged.
yfloat*
Accumulator, updated in place.