SAXPY
From Wikipedia, the free encyclopedia
SAXPY (Scalar Alpha X Plus Y) is one of the functions in the Basic Linear Algebra Subprograms (BLAS) package, and is a common operation in computations with vector processors . SAXPY is a combination of scalar multiplication and vector addition,
- ,
where α is a scalar, and and are vectors. As with most functions, there exist four variants of SAXPY in the BLAS package, namely SAXPY, DAXPY, CAXPY and ZAXPY. These variants differ only in the datatype of scalar α.
Contents |
[edit] Different Datatypes
[edit] SAXPY
SAXPY is not only the generic term for the combined scalar multiplication plus vector addition operation, but also the specific variant where the scalar α and the vectors and are of single precision.
[edit] DAXPY
DAXPY denotes SAXPY with double precision α, and .
[edit] CAXPY
CAXPY denotes SAXPY with complex α, and .
[edit] ZAXPY
ZAXPY denotes SAXPY with double precision complex α, and .
[edit] Generic Implementation
The most generic implementation of SAXPY looks like the following:
for (int i = m; i < n; i++) { y[i] = a * x[i] + y[i]; }