Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Diskussionen

matmul and conformable matrix-vector

davidmarcus
Einsteiger
1.048Aufrufe
I'm using CVF 6.6B. I expected the following program to give a run-time error, but it runs without complaint. Is this WAD?

program Test
implicit none
real, dimension(3,3):: T
real, dimension(6) :: X
T = 1
X = 1
call Sub( T, X )
contains
subroutine Sub( T, X )
real, dimension(:,:), intent(in):: T
real, dimension(:), intent(in):: X
write( *, * ) matmul( T, X )
end subroutine Sub
end program Test

C:>Test.exe
3.000000 3.000000 3.000000
0 Kudos
5 Antworten
micromuni
Einsteiger
1.048Aufrufe
Setting an array name to a fixed number sets each row and column element of the array to the fixed number. I am not sure, but this might be an old Fortran standard that is not well known. It is similar to setting an entire matrix to zero by saying X = 0, where X is defined as X(6)
in your example.
davidmarcus
Einsteiger
1.048Aufrufe
T is 3x3, but X is of size 6. I was expecting an error messages that the matrix and vector are not conformable.
Steven_L_Intel1
Mitarbeiter
1.048Aufrufe
CVF doesn't do run-time shape conformance checking.

Steve
davidmarcus
Einsteiger
1.048Aufrufe
Is this on the list of things that might be added in a future version?
Steven_L_Intel1
Mitarbeiter
1.048Aufrufe
Yes.

Steve
Antworten