[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

# Technical Reference: Base Operating System and Extensions , Volume 2

## SAXPY, DAXPY, CAXPY, or ZAXPY Subroutine

### Purpose

Computes a constant times a vector plus a vector.

### Library

BLAS Library (libblas.a)

### FORTRAN Syntax

SUBROUTINE SAXPY(N,A,X,INCX,Y,INCY)
INTEGER INCX, INCY, N
REAL A
REAL X(*), Y(*)

```SUBROUTINE DAXPY(N,A,X,INCX,Y,INCY)
INTEGER INCX,INCY,N
DOUBLE PRECISION A
DOUBLE PRECISION X(*),Y(*)
```

```SUBROUTINE CAXPY(N,A,X,INCX,Y,INCY)
INTEGER INCX,INCY,N
COMPLEX A
COMPLEX X(*),Y(*)
```

```SUBROUTINE ZAXPY(N,A,X,INCX,Y,INCY)
INTEGER INCX,INCY,N
COMPLEX*16 A
COMPLEX*16 X(*),Y(*)
```

### Description

The SAXPY, DAXPY, CAXPY, or ZAXPY subroutine computes a constant times a vector plus a vector:

Y = A * X + Y

### Parameters

 N On entry, N specifies the number of elements in X and Y; unchanged on exit. A On entry, A contains a constant to be multiplied by the X vector; unchanged on exit. X Vector of dimension at least (1 + (N-1) * abs(INCX) ); unchanged on exit. INCX On entry, INCX specifies the increment for the elements of X; unchanged on exit. Y Vector of dimension at least (1 + (N-1) * abs(INCY) ); the result is returned in vector Y. INCY On entry, INCY specifies the increment for the elements of Y; unchanged on exit.

### Error Codes

If SA = 0 or N <= 0, the subroutine returns immediately.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]