OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [matmul_1.f90] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
!{ dg-do run }
2
! Test MATMUL for various arguments and results
3
! (test values checked with GNU octave).
4
! PR18857 was due to an incorrect assertion that component base==0
5
! for both input arguments and the result.
6
! provided by Paul Thomas - pault@gcc.gnu.org
7
 
8
Program matmul_1
9
  integer, parameter                                :: N = 5
10
  integer, parameter                                :: T = 4
11
  integer                                           :: i
12
  real(kind=T), dimension(:,:), allocatable         :: a, b, c
13
  real(kind=T), dimension(N,N)                      :: x, y, z
14
 
15
  allocate (a(2*N, N), b(N, N), c(2*N, N))
16
 
17
  do i = 1, 2*N
18
    a(i, :) = real (i)
19
  end do
20
  b = 4.0_T
21
 
22
  do i = 1, N
23
    x(i, :) = real (i)
24
  end do
25
  y = 2.0_T
26
 
27
!                           whole array
28
 
29
  z = 0.0_T
30
  z = matmul (x, y)
31
  if (sum (z) /= 750.0_T) call abort ()
32
 
33
!                           array sections
34
 
35
  c = 0.0_T
36
  c(1:3,1:2) = matmul (a(7:9,3:N), b(3:N,3:4))
37
  if (sum (c) /= 576.0_T) call abort ()
38
 
39
!                           uses a temp
40
 
41
  c = 0.0_T
42
  c = matmul (a, b + x)
43
  if (sum (c) /= 9625.0_T) call abort ()
44
 
45
!                           returns to a temp
46
 
47
  c = 0.0_T
48
  c = a + matmul (a, b)
49
  if (sum (c) /= 5775.0_T) call abort ()
50
 
51
  deallocate (a, b, c)
52
 
53
end program matmul_1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.