- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an error with passing arrays using the fortran90 function matmul. If the function is applied to an array smaller than the definition of the array the function matmul produces incorrect results. See:
integer, parameter :: nMax = 3
integer :: i, j, k
real :: B(nMax,nMax), C(nMax,nMax), BC(nMax,nMax)
integer :: i, j, k
real :: B(nMax,nMax), C(nMax,nMax), BC(nMax,nMax)
n = 2
B(1,1) = 1.0
B(1,2) = 2.0
B(2,1) = 3.0
B(2,2) = 5.0
B(1,2) = 2.0
B(2,1) = 3.0
B(2,2) = 5.0
C(1,1) = 1.0
C(1,2) = 1.0
C(2,1) = 1.0
C(2,2) = 1.0
C(1,2) = 1.0
C(2,1) = 1.0
C(2,2) = 1.0
BC(1:n,1:n) = matmul(B(1:n,1:n),C(1:n,1:n))
write(*,*) bc(1:2,1:2)
write(*,*) "BC should be: 3.0 8.0 3.0 8.0"
end
We are using: Red Hat 7.3,i686 Itanium processor. The problem does not occur on a different processor and version of linux.
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page