These subprograms perform the following computation, using the scalar alpha and vectors x and y:
alpha | x, y | Subprogram |
Short-precision real | Short-precision real | SYAX |
Long-precision real | Long-precision real | DYAX |
Short-precision complex | Short-precision complex | CYAX |
Long-precision complex | Long-precision complex | ZYAX |
Short-precision real | Short-precision complex | CSYAX |
Long-precision real | Long-precision complex | ZDYAX |
Fortran | CALL SYAX | DYAX | CYAX | ZYAX | CSYAX | ZDYAX (n, alpha, x, incx, y, incy) |
C and C++ | syax | dyax | cyax | zyax | csyax | zdyax (n, alpha, x, incx, y, incy); |
PL/I | CALL SYAX | DYAX | CYAX | ZYAX | CSYAX | ZDYAX (n, alpha, x, incx, y, incy); |
The computation is expressed as follows:
See reference [79]. If n is 0, no computation is performed. For CYAX, intermediate results are accumulated in long precision.
None
n < 0
This example shows vectors x and y with positive strides.
N ALPHA X INCX Y INCY | | | | | | CALL SYAX( 5 , 2.0 , X , 1 , Y , 2 ) X = (1.0, 2.0, 3.0, 4.0, 5.0)
Y = (2.0, . , 4.0, . , 6.0, . , 8.0, . , 10.0)
This example shows vectors x and y that have strides of opposite signs. For y, which has negative stride, results are stored beginning in element Y(5).
N ALPHA X INCX Y INCY | | | | | | CALL SYAX( 5 , 2.0 , X , 1 , Y , -1 ) X = (1.0, 2.0, 3.0, 4.0, 5.0)
Y = (10.0, 8.0, 6.0, 4.0, 2.0)
This example shows a vector, x, with 0 stride. x is treated like a vector of length n, all of whose elements are the same as the single element in x.
N ALPHA X INCX Y INCY | | | | | | CALL SYAX( 5 , 2.0 , X , 0 , Y , 1 ) X = (1.0)
Y = (2.0, 2.0, 2.0, 2.0, 2.0)
This example shows how SYAX can be used to compute a scalar value. In this case both vectors x and y contain scalar values, and the strides for both vectors are 0. The number of elements to be processed, n, is 1.
N ALPHA X INCX Y INCY | | | | | | CALL SYAX( 1 , 2.0 , X , 0 , Y , 0 ) X = (1.0)
Y = (2.0)
This example shows a scalar, alpha, and vectors x and y, containing complex numbers, where both vectors have a stride of 1.
N ALPHA X INCX Y INCY | | | | | | CALL CYAX( 3 ,ALPHA, X , 1 , Y , 1 ) ALPHA = (2.0, 3.0) X = ((1.0, 2.0), (2.0, 0.0), (3.0, 5.0))
Y = ((-4.0, 7.0), (4.0, 6.0), (-9.0, 19.0))
This example shows a scalar, alpha, containing a real number, and vectors x and y, containing complex numbers, where both vectors have a stride of 1.
N ALPHA X INCX Y INCY | | | | | | CALL CSYAX( 3 , 2.0 , X , 1 , Y , 1 ) X = ((1.0, 2.0), (2.0, 0.0), (3.0, 5.0))
Y = ((2.0, 4.0), (4.0, 0.0), (6.0, 10.0))