Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.6 kB)

1
      Subroutine sym7gen( ntot, m, a, b )
2
! ----------------------------------------------------------------------
3
! --- sym7gen generates the 4 upper diagonals of a 7-diagonal symmetric
4
!     matrix to be solved by a GC iterative solver. Also the RHS, b is
5
!     generated.
6
!     Real(l_) a(m:3)  : Matrix to be generated (local part, upper diag).
7
!     Real(l_) b(ntot) : Right hand side (local part in global array).
8
! ----------------------------------------------------------------------
9
      Use                    numerics
10
      Use                    mpi_module
11
      Use                    ran_module
12
      Implicit               None
13

    
14
      Integer             :: m, ntot
15
      Real(l_)            :: a(m,0:3)
16
      Real(l_)            :: b(ntot)
17

    
18
      Integer             :: i
19
      Real(l_)            :: offdg
20
! ----------------------------------------------------------------------
21
      a = 0.0_l_
22
      b = 0.0_l_
23
      x1 = 2005 + me; x2 = 2005 - 2*me             !<-- Set random seeds.
24
      Call rinit
25
      If ( la1 <= ua1 ) Call ranfil( a(la1,1), ua1 - la1 + 1 )   
26
      If ( la2 <= ua2 ) Call ranfil( a(la2,2), ua2 - la2 + 1 )   
27
      If ( la3 <= ua3 ) Call ranfil( a(la3,3), ua3 - la3 + 1 )   
28
      Do i = 1, m
29
         offdg  = Sum( a(i,1:3) )
30
         a(i,0) = 2.0_l_*offdg
31
      End Do
32
      Do i = 1, m
33
         If ( a(i,0) > 0.0_l_ ) a(i,1:3) = -a(i,1:3)/a(i,0)
34
         a(i,0)   = 1.0_l_
35
         b(glb+i) = Sum( a(i,1:3) ) + Sum( a(i,0:3) )
36
      End Do
37
! ----------------------------------------------------------------------
38
      End Subroutine sym7gen