These subroutines can perform any one of the following matrix additions, using matrices A and B or their transposes, and matrix C:
A, B, C | Subroutine |
Short-precision real | SGEADD |
Long-precision real | DGEADD |
Short-precision complex | CGEADD |
Long-precision complex | ZGEADD |
Fortran | CALL SGEADD | DGEADD | CGEADD | ZGEADD (a, lda, transa, b, ldb, transb, c, ldc, m, n) |
C and C++ | sgeadd | dgeadd | cgeadd | zgeadd (a, lda, transa, b, ldb, transb, c, ldc, m, n); |
PL/I | CALL SGEADD | DGEADD | CGEADD | ZGEADD (a, lda, transa, b, ldb, transb, c, ldc, m, n); |
If transa = 'N', A is used in the computation, and A has m rows and n columns.
If transa = 'T', AT is used in the computation, and A has n rows and m columns.
Specified as: a two-dimensional array, containing numbers of the data type indicated in Table 72, where:
If transa = 'N', its size must be lda by (at least) n.
If transa = 'T', its size must be lda by (at least) m.
If transa = 'N', lda >= m.
If transa = 'T', lda >= n.
If transa = 'N', A is used in the computation.
If transa = 'T', AT is used in the computation.
Specified as: a single character; transa = 'N' or 'T'.
If transb = 'N', B is used in the computation, and B has m rows and n columns.
If transb = 'T', BT is used in the computation, and B has n rows and m columns.
Specified as: a two-dimensional array, containing numbers of the data type indicated in Table 72, where:
If transb = 'N', its size must be ldb by (at least) n.
If transb = 'T', its size must be ldb by (at least) m.
If transb = 'N', ldb >= m.
If transb = 'T', ldb >= n.
If transb = 'N', B is used in the computation.
If transb = 'T', BT is used in the computation.
Specified as: a single character; transb = 'N' or 'T'.
The matrix sum is expressed as follows, where aij, bij, and cij are elements of matrices A, B, and C, respectively:
If m or n is 0, no computation is performed.
You can compute the transpose CT of each of the four computations listed under Function by using the following matrix identities:
Be careful that your output array receiving CT has dimensions large enough to hold the transposed matrix. See Example 4.
None
This example shows the computation C<--A+B, where A and C are contained in larger arrays A and C, respectively, and B is the same size as array B, in which it is contained.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL SGEADD( A , 6 , 'N' , B , 4 , 'N' , C , 5 , 4 , 3 )
* * | 110000.0 120000.0 130000.0 | | 210000.0 220000.0 230000.0 | A = | 310000.0 320000.0 330000.0 | | 410000.0 420000.0 430000.0 | | . . . | | . . . | * *
* * | 11.0 12.0 13.0 | B = | 21.0 22.0 23.0 | | 31.0 32.0 33.0 | | 41.0 42.0 43.0 | * *
* * | 110011.0 120012.0 130013.0 | | 210021.0 220022.0 230023.0 | C = | 310031.0 320032.0 330033.0 | | 410041.0 420042.0 430043.0 | | . . . | * *
This example shows the computation C<--AT+B, where A, B, and C are the same size as arrays A, B, and C, in which they are contained.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL SGEADD( A , 3 , 'T' , B , 4 , 'N' , C , 4 , 4 , 3 )
* * | 110000.0 120000.0 130000.0 140000.0 | A = | 210000.0 220000.0 230000.0 240000.0 | | 310000.0 320000.0 330000.0 340000.0 | * *
* * | 11.0 12.0 13.0 | B = | 21.0 22.0 23.0 | | 31.0 32.0 33.0 | | 41.0 42.0 43.0 | * *
* * | 110011.0 210012.0 310013.0 | C = | 120021.0 220022.0 320023.0 | | 130031.0 230032.0 330033.0 | | 140041.0 240042.0 340043.0 | * *
This example shows computation C<--A+BT, where A is contained in a larger array A, and B and C are the same size as arrays B and C, in which they are contained.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL SGEADD( A , 5 , 'N' , B , 3 , 'T' , C , 4 , 4 , 3 )
* * | 110000.0 120000.0 130000.0 | | 210000.0 220000.0 230000.0 | A = | 310000.0 320000.0 330000.0 | | 410000.0 420000.0 430000.0 | | . . . | * *
* * | 11.0 12.0 13.0 14.0 | B = | 21.0 22.0 23.0 24.0 | | 31.0 32.0 33.0 34.0 | * *
* * | 110011.0 120021.0 130031.0 | C = | 210012.0 220022.0 230032.0 | | 310013.0 320023.0 330033.0 | | 410014.0 420024.0 430034.0 | * *
This example shows how to produce the transpose of the result of the computation performed in Example 3, C<--A+BT, which uses the calling sequence:
CALL SGEADD( A , 5 , 'N' , B , 3 , 'T' , C , 4 , 4 , 3 )
You instead code a calling sequence for CT<--AT+B, as shown below, where the resulting matrix CT in the output array CT is the transpose of the matrix in the output array C in Example 3. Note that the array CT has dimensions large enough to receive the transposed matrix. For a description of all the matrix identities, see Special Usage.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL SGEADD( A , 5 , 'T' , B , 3 , 'N' , CT , 4 , 3 , 4 )
* * | 110000.0 120000.0 130000.0 | | 210000.0 220000.0 230000.0 | A = | 310000.0 320000.0 330000.0 | | 410000.0 420000.0 430000.0 | | . . . | * *
* * | 11.0 12.0 13.0 14.0 | B = | 21.0 22.0 23.0 24.0 | | 31.0 32.0 33.0 34.0 | * *
* * | 110011.0 210012.0 310013.0 410014.0 | CT = | 120021.0 220022.0 320023.0 420024.0 | | 130031.0 230032.0 330033.0 430034.0 | | . . . . | * *
This example shows the computation C<--AT+BT, where A, B, and C are the same size as the arrays A, B, and C, in which they are contained.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL SGEADD( A , 3 , 'T' , B , 3 , 'T' , C , 4 , 4 , 3 )
* * | 110000.0 120000.0 130000.0 140000.0 | A = | 210000.0 220000.0 230000.0 240000.0 | | 310000.0 320000.0 330000.0 340000.0 | * *
* * | 11.0 12.0 13.0 14.0 | B = | 21.0 22.0 23.0 24.0 | | 31.0 32.0 33.0 34.0 | * *
* * | 110011.0 210021.0 310031.0 | C = | 120012.0 220022.0 320032.0 | | 130013.0 230023.0 330033.0 | | 140014.0 240024.0 340034.0 | * *
This example shows the computation C<--A+B, where A, B, and C are contained in larger arrays A, B, and C, respectively, and the arrays contain complex data.
A LDA TRANSA B LDB TRANSB C LDC M N | | | | | | | | | | CALL CGEADD( A , 6 , 'N' , B , 5 , 'N' , C , 5 , 4 , 3 )
* * | (1.0, 5.0) (9.0, 2.0) (1.0, 9.0) | | (2.0, 4.0) (8.0, 3.0) (1.0, 8.0) | A = | (3.0, 3.0) (7.0, 5.0) (1.0, 7.0) | | (6.0, 6.0) (3.0, 6.0) (1.0, 4.0) | | . . . | | . . . | * *
* * | (1.0, 8.0) (2.0, 7.0) (3.0, 2.0) | | (4.0, 4.0) (6.0, 8.0) (6.0, 3.0) | B = | (6.0, 2.0) (4.0, 5.0) (4.0, 5.0) | | (7.0, 2.0) (6.0, 4.0) (1.0, 6.0) | | . . . | * *
* * | (2.0, 13.0) (11.0, 9.0) (4.0, 11.0) | | (6.0, 8.0) (14.0, 11.0) (7.0, 11.0) | C = | (9.0, 5.0) (11.0, 10.0) (5.0, 12.0) | | (13.0, 8.0) (9.0, 10.0) (2.0, 10.0) | | . . . | * *