2 ! Check the fix for PR28005, in which the mechanism for dealing
\r
3 ! with matmul (transpose (a), b) would cause wrong results for
\r
4 ! matmul (a(i, 1:n), b(1:n, 1:n)).
\r
6 ! Based on the original testcase contributed by
\r
7 ! Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
\r
10 integer, parameter :: nmax = 3
\r
12 integer, dimension(nmax,nmax) :: iB=0 , iC=1
\r
13 integer, dimension(nmax,nmax) :: iX1=99, iX2=99, iChk
\r
14 iChk = reshape((/30,66,102,36,81,126,42,96,150/),(/3,3/))
\r
16 ! This would give 3, 3, 99
\r
17 iB = reshape((/1 ,3 ,0 ,2 ,5 ,0 ,0 ,0 ,0 /),(/3,3/))
\r
18 iX1(1:n,1) = matmul( iB(2,1:n),iC(1:n,1:n) )
\r
20 ! This would give 4, 4, 99
\r
22 iX2(1:n,1) = matmul( iB(2,1:n),iC(1:n,1:n) )
\r
24 ! Whereas, we should have 8, 8, 99
\r
25 if (any (iX1(1:n,1) .ne. (/8, 8, 99/))) call abort ()
\r
26 if (any (iX1 .ne. iX2)) call abort ()
\r
28 ! Make sure that the fix does not break transpose temporaries.
\r
29 iB = reshape((/(i, i = 1, 9)/),(/3,3/))
\r
31 iX1 = transpose (iB)
\r
32 iX1 = matmul (iX1, iC)
\r
33 iX2 = matmul (transpose (iB), iC)
\r
34 if (any (iX1 .ne. iX2)) call abort ()
\r
35 if (any (iX1 .ne. iChk)) call abort ()
\r