7
8
9
10
11
12
13
14 INTEGER IPOSTPAD, IPREPAD, ISIZEHEEVD, ISIZEHEEVX,
15 $ ISIZESUBTST, ISIZETST, RSIZECHK, RSIZEHEEVD,
16 $ RSIZEHEEVX, RSIZEQTQ, RSIZESUBTST, RSIZETST,
17 $ SIZEHEEVD, SIZEHEEVX, SIZEMQRLEFT,
18 $ SIZEMQRRIGHT, SIZEQRF, SIZESUBTST, SIZETMS,
19 $ SIZETST
20
21
22 INTEGER DESCA( * )
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
75 $ MB_, NB_, RSRC_, CSRC_, LLD_
76 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
77 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
78 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
79
80
81 INTEGER ANB, CSRC_A, IACOL, IAROW, ICOFFA, ICTXT,
82 $ IROFFA, LCM, LCMQ, LDA, MQ0, MYCOL, MYROW, N,
83 $ NB, NEIG, NHETRD_LWOPT, NN, NNP, NP, NP0,
84 $ NPCOL, NPROW, NPS, NQ, RSRC_A, SIZECHK,
85 $ SIZEQTQ, SQNPC
86
87
88 INTEGER ICEIL, ILCM, INDXG2P, NUMROC, PJLAENV
90
91
92
93
94 EXTERNAL blacs_gridinfo
95
96
97 INTRINSIC dble, int,
max, sqrt
98
99
100 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
101 $ rsrc_.LT.0 )RETURN
102
103 n = desca( m_ )
104 nb = desca( mb_ )
105 rsrc_a = desca( rsrc_ )
106 csrc_a = desca( csrc_ )
107
108 lda = desca( lld_ )
109 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
110
111 lcm =
ilcm( nprow, npcol )
112 lcmq = lcm / npcol
113 iroffa = 0
114 icoffa = 0
115 iarow =
indxg2p( 1, nb, myrow, rsrc_a, nprow )
116 iacol =
indxg2p( 1, nb, mycol, csrc_a, npcol )
117 np =
numroc( n+iroffa, nb, myrow, iarow, nprow )
118 nq =
numroc( n+icoffa, nb, mycol, iacol, npcol )
119 sizemqrleft =
max( ( nb*( nb-1 ) ) / 2, ( np+nq )*nb ) + nb*nb
120 sizemqrright =
max( ( nb*( nb-1 ) ) / 2,
122 $ npcol ), nb, 0, 0, lcmq ), np ) )*nb ) + nb*nb
123 sizeqrf = nb*np + nb*nq + nb*nb
124 sizetms = ( lda+1 )*
max( 1, nq ) +
125 $
max( sizemqrleft, sizemqrright, sizeqrf )
126
127 np0 =
numroc( n, desca( mb_ ), 0, 0, nprow )
128 mq0 =
numroc( n, desca( nb_ ), 0, 0, npcol )
129 sizeqtq = 0
130 sizechk = 0
131 rsizeqtq = 2 +
max( desca( mb_ ), 2 )*( 2*np0+mq0 )
132 rsizechk =
numroc( n, desca( nb_ ), mycol, 0, npcol )
133
134 neig = n
136 np0 =
numroc( nn, nb, 0, 0, nprow )
137 mq0 =
numroc(
max( neig, nb, 2 ), nb, 0, 0, npcol )
138 sizeheevx = n + ( np0+mq0+nb )*nb
139 rsizeheevx = 4*n +
max( 5*nn, np0*mq0 ) +
140 $
iceil( neig, nprow*npcol )*nn
141 nnp =
max( n, nprow*npcol+1, 4 )
142 isizeheevx = 6*nnp
143
144 ictxt = desca( ctxt_ )
145 anb =
pjlaenv( ictxt, 3,
'PZHETTRD',
'L', 0, 0, 0, 0 )
146 sqnpc = int( sqrt( dble( nprow*npcol ) ) )
147 nps =
max(
numroc( n, 1, 0, 0, sqnpc ), 2*anb )
148 nhetrd_lwopt = 2*( anb+1 )*( 4*nps+2 ) + ( nps+2 )*nps
149
150 sizeheevx =
max( sizeheevx, n+nhetrd_lwopt )
151
152 sizeheevd = sizeheevx
153 rsizeheevd = 7*n + 3*np0*mq0
154 isizeheevd = 7*n + 8*npcol + 2
155 sizesubtst =
max( sizetms, sizeqtq, sizechk, sizeheevx,
156 $ sizeheevd ) + iprepad + ipostpad
157 rsizesubtst =
max( rsizeheevx, rsizeheevd, rsizeqtq, rsizechk ) +
158 $ iprepad + ipostpad
159 isizesubtst =
max( isizeheevx, isizeheevd ) + iprepad + ipostpad
160
161
162
163
164 sizetst = 3*( lda*np+iprepad+ipostpad ) + sizesubtst
165
166
167
168 rsizetst = 4*( n+iprepad+ipostpad ) + rsizesubtst
169
170
171
172 isizetst = n + 2*nprow*npcol + 2*( iprepad+ipostpad ) +
173 $ isizesubtst
174
175 RETURN
integer function iceil(inum, idenom)
integer function ilcm(m, n)
integer function indxg2p(indxglob, nb, iproc, isrcproc, nprocs)
integer function numroc(n, nb, iproc, isrcproc, nprocs)
integer function pjlaenv(ictxt, ispec, name, opts, n1, n2, n3, n4)