SGER, DGER, CGERU, and ZGERU compute the rank-one update of a general matrix, using the scalar alpha, matrix A, vector x, and the transpose of vector y:
CGERC and ZGERC compute the rank-one update of a general matrix, using the scalar alpha, matrix A, vector x, and the conjugate transpose of vector y:
alpha, A, x, y | Subprogram |
Short-precision real | SGER |
Long-precision real | DGER |
Short-precision complex | CGERU and CGERC |
Long-precision complex | ZGERU and ZGERC |
Fortran | CALL SGER | DGER | CGERU | ZGERU | CGERC | ZGERC (m, n, alpha, x, incx, y, incy, a, lda) |
C and C++ | sger | dger | cgeru | zgeru | cgerc | zgerc (m, n, alpha, x, incx, y, incy, a, lda); |
PL/I | CALL SGER | DGER | CGERU | ZGERU | CGERC | ZGERC (m, n, alpha, x, incx, y, incy, a, lda); |
Specified as: a one-dimensional array of (at least) length 1+(n-1)|incy|, containing numbers of the data type indicated in Table 63.
Returned as: a two-dimensional array, containing numbers of the data type indicated in Table 63.
SGER, DGER, CGERU, and ZGERU compute the rank-one update of a general matrix:
where:
It is expressed as follows:
It can also be expressed as:
CGERC and ZGERC compute a slightly different rank-one update of a general matrix:
where:
It is expressed as follows:
It can also be expressed as:
See references [34], [35], and [79]. No computation is performed if m, n, or alpha is zero. For CGERU and CGERC, intermediate results are accumulated in long precision. For SGER, intermediate results are accumulated in long precision on some platforms.
Unable to allocate internal work area.
None
This example shows a matrix, A, contained in a larger array, A. The strides of vectors x and y are positive. Because lda is 10 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=10 and F2-F1+1 >= 3. For this example, array A is declared as A(1:10,0:2).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL SGER( 4 , 3 , 1.0 , X , 1 , Y , 2 , A(1,0) , 10 ) X = (3.0, 2.0, 1.0, 4.0) Y = (1.0, . , 2.0, . , 3.0)
* * | 1.0 2.0 3.0 | | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | A = | . . . | | . . . | | . . . | | . . . | | . . . | | . . . | * *
* * | 4.0 8.0 12.0 | | 4.0 6.0 10.0 | | 4.0 4.0 5.0 | | 8.0 10.0 13.0 | A = | . . . | | . . . | | . . . | | . . . | | . . . | | . . . | * *
This example shows a matrix, A, contained in a larger array, A. The strides of vectors x and y are of opposite sign. For y, which has negative stride, processing begins at element Y(5), which is 1.0. Array A must follow the same rules as given in Example 1. For this example, array A is declared as A(-1:8,1:3).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL SGER( 4 , 3 , 1.0 , X , 1 , Y , -2 , A(-1,1) , 10 )
This example shows a matrix, A, contained in a larger array, A, and the first element of the matrix is not the first element of the array. Array A must follow the same rules as given in Example 1. For this example, array A is declared as A(1:10,1:3).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL SGER( 4 , 3 , 1.0 , X , 3 , Y , 1 , A(4,1) , 10 ) X = (3.0, . , . , 2.0, . , . , 1.0, . , . , 4.0) Y = (1.0, 2.0, 3.0)
* * | . . . | | . . . | | . . . | | 1.0 2.0 3.0 | A = | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | | . . . | | . . . | | . . . | * *
* * | . . . | | . . . | | . . . | | 4.0 8.0 12.0 | A = | 4.0 6.0 10.0 | | 4.0 4.0 5.0 | | 8.0 10.0 13.0 | | . . . | | . . . | | . . . | * *
This example shows a matrix, A, and array, A, having the same number of rows. For this case, m and lda are equal. Because lda is 4 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=4 and F2-F1+1 >= 3. For this example, array A is declared as A(1:4,0:2).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL SGER( 4 , 3 , 1.0 , X , 1 , Y , 1 , A(1,0) , 4 ) X = (3.0, 2.0, 1.0, 4.0) Y = (1.0, 2.0, 3.0)
* * | 1.0 2.0 3.0 | A = | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | * *
* * | 4.0 8.0 12.0 | A = | 4.0 6.0 10.0 | | 4.0 4.0 5.0 | | 8.0 10.0 13.0 | * *
This example shows a computation in which scalar value for alpha is greater than 1. Array A must follow the same rules as given in Example 4. For this example, array A is declared as A(-1:2,1:3).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL SGER( 4 , 3 , 2.0 , X , 1 , Y , 1 , A(-1,1) , 4 )
* * | 7.0 14.0 21.0 | A = | 6.0 10.0 16.0 | | 5.0 6.0 8.0 | | 12.0 18.0 25.0 | * *
This example shows a rank-one update in which all data items contain complex numbers, and the transpose yT is used in the computation. Matrix A is contained in a larger array, A. The strides of vectors x and y are positive. The Fortran DIMENSION statement for array A must follow the same rules as given in Example 1. For this example, array A is declared as A(1:10,0:2).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL CGERU( 5 , 3 , ALPHA , X , 1 , Y , 1 , A(1,0) , 10 ) ALPHA = (1.0, 0.0) X = ((1.0, 2.0), (4.0, 0.0), (1.0, 1.0), (3.0, 4.0), (2.0, 0.0)) Y = ((1.0, 2.0), (4.0, 0.0), (1.0, -1.0))
* * | (1.0, 2.0) (3.0, 5.0) (2.0, 0.0) | | (2.0, 3.0) (7.0, 9.0) (4.0, 8.0) | | (7.0, 4.0) (1.0, 4.0) (6.0, 0.0) | | (8.0, 2.0) (2.0, 5.0) (8.0, 0.0) | A = | (9.0, 1.0) (3.0, 6.0) (1.0, 0.0) | | . . . | | . . . | | . . . | | . . . | | . . . | * *
* * | (-2.0, 6.0) (7.0, 13.0) (5.0, 1.0) | | (6.0, 11.0) (23.0, 9.0) (8.0, 4.0) | | (6.0, 7.0) (5.0, 8.0) (8.0, 0.0) | | (3.0, 12.0) (14.0, 21.0) (15.0, 1.0) | A = | (11.0, 5.0) (11.0, 6.0) (3.0, -2.0) | | . . . | | . . . | | . . . | | . . . | | . . . | * *
This example shows a rank-one update in which all data items contain complex numbers, and the conjugate transpose yH is used in the computation. Matrix A is contained in a larger array, A. The strides of vectors x and y are positive. The Fortran DIMENSION statement for array A must follow the same rules as given in Example 1. For this example, array A is declared as A(1:10,0:2).
M N ALPHA X INCX Y INCY A LDA | | | | | | | | | CALL CGERC( 5 , 3 , ALPHA , X , 1 , Y , 1 , A(1,0) , 10 )
* * | (6.0, 2.0) (7.0, 13.0) (1.0, 3.0) | | (6.0, -5.0) (23.0, 9.0) (8.0, 12.0) | | (10.0, 3.0) (5.0, 8.0) (6.0, 2.0) | | (19.0, 0.0) (14.0, 21.0) (7.0, 7.0) | A = | (11.0, -3.0) (11.0, 6.0) (3.0, 2.0) | | . . . | | . . . | | . . . | | . . . | | . . . | * *