Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2a / .svn / text-base / matgen.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (2.5 kB)

1
      Subroutine matgen ( a, x, lda, ncol )
2
! ---------------------------------------------------------------------
3
! --- Matgen generates the entries of the matrix A and the vector x.
4
!     These values are chosen such that y = Ax and y = A'x can be
5
!     checked easily.
6
!     The structure of A and x are as follows:
7
!
8
!              A:       ncol                    x:
9
!              __________/\______________
10
!             /                          \
11
!            _                      _    _   _    _   \
12
!          /  |  1    1    1    1   . . . |   |  1 |   |
13
!          |  |  1    2    3    4   . . . |   |  1 |   |
14
!          /  |  1    3    5    7   . . . |   |  1 |   |
15
! sizes(0) \  |  1    4    7   10   . . . |   |  1 |   |
16
!          |  |  .    .    .    .   . . . |   |  1 |   |
17
!          \  |  .    .    .    .   . . . |   |  1 |   |
18
!          ------------------------------------------- |
19
!          /  |  1  m+1  2m-1 3m-2  . . . |   |  2 |    \ Each of the
20
!          |  |  1  m+2  2m+1 3m+1  . . . |   |  2 |    / processors
21
!          /  |  1  m+3  2m+3 3m+4  . . . |   |  2 |   |  contains a
22
! sizes(1) \  |  1  m+4  2m+5 3m+7  . . . |   |  2 |   |  strip of A
23
!          |  |  .   .     .   .    . . . |   |  2 |   |  sizes(i)*ncol
24
!          \  |  .   .     .   .    . . . |   |  2 |   |  and the full
25
!          ------------------------------------------- |  vector x.
26
!                           .                    .     |  
27
!                           .                    .     |
28
!                           .                    .     / 
29
! ---------------------------------------------------------------------
30
      Use                   dist_module
31
      Use                   numerics
32
      Integer            :: ncol
33
      Real(l_)           :: a(lda,ncol), x(ncol)
34

    
35
      Integer            :: i, im1, j, k, kbase
36
! ---------------------------------------------------------------------
37
!                                                     ** Make vector x.
38
      Do k = 1, nodes
39
         kbase = offset(k-1)
40
         Do i = 1, sizes(k-1)
41
            x(kbase+i) =  Dble( k )
42
         End Do
43
      End Do
44
! ---------------------------------------------------------------------
45
!                                                     ** Make matrix A.
46
      kbase = offset(me) - 1
47
      Do j = 1, ncol         
48
         Do i = 1, sizes(me)
49
            a(i,j) = (kbase + i)*(j - 1) + 1
50
         End Do
51
      End Do
52
! ---------------------------------------------------------------------
53
      End Subroutine matgen