OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
pdbmatgen.f
Go to the documentation of this file.
1 SUBROUTINE pdbmatgen( ICTXT, AFORM, AFORM2, BWL, BWU, N,
2 $ MB, NB, A,
3 $ LDA, IAROW, IACOL, ISEED,
4 $ MYROW, MYCOL, NPROW, NPCOL )
5*
6*
7*
8* -- ScaLAPACK routine (version 1.7) --
9* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
10* and University of California, Berkeley.
11* November 15, 1997
12*
13* .. Scalar Arguments ..
14* .. Scalar Arguments ..
15 CHARACTER*1 AFORM, AFORM2
16 INTEGER IACOL, IAROW, ICTXT,
17 $ ISEED, LDA, MB, MYCOL, MYROW, N,
18 $ nb, npcol, nprow, bwl, bwu
19* ..
20* .. Array Arguments ..
21 DOUBLE PRECISION A( LDA, * )
22* ..
23*
24* Purpose
25* =======
26*
27* PDBMATGEN : Parallel Real Double precision Band MATrix GENerator.
28* (Re)Generate a distributed Band matrix A (or sub-matrix of A).
29*
30* Arguments
31* =========
32*
33* ICTXT (global input) INTEGER
34* The BLACS context handle, indicating the global context of
35* the operation. The context itself is global.
36*
37* AFORM (global input) CHARACTER*1
38* if AFORM = 'L' : A is returned as a symmetric lower
39* triangular matrix, and is diagonally dominant.
40* if AFORM = 'U' : A is returned as a symmetric upper
41* triangular matrix, and is diagonally dominant.
42* if AFORM = 'G' : A is returned as a general matrix.
43* if AFORM = 'T' : A is returned as a general matrix in
44* tridiagonal-compatible form.
45*
46* AFORM2 (global input) CHARACTER*1
47* if the matrix is general:
48* if AFORM2 = 'D' : A is returned diagonally dominant.
49* if AFORM2 != 'D' : A is not returned diagonally dominant.
50* if the matrix is symmetric or hermitian:
51* if AFORM2 = 'T' : A is returned in tridiagonally-compatible
52* form (a transpose form).
53* if AFORM2 != 'T' : A is returned in banded-compatible form.
54*
55* M (global input) INTEGER
56* The number of nonzero rows in the generated distributed
57* band matrix.
58*
59* N (global input) INTEGER
60* The number of columns in the generated distributed
61* matrix.
62*
63* MB (global input) INTEGER
64* The row blocking factor of the distributed matrix A.
65*
66* NB (global input) INTEGER
67* The column blocking factor of the distributed matrix A.
68*
69* A (local output) DOUBLE PRECISION, pointer into the local
70* memory to an array of dimension ( LDA, * ) containing the
71* local pieces of the distributed matrix.
72*
73* LDA (local input) INTEGER
74* The leading dimension of the array containing the local
75* pieces of the distributed matrix A.
76*
77* IAROW (global input) INTEGER
78* The row processor coordinate which holds the first block
79* of the distributed matrix A.
80* A( DIAG_INDEX, I ) = A( DIAG_INDEX, I ) + BWL+BWU
81*
82* IACOL (global input) INTEGER
83* The column processor coordinate which holds the first
84* block of the distributed matrix A.
85*
86* ISEED (global input) INTEGER
87* The seed number to generate the distributed matrix A.
88*
89* MYROW (local input) INTEGER
90* The row process coordinate of the calling process.
91*
92* MYCOL (local input) INTEGER
93* The column process coordinate of the calling process.
94*
95* NPROW (global input) INTEGER
96* The number of process rows in the grid.
97*
98* NPCOL (global input) INTEGER
99* The number of process columns in the grid.
100*
101* Notes
102* =====
103*
104* This code is a simple wrapper around PDMATGEN, for band matrices.
105*
106* =====================================================================
107*
108* Code Developer: Andrew J. Cleary, University of Tennessee.
109* Current address: Lawrence Livermore National Labs.
110* This version released: August, 2001.
111*
112* =====================================================================
113*
114* ..
115* .. Parameters ..
116 DOUBLE PRECISION ONE, ZERO
117 PARAMETER ( ONE = 1.0d+0 )
118 parameter( zero = 0.0d+0 )
119* ..
120* .. Local Scalars ..
121 INTEGER DIAG_INDEX, I, J, M_MATGEN, NQ, N_MATGEN,
122 $ START_INDEX
123* ..
124* .. External Subroutines ..
125 EXTERNAL pdmatgen
126* ..
127* .. External Functions ..
128 LOGICAL LSAME
129 INTEGER ICEIL, NUMROC
130 EXTERNAL ICEIL, NUMROC, LSAME
131* ..
132* .. Executable Statements ..
133*
134*
135 IF( lsame( aform, 'L' ).OR.lsame( aform, 'u' ) ) THEN
136 M_MATGEN = BWL + 1
137 N_MATGEN = N
138 START_INDEX = 1
139 IF( LSAME( AFORM, 'l' ) ) THEN
140 DIAG_INDEX = 1
141 ELSE
142 DIAG_INDEX = BWL + 1
143 ENDIF
144 ELSE
145 M_MATGEN = BWL + BWU + 1
146 N_MATGEN = N
147 DIAG_INDEX = BWU + 1
148 START_INDEX = 1
149 ENDIF
150*
151 NQ = NUMROC( N, NB, MYCOL, IACOL, NPCOL )
152*
153*
154* Generate a random matrix initially
155*
156 IF( LSAME( AFORM, 't.OR.' )
157 $ ( LSAME( AFORM2, 't' ) ) ) THEN
158*
159 CALL PDMATGEN( ICTXT, 't', 'n',
160 $ N_MATGEN, M_MATGEN,
161 $ NB, M_MATGEN, A( START_INDEX, 1 ),
162 $ LDA, IAROW, IACOL,
163 $ ISEED, 0, NQ, 0, M_MATGEN,
164 $ MYCOL, MYROW, NPCOL, NPROW )
165*
166 ELSE
167*
168 CALL PDMATGEN( ICTXT, 'n', 'n',
169 $ M_MATGEN, N_MATGEN,
170 $ M_MATGEN, NB, A( START_INDEX, 1 ),
171 $ LDA, IAROW, IACOL,
172 $ ISEED, 0, M_MATGEN, 0, NQ,
173 $ MYROW, MYCOL, NPROW, NPCOL )
174*
175* Zero out padding at tops of columns
176*
177 DO 1000 J=1,NB
178*
179 DO 2000 I=1, LDA-M_MATGEN
180*
181* Indexing goes negative; BMATGEN assumes that space
182* has been preallocated above the first column as it
183* has to be if the matrix is to be input to
184* Scalapack's band solvers.
185*
186 A( I-LDA+M_MATGEN, J ) = ZERO
187*
188 2000 CONTINUE
189*
190 1000 CONTINUE
191*
192 ENDIF
193*
194 IF( LSAME( AFORM2, 'd.OR.' )
195 $ ( LSAME( AFORM, 'l.OR.' )LSAME( AFORM, 'u' ) ) ) THEN
196*
197* Loop over diagonal elements stored on this processor.
198*
199*
200 DO 330 I=1, NQ
201 IF( LSAME( AFORM, 't.OR.' )
202 $ ( LSAME( AFORM2, 't' ) ) ) THEN
203.EQ. IF( NPROW 1 ) THEN
204 A( I, DIAG_INDEX ) = A( I, DIAG_INDEX )
205 $ + DBLE( BWL+BWU+1 )
206 ENDIF
207 ELSE
208.EQ. IF( NPROW 1 ) THEN
209 A( DIAG_INDEX, I ) = A( DIAG_INDEX, I )
210 $ + DBLE( BWL+BWU+1 )
211 ENDIF
212 END IF
213 330 CONTINUE
214*
215*
216 ELSE
217*
218* Must add elements to keep condition of matrix in check
219*
220 DO 380 I=1, NQ
221*
222.EQ. IF( NPROW 1 ) THEN
223*
224.EQ. IF( MOD(I+MYCOL*NB,2) 1 ) THEN
225 A( DIAG_INDEX+1, I ) = A( DIAG_INDEX+1, I )
226 $ + DBLE( BWL+BWU+1 )
227*
228 ELSE
229*
230 A( DIAG_INDEX-1, I ) = A( DIAG_INDEX-1, I )
231 $ + DBLE( BWL+BWU+1 )
232 ENDIF
233*
234 ENDIF
235*
236 380 CONTINUE
237*
238 END IF
239*
240 RETURN
241*
242* End of PDBMATGEN
243*
244 END
subroutine pdmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
Definition pdmatgen.f:4
subroutine pdbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
Definition pdbmatgen.f:5