Convert flat row-major [m,n] to flat column-major [m,n] Inverse of col_to_row_major_2d.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in) | :: | data_in(m*n) | |||
| real(kind=real32), | intent(out) | :: | data_out(m*n) | |||
| integer, | intent(in) | :: | m | |||
| integer, | intent(in) | :: | n |
subroutine row_to_col_major_2d(data_in, data_out, m, n) !! Convert flat row-major [m,n] to flat column-major [m,n] !! Inverse of col_to_row_major_2d. implicit none integer, intent(in) :: m, n real(real32), intent(in) :: data_in(m * n) real(real32), intent(out) :: data_out(m * n) integer :: i, j do i = 1, m do j = 1, n data_out((j-1)*m + i) = data_in((i-1)*n + j) end do end do end subroutine row_to_col_major_2d