SAXPY(3S)SAXPY(3S)NAME
SAXPY, CAXPY, DAXPY, ZAXPY - Adds a scalar multiple of a real or complex
vector to another real or complex vector
SYNOPSIS
Single precision
Fortran:
CALL SAXPY (n, alpha, x, incx, y, incy)
C/C++:
#include <scsl_blas.h>
void saxpy( int n, float alpha, float *x, int incx, float *y,
int incy );
Double precision
Fortran:
CALL DAXPY (n, alpha, x, incx, y, incy)
C/C++:
#include <scsl_blas.h>
void daxpy( int n, double alpha, double *x, int incx, double
*y, int incy );
Single precision complex
Fortran:
CALL CAXPY (n, alpha, x, incx, y, incy)
C/C++:
#include <scsl_blas.h>
void caxpy( int n, scsl_complex *alpha, scsl_complex *x, int
incx, scsl_complex *y, int incy );
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void caxpy( int n, complex<float> *alpha, complex<float> *x,int
incx, complex<float> *y, int incy );
Double precision complex
Fortran:
CALL ZAXPY (n, alpha, x, incx, y, incy)
C/C++:
#include <scsl_blas.h>
void zaxpy( int n, scsl_zomplex *alpha, scsl_zomplex *x, int
incx, scsl_zomplex *y, int incy );
Page 1
SAXPY(3S)SAXPY(3S)
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void zaxpy( int n, complex<double> *alpha, complex<double> *x,
int incx, complex<double> *y, int incy );
IMPLEMENTATION
These routines are part of the SCSL Scientific Library and can be loaded
using either the -lscs or the -lscs_mp option. The -lscs_mp option
directs the linker to use the multi-processor version of the library.
When linking to SCSL with -lscs or -lscs_mp, the default integer size is
4 bytes (32 bits). Another version of SCSL is available in which integers
are 8 bytes (64 bits). This version allows the user access to larger
memory sizes and helps when porting legacy Cray codes. It can be loaded
by using the -lscs_i8 option or the -lscs_i8_mp option. A program may use
only one of the two versions; 4-byte integer and 8-byte integer library
calls cannot be mixed.
The C and C++ prototypes shown above are appropriate for the 4-byte
integer version of SCSL. When using the 8-byte integer version, the
variables of type int become long long and the <scsl_blas_i8.h> header
file should be included.
DESCRIPTION
SAXPY/DAXPY adds a scalar multiple of a real vector to another real
vector.
CAXPY/ZAXPY adds a scalar multiple of a complex vector to another complex
vector.
These routines perform the following vector operation:
y <- alpha * x + y
where alpha is a real or complex scalar, and x and y are real or complex
vectors.
See the NOTES section of this man page for information about the
interpretation of the data types described in the following arguments.
These routines have the following arguments:
n Integer. (input)
Number of elements in the vectors. If n <= 0, these routines
return without any computation.
alpha Scalar. (input)
SAXPY: Single precision.
DAXPY: Double precision.
CAXPY: Single precision complex.
ZAXPY: Double precision complex.
Page 2
SAXPY(3S)SAXPY(3S)
If alpha = 0 these routines return without any computation.
For C/C++, a pointer to this scalar is passed when alpha is
complex; otherwise, alpha is passed by value.
x Array of dimension (n-1) * |incx| + 1. (input)
SAXPY: Single precision array.
DAXPY: Double precision array.
CAXPY: Single precision complex array.
ZAXPY: Double precision complex array.
Contains the vector to be scaled before summation.
incx Integer. (input)
Increment between elements of x. If incx = 0, the results will
be unpredictable.
y Array of dimension (n-1) * |incy| + 1. (input and output)
SAXPY: Single precision array.
DAXPY: Double precision array.
CAXPY: Single precision complex array.
ZAXPY: Double precision complex array.
Before calling the routine, y contains the vector to be summed.
After the routine ends, y contains the result of the summation.
incy Integer. (input)
Increment between elements of y. If incy = 0, the results will
be unpredictable.
NOTES
These routines are Level 1 Basic Linear Algebra Subprograms (Level 1
BLAS).
When working backward (incx < 0 or incy < 0), each routine starts at the
end of the vector and moves backward, as follows:
x(1-incx * (n-1)), x(1-incx * (n-2)), ..., x(1)
y(1-incy * (n-1)), y(1-incy * (n-2)), ..., y(1)
Data Types
The following data types are described in this documentation:
Term Used Data type
Fortran:
Array dimensioned n x(n)
Character CHARACTER
Page 3
SAXPY(3S)SAXPY(3S)
Integer INTEGER (INTEGER*8 for -lscs_i8[_mp])
Single precision REAL
Double precision DOUBLE PRECISION
Single precision complex COMPLEX
Double precision complex DOUBLE COMPLEX
C/C++:
Array dimensioned n x[n]
Character char
Integer int (long long for -lscs_i8[_mp])
Single precision float
Double precision double
Single precision complex scsl_complex
Double precision complex scsl_zomplex
C++ STL:
Array dimensioned n x[n]
Character char
Integer int (long long for -lscs_i8[_mp])
Single precision float
Double precision double
Single precision complex complex<float>
Double precision complex complex<double>
RETURN VALUES
When n <= 0, real alpha = 0., or complex alpha = 0 = 0.+0.i, these
routines return immediately with no change in their arguments.
SEE ALSOINTRO_SCSL(3S), INTRO_BLAS1(3S)INTRO_CBLAS(3S) for information about using the C interface to Fortran 77
Basic Linear Algebra Subprograms (legacy BLAS) set forth by the Basic
Linear Algebra Subprograms Technical Forum.
Page 4
SAXPY(3S)SAXPY(3S)
Page 5