- SAXPY
-
SAXPY (Single-precision real Alpha X Plus Y[1]) 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 α. Description of these routines can be found in showed external links.
Contents
Different datatypes
SAXPY
SAXPY [2] 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.
DAXPY
DAXPY denotes SAXPY with double precision α, and .
CAXPY
CAXPY denotes SAXPY with complex α, and .
ZAXPY
ZAXPY denotes SAXPY with double precision complex α, and .
Generic implementation
The most generic C implementation of SAXPY looks like the following:
void saxpy(float* x, float* y, int n, float a) { int i; for (i = 0; i < n; ++i) y[i] += a * x[i]; }
References
- ^ http://www.gnu.org/software/gsl/manual/html_node/BLAS-Support.html
- ^ G. H. Golub, C. F. Loan, Matrix Computations, 3rd edition, Johns Hopkins, 1996. ISBN 0801854148.
External links
Numerical linear algebra Key concepts Problems Hardware Software Categories:- Numerical software
- Numerical linear algebra
Wikimedia Foundation. 2010.