Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2cr / sym7mxv.f @ 0:839f52ef7657

History | View | Annotate | Download (2.2 kB)

1
      Subroutine sym7mxv( n1, n2, n3, m, a, al, x, y )
2
! ---------------------------------------------------------------------
3
! --- sym7mxv does a matrix-vector multiply of a banded symmetric
4
!     matrix originating from a 3-D finite difference scheme.
5
!     The upper diagonal part of matrix a is stored in a(*,0:3)
6
!     (including the main diagonal).
7
!     The strict upper diagonal parts are also given in transposed
8
!     form in al(m,1:3) for ease of calculation, while the vectors
9
!     x and y are present entirely for the same reason.
10
! ---------------------------------------------------------------------
11
      Use         numerics
12
      Use         floptime
13
      Use         mpi_module
14
      Implicit    None
15

    
16
      Integer  :: m, n1 ,n2 ,n3
17
      Real(l_) :: a(m,0:3), al(m,1:3), x(n1*n2*n3), y(n1*n2*n3)
18

    
19
      Integer  :: n12, ntot
20
! ---------------------------------------------------------------------
21
      n12  = n1*n2
22
      ntot = n12*n3
23

    
24
! --- Main diagonal and upper diagonals.
25

    
26
      Call MPI_Allgatherv( x(lb), m, rtyp, x, sizes, offset, rtyp,
27
     &                     comm, ierr )
28
      y(lb:gub) = a(1:m,0)*x(lb:gub)
29
      y(glb+la1:glb+ua1) = y(glb+la1:glb+ua1) + a(la1:ua1,1)*
30
     &                     x(glb+la1+1:glb+ua1+1)
31
      y(glb+la2:glb+ua2) = y(glb+la2:glb+ua2) + a(la2:ua2,2)*
32
     &                     x(glb+la2+n1:glb+ua2+n1)
33
      y(glb+la3:glb+ua3) = y(glb+la3:glb+ua3) + a(la3:ua3,3)*
34
     &                     x(glb+la3+n12:glb+ua3+n12)
35
! ---------------------------------------------------------------------
36
! --- Lower diagonals.
37

    
38
      y(glb+lb1:glb+ub1) = y(glb+lb1:glb+ub1) + al(lb1:ub1,1)*
39
     &                     x(glb+lb1-1:glb+ub1-1)
40
      y(glb+lb2:glb+ub2) = y(glb+lb2:glb+ub2) + al(lb2:ub2,2)*
41
     &                     x(glb+lb2-n1:glb+ub2-n1)
42
      y(glb+lb3:glb+ub3) = y(glb+lb3:glb+ub3) + al(lb3:ub3,3)*
43
     &                     x(glb+lb3-n12:glb+ub3-n12)
44
      Call MPI_Allgatherv( y(lb), m, rtyp, y, sizes, offset, rtyp,
45
     &                     comm, ierr )
46
! ---------------------------------------------------------------------
47
! --- Keep track of flops.
48

    
49
      flops = flops + 13*m - 4*( n12 + n1 + 1 )
50
! ---------------------------------------------------------------------
51
      End Subroutine sym7mxv