These subroutines transpose an m by n matrix A out of place, returning the result in matrix B:
A, B | Subroutine |
Short-precision real | SGETMO |
Long-precision real | DGETMO |
Short-precision complex | CGETMO |
Long-precision complex | ZGETMO |
Fortran | CALL SGETMO | DGETMO | CGETMO | ZGETMO (a, lda, m, n, b, ldb) |
C and C++ | sgetmo | dgetmo | cgetmo | zgetmo (a, lda, m, n, b, ldb); |
PL/I | CALL SGETMO | DGETMO | CGETMO | ZGETMO (a, lda, m, n, b, ldb); |
Matrix A is transposed out of place; that is, the m rows and n columns in matrix A are stored in n rows and m columns of matrix B. For matrix A with elements aij, where i = 1, m and j = 1, n, the out-of-place transpose is expressed as bji = aij for i = 1, m and j = 1, n.
For the following input matrix A:
the out-of-place matrix transpose operation B<--AT is expressed as:
If m or n is 0, no computation is performed.
None
This example shows an out-of-place matrix transpose of matrix A, having 5 rows and 4 columns, with the result going into matrix B.
A LDA M N B LDB | | | | | | CALL SGETMO( A(2,3) , 10 , 5 , 4 , B(2,2) , 6 )
* * | . . . . . . . | | . . 1.0 6.0 11.0 16.0 . | | . . 2.0 7.0 12.0 17.0 . | | . . 3.0 8.0 13.0 18.0 . | A = | . . 4.0 9.0 14.0 19.0 . | | . . 5.0 10.0 15.0 20.0 . | | . . . . . . . | | . . . . . . . | | . . . . . . . | | . . . . . . . | * *
* * | . . . . . . . | | . 1.0 2.0 3.0 4.0 5.0 . | B = | . 6.0 7.0 8.0 9.0 10.0 . | | . 11.0 12.0 13.0 14.0 15.0 . | | . 16.0 17.0 18.0 19.0 20.0 . | | . . . . . . . | * *
This example uses the same input matrix A as in Example 1 to show that transposes can be achieved in the same array as long as the input and output data do not overlap. On output, the input data is not overwritten in the array.
A LDA M N B LDB | | | | | | CALL SGETMO( A(2,3) , 10 , 5 , 4 , A(7,1) , 10 )
* * | . . . . . . . | | . . 1.0 6.0 11.0 16.0 . | | . . 2.0 7.0 12.0 17.0 . | | . . 3.0 8.0 13.0 18.0 . | A = | . . 4.0 9.0 14.0 19.0 . | | . . 5.0 10.0 15.0 20.0 . | | 1.0 2.0 3.0 4.0 5.0 . . | | 6.0 7.0 8.0 9.0 10.0 . . | | 11.0 12.0 13.0 14.0 15.0 . . | | 16.0 17.0 18.0 19.0 20.0 . . | * *