RESHAPE— Function to reshape an array
Reshapes SOURCE to correspond to SHAPE. If necessary, the new array may be padded with elements from PAD or permuted as defined by ORDER.
Fortran 95 and later
RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])
|SOURCE||Shall be an array of any type.|
|SHAPE||Shall be of type |
|PAD||(Optional) shall be an array of the same type as SOURCE.|
|ORDER||(Optional) shall be of type |
The result is an array of shape SHAPE with the same type as SOURCE.
PROGRAM test_reshape INTEGER, DIMENSION(4) :: x WRITE(*,*) SHAPE(x) ! prints "4" WRITE(*,*) SHAPE(RESHAPE(x, (/2, 2/))) ! prints "2 2" END PROGRAM