ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
pdlasizesyevx.f
Go to the documentation of this file.
1 *
2 *
3  SUBROUTINE pdlasizesyevx( WKNOWN, RANGE, N, DESCA, VL, VU, IL, IU,
4  $ ISEED, WIN, MAXSIZE, VECSIZE, VALSIZE )
5 *
6 *
7 * -- ScaLAPACK routine (version 1.7) --
8 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
9 * and University of California, Berkeley.
10 * May 1, 1997
11 *
12 * .. Scalar Arguments ..
13  LOGICAL WKNOWN
14  CHARACTER RANGE
15  INTEGER IL, IU, MAXSIZE, N, VALSIZE, VECSIZE
16  DOUBLE PRECISION VL, VU
17 * ..
18 * .. Array Arguments ..
19  INTEGER DESCA( * ), ISEED( 4 )
20  DOUBLE PRECISION WIN( * )
21 * ..
22 *
23 * Purpose
24 * =======
25 *
26 * PDLASIZESYEVX computes the amount of memory needed by PDSYEVX
27 * to ensure:
28 * 1) Orthogonal Eigenvectors
29 * 2) Eigenvectors
30 * 3) Eigenvalues
31 *
32 * Arguments
33 * =========
34 *
35 * WKNOWN (global input) INTEGER
36 * .FALSE.: WIN does not contain the eigenvalues
37 * .TRUE.: WIN does contain the eigenvalues
38 *
39 * RANGE (global input) CHARACTER*1
40 * = 'A': all eigenvalues will be found.
41 * = 'V': all eigenvalues in the interval [VL,VU]
42 * will be found.
43 * = 'I': the IL-th through IU-th eigenvalues will be found.
44 *
45 * N (global input) INTEGER
46 * Size of the matrix to be tested. (global size)
47 *
48 * DESCA (global input) INTEGER array dimension ( DLEN_ )
49 *
50 * VL (global input/output ) DOUBLE PRECISION
51 * If RANGE='V', the lower bound of the interval to be searched
52 * for eigenvalues. Not referenced if RANGE = 'A' or 'I'.
53 * If VL > VU, RANGE='V' and WKNOWN = .TRUE., VL is set
54 * to a random value near an entry in WIN
55 *
56 * VU (global input/output ) DOUBLE PRECISION
57 * If RANGE='V', the upper bound of the interval to be searched
58 * for eigenvalues. Not referenced if RANGE = 'A' or 'I'.
59 * If VL > VU, RANGE='V' and WKNOWN = .TRUE., VU is set
60 * to a random value near an entry in WIN
61 *
62 * IL (global input/output ) INTEGER
63 * If RANGE='I', the index (from smallest to largest) of the
64 * smallest eigenvalue to be returned. IL >= 1.
65 * Not referenced if RANGE = 'A' or 'V'.
66 * If IL < 0, RANGE='I' and WKNOWN = .TRUE., IL is set
67 * to a random value from 1 to N
68 *
69 * IU (global input/output ) INTEGER
70 * If RANGE='I', the index (from smallest to largest) of the
71 * largest eigenvalue to be returned. min(IL,N) <= IU <= N.
72 * Not referenced if RANGE = 'A' or 'V'.
73 * If IU < 0, RANGE='I' and WKNOWN = .TRUE., IU is set
74 * to a random value from IL to N
75 *
76 * ISEED (global input/output) INTEGER array, dimension (4)
77 * On entry, the seed of the random number generator; the array
78 * elements must be between 0 and 4095, and ISEED(4) must be
79 * odd.
80 * On exit, the seed is updated.
81 * ISEED is not touched unless IL, IU, VL or VU are modified.
82 *
83 * WIN (global input) DOUBLE PRECISION array, dimension (N)
84 * If WKNOWN=1, WIN contains the eigenvalues of the matrix.
85 *
86 * MAXSIZE (global output) INTEGER
87 * Workspace required to guarantee that PDSYEVX will return
88 * orthogonal eigenvectors. IF WKNOWN=0, MAXSIZE is set to a
89 * a value which guarantees orthogonality no matter what the
90 * spectrum is. If WKNOWN=1, MAXSIZE is set to a value which
91 * guarantees orthogonality on a matrix with eigenvalues given
92 * by WIN.
93 *
94 * VECSIZE (global output) INTEGER
95 * Workspace required to guarantee that PDSYEVX
96 * will compute eigenvectors.
97 *
98 * VALSIZE (global output) INTEGER
99 * Workspace required to guarantee that PDSYEVX
100 * will compute eigenvalues.
101 *
102 *
103 * .. Parameters ..
104  INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
105  $ mb_, nb_, rsrc_, csrc_, lld_
106  parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
107  $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
108  $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
109  DOUBLE PRECISION TWENTY
110  parameter( twenty = 20.0d0 )
111 * ..
112 * .. Local Scalars ..
113 *
114  INTEGER CLUSTERSIZE, I, ILMIN, IUMAX, MAXCLUSTERSIZE,
115  $ mq0, mycol, myil, myiu, myrow, nb, neig, nn,
116  $ np0, npcol, nprow
117  DOUBLE PRECISION ANORM, EPS, ORFAC, SAFMIN, VLMIN, VUMAX
118 * ..
119 * .. External Functions ..
120 *
121 *
122  LOGICAL LSAME
123  INTEGER ICEIL, NUMROC
124  DOUBLE PRECISION DLARAN, PDLAMCH
125  EXTERNAL lsame, iceil, numroc, dlaran, pdlamch
126 * ..
127 * .. External Subroutines ..
128  EXTERNAL blacs_gridinfo
129 * ..
130 * .. Intrinsic Functions ..
131  INTRINSIC abs, dble, int, max
132 * ..
133 * .. Executable Statements ..
134 * This is just to keep ftnchek happy
135  IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
136  $ rsrc_.LT.0 )RETURN
137 *
138  orfac = 1.0d-3
139 *
140 *
141  CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
142  eps = pdlamch( desca( ctxt_ ), 'Precision' )
143  safmin = pdlamch( desca( ctxt_ ), 'Safe Minimum' )
144  nb = desca( mb_ )
145  nn = max( n, nb, 2 )
146  np0 = numroc( nn, nb, 0, 0, nprow )
147 *
148  valsize = 5*n + max( 5*nn, nb*( np0+1 ) )
149 *
150  IF( wknown ) THEN
151  anorm = safmin / eps
152  IF( n.GE.1 )
153  $ anorm = max( abs( win( 1 ) ), abs( win( n ) ), anorm )
154 *
155  IF( lsame( range, 'I' ) ) THEN
156  IF( il.LT.0 )
157  $ il = int( dlaran( iseed )*dble( n ) ) + 1
158  IF( iu.LT.0 )
159  $ iu = int( dlaran( iseed )*dble( n-il ) ) + il
160  IF( n.EQ.0 )
161  $ iu = 0
162  ELSE IF( lsame( range, 'V' ) ) THEN
163  IF( vl.GT.vu ) THEN
164  myil = int( dlaran( iseed )*dble( n ) ) + 1
165  myiu = int( dlaran( iseed )*dble( n-myil ) ) + myil
166  vl = win( myil ) + twenty*eps*abs( win( myil ) )
167  vu = win( myiu ) + twenty*eps*abs( win( myiu ) )
168  vu = max( vu, vl+eps*twenty*abs( vl )+safmin )
169  END IF
170  END IF
171 *
172  END IF
173  IF( lsame( range, 'V' ) ) THEN
174 *
175 * Compute ILMIN, IUMAX (based on VL, VU and WIN)
176 *
177  IF( wknown ) THEN
178  vlmin = vl - twenty*eps*anorm
179  vumax = vu + twenty*eps*anorm
180  ilmin = 1
181  iumax = 0
182  DO 10 i = 1, n
183  IF( win( i ).LT.vlmin )
184  $ ilmin = ilmin + 1
185  IF( win( i ).LT.vumax )
186  $ iumax = iumax + 1
187  10 CONTINUE
188  ELSE
189  ilmin = 1
190  iumax = n
191  END IF
192  ELSE IF( lsame( range, 'I' ) ) THEN
193  ilmin = il
194  iumax = iu
195  ELSE IF( lsame( range, 'A' ) ) THEN
196  ilmin = 1
197  iumax = n
198  END IF
199 *
200  neig = iumax - ilmin + 1
201 *
202  mq0 = numroc( max( neig, nb, 2 ), nb, 0, 0, npcol )
203  vecsize = 5*n + max( 5*nn, np0*mq0+2*nb*nb ) +
204  $ iceil( neig, nprow*npcol )*nn
205 *
206  IF( wknown ) THEN
207  clustersize = 1
208  maxclustersize = 1
209  DO 20 i = ilmin + 1, iumax
210  IF( ( win( i )-win( i-1 ) ).LT.orfac*2*anorm ) THEN
211  clustersize = clustersize + 1
212  IF( clustersize.GT.maxclustersize )
213  $ maxclustersize = clustersize
214  ELSE
215  clustersize = 1
216  END IF
217  20 CONTINUE
218  IF( clustersize.GT.maxclustersize )
219  $ maxclustersize = clustersize
220  ELSE
221  maxclustersize = n
222  END IF
223 *
224  maxsize = vecsize + max( ( maxclustersize-1 ), 0 )*n
225 *
226 *
227  RETURN
228 *
229 * End of PDLASIZESYEVX
230 *
231  END
max
#define max(A, B)
Definition: pcgemr.c:180
pdlasizesyevx
subroutine pdlasizesyevx(WKNOWN, RANGE, N, DESCA, VL, VU, IL, IU, ISEED, WIN, MAXSIZE, VECSIZE, VALSIZE)
Definition: pdlasizesyevx.f:5