These subprograms perform the following computation, using vectors x, y, and z:
x, y, z | Subprogram |
Short-precision real | SVEM |
Long-precision real | DVEM |
Short-precision complex | CVEM |
Long-precision complex | ZVEM |
Fortran | CALL SVEM | DVEM | CVEM | ZVEM (n, x, incx, y, incy, z, incz) |
C and C++ | svem | dvem | cvem | zvem (n, x, incx, y, incy, z, incz); |
PL/I | CALL SVEM | DVEM | CVEM | ZVEM (n, x, incx, y, incy, z, incz); |
The computation is expressed as follows:
If n is 0, no computation is performed. For CVEM, intermediate results are accumulated in long precision (short-precision Multiply followed by a long-precision Add), with the final result truncated to short precision.
None
n < 0
This example shows vectors x, y, and z, with positive strides.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 1 , Y , 2 , Z , 1 ) X = (1.0, 2.0, 3.0, 4.0, 5.0) Y = (1.0, . , 1.0, . , 1.0, . , 1.0, . , 1.0)
Z = (1.0, 2.0, 3.0, 4.0, 5.0)
This example shows vectors x and y having strides of opposite sign, and an output vector z having a positive stride. For y, which has negative stride, processing begins at element Y(5), which is 1.0.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 1 , Y , -1 , Z , 2 ) X = (1.0, 2.0, 3.0, 4.0, 5.0) Y = (5.0, 4.0, 3.0, 2.0, 1.0)
Z = (1.0, . , 4.0, . , 9.0, . , 16.0, . , 25.0)
This example shows a vector, x, with 0 stride, and a vector, z, with negative stride. x is treated like a vector of length n, all of whose elements are the same as the single element in x. For vector z, results are stored beginning in element Z(5).
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 0 , Y , 1 , Z , -1 ) X = (1.0) Y = (5.0, 4.0, 3.0, 2.0, 1.0)
Z = (1.0, 2.0, 3.0, 4.0, 5.0)
This example shows a vector, y, with 0 stride. y is treated like a vector of length n, all of whose elements are the same as the single element in y.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 1 , Y , 0 , Z , 1 ) X = (1.0, 2.0, 3.0, 4.0, 5.0) Y = (5.0)
Z = (5.0, 10.0, 15.0, 20.0, 25.0)
This example shows the output vector, z, with 0 stride, where the vector x has positive stride, and the vector y has 0 stride. The number of elements to be processed, n, is greater than 1.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 1 , Y , 0 , Z , 0 ) X = (1.0, 2.0, 3.0, 4.0, 5.0) Y = (5.0)
Z = (25.0)
This example shows the output vector z, with 0 stride, where the vector x has 0 stride, and the vector y has negative stride. The number of elements to be processed, n, is greater than 1.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 5 , X , 0 , Y , -1 , Z , 0 ) X = (1.0) Y = (5.0, 4.0, 3.0, 2.0, 1.0)
Z = (5.0)
This example shows how SVEM can be used to compute a scalar value. In this case, vectors x and y contain scalar values. The strides of all vectors, x, y, and z, are 0. The number of elements to be processed, n, is 1.
N X INCX Y INCY Z INCZ | | | | | | | CALL SVEM( 1 , X , 0 , Y , 0 , Z , 0 ) X = (1.0) Y = (5.0)
Z = (5.0)
This example shows vectors x and y, containing complex numbers and having positive strides.
N X INCX Y INCY Z INCZ | | | | | | | CALL CVEM( 3 , X , 1 , Y , 2 , Z , 1 ) X = ((1.0, 2.0), (3.0, 4.0), (5.0, 6.0)) Y = ((7.0, 8.0), . , (9.0, 10.0), . , (11.0, 12.0))
Z = ((-9.0, 22.0), (-13.0, 66.0), (-17.0, 126.0))