CXML

saxpy, daxpy, caxpy, zaxpy 


FORMAT

  {S,D,C,Z}AXPY (n, alpha, x, incx, y, incy)

Arguments

  n                   integer*4
                      On entry, the number of elements in the vectors x and
                      y.
                      On exit, n is unchanged.

  alpha               real*4 | real*8 | complex*8 | complex*16
                      On entry, the scalar multiplier alpha for the elements
                      of the vector x.
                      On exit, lpha 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 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|).
                      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 elements of the vector
                      y.

                      On exit, if n<=0 or alpha = 0, y is unchanged. If n>0,
                      y is overwritten; y(i) is replaced by y(i)+alpha*x(i).

  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.

Description

  The _AXPY functions compute the following scalar-vector product and sum: y
  = alpha*x+y
  where alpha is a scalar, and x and y are vectors.

  If any element of x or the scalar alpha share a memory location with an
  element of 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.

Example

  INTEGER*4 N, INCX, INCY
  REAL*4 X(20), Y(20), alpha
  INCX = 1
  INCY = 1
  alpha = 2.0
  N = 20
  CALL SAXPY(N,alpha,X,INCX,Y,INCY)

  This FORTRAN code shows how all elements of the real vector x are
  multiplied by 2.0, added to the elements of the real vector y, and the
  vector y is set equal to the result.

CXML Home Page

Index of CXML Routines