Skip to content
fn

sgemv

void sgemv(bool transA, int M, int N, float alpha, const float * A, int lda, const float * x, int incx, float beta, float * y, int incy)

Single-precision general matrix-vector multiply (GEMV).

Computes y←α(Ax)+βyy \leftarrow \alpha (A x) + \beta y in row-major layout via Accelerate's cblas_sgemv. Significantly cheaper than sgemm for vector right-hand sides because the inner loop stays in cache.

Math

yi←α∑j=0N−1Aijxj+βyiy_i \leftarrow \alpha \sum_{j=0}^{N-1} A_{ij} x_j + \beta y_i

References

Accelerate.framework cblas_sgemv.

Parameters

transAbool
If true, compute y←αATx+βyy \leftarrow \alpha A^T x + \beta y instead.
M, Nint
A∈RM×NA \in \mathbb{R}^{M \times N}. When transA is false, xx has NN elements and yy has MM; reversed when transA is true.
alpha, betafloat
Linear-combination coefficients.
Aconst float*
Row-major matrix buffer.
xconst float*
Input vector buffer (stride incx).
yfloat*
Output vector buffer (stride incy); updated in place.
ldaint
Leading dimension (row stride) of AA.
incx, incyint
Element stride within the input/output vectors.