SAXPY
Encyclopedia
SAXPY is one of the functions in the Basic Linear Algebra Subprograms (BLAS)
Basic Linear Algebra Subprograms
Basic Linear Algebra Subprograms is a de facto application programming interface standard for publishing libraries to perform basic linear algebra operations such as vector and matrix multiplication. They were first published in 1979, and are used to build larger packages such as LAPACK...

 package, and is a common operation in computations with vector processor
Vector processor
A vector processor, or array processor, is a central processing unit that implements an instruction set containing instructions that operate on one-dimensional arrays of data called vectors. This is in contrast to a scalar processor, whose instructions operate on single data items...

s. SAXPY is a combination of scalar multiplication
Scalar multiplication
In mathematics, scalar multiplication is one of the basic operations defining a vector space in linear algebra . In an intuitive geometrical context, scalar multiplication of a real Euclidean vector by a positive real number multiplies the magnitude of the vector without changing its direction...

 and vector addition,


where is a scalar
Scalar (mathematics)
In linear algebra, real numbers are called scalars and relate to vectors in a vector space through the operation of scalar multiplication, in which a vector can be multiplied by a number to produce another vector....

, and and are vectors. As with most functions, there exist four variants of SAXPY in the BLAS
Basic Linear Algebra Subprograms
Basic Linear Algebra Subprograms is a de facto application programming interface standard for publishing libraries to perform basic linear algebra operations such as vector and matrix multiplication. They were first published in 1979, and are used to build larger packages such as LAPACK...

 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.

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.

DAXPY

DAXPY denotes SAXPY with double precision
Double precision
In computing, double precision is a computer number format that occupies two adjacent storage locations in computer memory. A double-precision number, sometimes simply called a double, may be defined to be an integer, fixed point, or floating point .Modern computers with 32-bit storage locations...

 , and .

CAXPY

CAXPY denotes SAXPY with complex
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

 ,
and .

ZAXPY

ZAXPY denotes SAXPY with double precision
Double precision
In computing, double precision is a computer number format that occupies two adjacent storage locations in computer memory. A double-precision number, sometimes simply called a double, may be defined to be an integer, fixed point, or floating point .Modern computers with 32-bit storage locations...

 complex
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

,
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];
}

External links

  • http://download.oracle.com/docs/cd/E19059-01/stud.9/817-6700/
  • http://www.netlib.org/blas/
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK