pezze
Joined: 20 Sep 2007 Posts: 2
|
Posted: Wed Oct 03, 2007 8:01 pm Post subject: dot_product crashes, bug in FTN95? |
|
|
Hello, there seems to be a problem with the intrinsic dot_product. The following program crashes in the line dp2=dot_product(vector1,sum(matrix,2)), which I think is a legal Fortran statement. Any thoughts?
program dot_product_crash
implicit none
integer, parameter :: wp=selected_real_kind(15)
real(wp) :: matrix(2,2), vector1(2), vector2(2), dp1, dp2
matrix(1,1) = 1.0_wp
matrix(1,2) = 2.0_wp
matrix(2,1) = 3.0_wp
matrix(2,2) = 4.0_wp
vector1(1) = 1.0_wp
vector1(2) = 1.0_wp
! I want to compute the dot product of vector1 and vector2 := sum(matrix,2)
! Method 1: Compute vector2 first
vector2 = sum(matrix,2)
dp1 = dot_product(vector1,vector2)
write(*,*) 'dp1 =', dp1
! Method 2: Compute everything at once
dp2 = dot_product(vector1,sum(matrix,2))
write(*,*) 'dp2 =', dp2
end program dot_product_crash |
|