From: robin on
"Gregory Larose" <gregorylarose(a)gmail.com> wrote in message
news:6a0e7d7d-7159-446d-a088-6776174520a3(a)b30g2000yqd.googlegroups.com...
|I keep getting this error when I run my file:
|
| In file lab12A.f95:56
|
| RESULT = MATMUL(array, array2)
| 1
| Error: Incompatible ranks 0 and 2 in assignment at (1).
|
| There is what the statement looks like in my file:
|
| DO irows = 1, ROWS
| RESULT = MATMUL(array, array2)
| WRITE(*,*)irows, RESULT
| END DO
|
| How do i fix it? Please help.

This code is no help. What are your declarations?


From: aerogeek on
Yes as everyone said with no declaration, there is nothing we can
say...

But here is a simple similar program if you are just trying to see how
to use matmul function of fortran


program matmultest
implicit none

double precision :: array(3,5), array2(5,3),result(3,3)
integer :: irows,icols,ii,j

do irows=1,5
do icols=1,3
array(icols,irows)=(irows-icols)*0.5d0
array2(irows,icols)=(irows-icols)*1.0d0
end do
end do

write(*,'(a)') 'Array :'
do ii=1,3
write(*,'(5f12.6)') (array(ii,j),j=1,5)
end do


write(*,'(a)') 'Array2 :'
do ii=1,5
write(*,'(3f12.6)') (array2(ii,j),j=1,3)
end do

result = MATMUL(array, array2)


write(*,'(a)') 'Result :'
do ii=1,3
write(*,'(3f12.6)') (result(ii,j),j=1,3)
end do


end program


This will produce this output

Array :
0.000000 0.500000 1.000000 1.500000 2.000000
-0.500000 0.000000 0.500000 1.000000 1.500000
-1.000000 -0.500000 0.000000 0.500000 1.000000
Array2 :
0.000000 -1.000000 -2.000000
1.000000 0.000000 -1.000000
2.000000 1.000000 0.000000
3.000000 2.000000 1.000000
4.000000 3.000000 2.000000
Result :
15.000000 10.000000 5.000000
10.000000 7.500000 5.000000
5.000000 5.000000 5.000000


If that is your intention, look at this program along with all the
previous comments.

cheers