I know that "transpose" in Fortran is an operator which flips a matrix over its diagonal. However, in the code below, I met an error and did not know why.
The code is:
program main
implicit none
real(8)::a(3,2),b(2,1)
a=reshape((/1.0,2.0,3.0,4.0,5.0,6.0/),(/3,2/))
b=reshape((/1.0,2.0/),(/2,1/))
write(*,*)a(1,1:2)
!Next sentence throw an error
a(1,1:2)=transpose(b)
end program
The error is:
error #6366: The shapes of the array expressions do not conform. [A]
I think "a(1,1:2)" is one line and two columns, which is the same as "transpose(b)", why the compiler told me that "the shape do not conform"?