インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
Transformational Intrinsic Function (Generic): Transposes an array of rank two.
result = TRANSPOSE (matrix)
matrix |
(Input) Must be a rank-two array. It may be of any data type. |
The result is a rank-two array with the same type and kind parameters as matrix. Its shape is (n, m), where (m, n) is the shape of matrix. For example, if the shape of matrix is (4,6), the shape of the result is (6,4).
Element (i, j) of the result has the value matrix(j, i), where i is in the range 1 to n, and j is in the range 1 to m.
B is the array
[ 2 3 4 ] [ 5 6 7 ] [ 8 9 1 ].
TRANSPOSE (B) has the value
[ 2 5 8 ] [ 3 6 9 ] [ 4 7 1 ].
The following shows another example:
INTEGER array(2, 3), result(3, 2)
array = RESHAPE((/1, 2, 3, 4, 5, 6/), (/2, 3/))
! array is 1 3 5
! 2 4 6
result = TRANSPOSE(array)
! result is 1 2
! 3 4
! 5 6
END