Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

SAXPY(3dxml)  —  Subroutines

Name

saxpy, daxpy, caxpy, zaxpy − Vector plus the product of a scalar and a vector

FORMAT

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

Arguments

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

alphareal∗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.

xreal∗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.

incxinteger∗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.

yreal∗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). 

incyinteger∗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.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026