<Example Program>
Program reshape_example
Implicit None
Integer,Parameter :: v(6) = [ 1,2,3,4,5,6 ]
Integer :: a(2,3), i
a = Reshape(v, Shape(a))
Print *, 'Reshape in default (array element) order'
Do i=1, Size(a,1)
Print 1, i, a(i,:)
1 Format(1X,'Row ',I0,' =',99(1X,I0))
End Do
a = Reshape(v, Shape(a), Order=[2,1])
Print *, 'Reshape with Order argument'
Do i=1, Size(a,1)
Print 1, i, a(i,:)
End Do
End Program
|
|
Execution ResultsReshape in default (array element) order Row 1 = 1 3 5 Row 2 = 2 4 6 Reshape with Order argument Row 1 = 1 2 3 |
|