CXML
szaxpy, dzaxpy, czaxpy, zzaxpy
Vector plus the product of a scalar and a
vector
FORMAT
{S,D,C,Z}ZAXPY (n, alpha, x, incx, y, incy, z, incz)
Arguments
n integer*4
On entry, the number of elements of the vectors x and
y.
On exit, n is unchanged.
alpha real*4 | real*8 | complex*8 | complex*16
On entry, the scalar value to be multiplied with the
elements of vector x.
On exit, alpha is unchanged.
x real*4 | real*8 | complex*8 | complex*16
On entry, a one-dimensional array X of length at least
(1+(n-1)*|incx|), containing the n elements of the
vector x.
On exit, x is unchanged.
incx integer*4
On entry, the increment for the array X.
If incx > 0, vector x is stored forward in the array,
so that x(i) is stored in location X(1+(i-1)*incx).
If incx < 0, vector x is stored backward in the array,
so that x(i) is stored in location X(1+(n-i)*|incx|).
If incx = 0, only the first element is accessed.
On exit, incx is unchanged.
y real*4 | real*8 | complex*8 | complex*16
On entry, a one-dimensional array Y of length at least
(1+(n-1)*|incy|), containing the n elements of the
vector y.
On exit, y is unchanged.
incy integer*4
On entry, the increment for the array Y.
If incy >= 0, vector y is stored forward in the array,
so that y(i) is stored in location Y(1+(i-1)*incy).
If incy < 0, vector y is stored backward in the array,
so that y(i) is stored in location Y(1+(n-i)*|incy|).
On exit, incy is unchanged.
z real*4 | real*8 | complex*8 | complex*16
On entry, a one-dimensional array Z of length at least
(1+(n-1)*|incz|).
On exit, if n<=0, then z is unchanged. If n > 0, z is
overwritten with the products; each z(i) is replaced by
y(i)+alpha*x(i).
incz integer*4
On entry, the increment for the array Z.
If incz >= 0, vector z is stored forward in the array,
so that z(i) is stored in location Z(1+(i-1)*incz).
If incz < 0, vector z is stored backward in the array,
so that z(i) is stored in location Z(1+(n-i)*|incz|).
On exit, incz is unchanged.
Description
The _ZAXPY subprograms compute the product of a scalar and a vector, add
the result to the elements of another vector, and then store the result in
vector z: z = alpha*x + y
where alpha is a scalar, and x, y, and z are vectors with n elements.
The scalar alpha must not share a memory location with any element of the
vector z. If incz = 0 or if any element of z shares a memory location with
an element of x or y, the results are unpredictable.
If incx = 0, the computation is a time-consuming way of adding the constant
alpha*x(1) to all the elements of y. The following chart shows the
resulting operation from the interaction of the incx and incy arguments.
incx = 0 incx <> 0
incy = 0
z(i) = y(1) + alpha*x(1)
z(i) = y(1) +
alpha*x(i)
incy <> 0
z(i) = y(i) + alpha*x(1)
z(i) = y(i) +
alpha*x(i)
Example
INTEGER*4 N, INCX, INCY, INCZ
REAL*4 X(20), Y(20), Z(40), alpha
INCX = 1
INCY = 1
INCZ = 2
alpha = 2.0
N = 20
CALL SZAXPY(N,alpha,X,INCX,Y,INCY,Z,INCZ)
This FORTRAN example shows how all elements of the vector x are multiplied
by 2.0 and added to the elements of vector y. Vector z contains the result.
CXML Home Page Index of CXML Routines