OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
pclasizeheevx.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine pclasizeheevx (wknown, range, n, desca, vl, vu, il, iu, iseed, win, maxsize, vecsize, valsize)

Function/Subroutine Documentation

◆ pclasizeheevx()

subroutine pclasizeheevx ( logical wknown,
character range,
integer n,
integer, dimension( * ) desca,
real vl,
real vu,
integer il,
integer iu,
integer, dimension( 4 ) iseed,
real, dimension( * ) win,
integer maxsize,
integer vecsize,
integer valsize )

Definition at line 3 of file pclasizeheevx.f.

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 REAL VL, VU
17* ..
18* .. Array Arguments ..
19 INTEGER DESCA( * ), ISEED( 4 )
20 REAL WIN( * )
21* ..
22*
23* Purpose
24* =======
25*
26* PCLASIZEHEEVX computes the amount of memory needed by PCHEEVX
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 ) REAL
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 ) REAL
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) REAL 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 PCHEEVX 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 PCHEEVX
96* will compute eigenvectors.
97*
98* VALSIZE (global output) INTEGER
99* Workspace required to guarantee that PCHEEVX
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 REAL TWENTY
110 parameter( twenty = 20.0e0 )
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 REAL ANORM, EPS, ORFAC, SAFMIN, VLMIN, VUMAX
118* ..
119* .. External Functions ..
120*
121*
122 LOGICAL LSAME
123 INTEGER ICEIL, NUMROC
124 REAL PSLAMCH, SLARAN
125 EXTERNAL lsame, iceil, numroc, pslamch, slaran
126* ..
127* .. External Subroutines ..
128 EXTERNAL blacs_gridinfo
129* ..
130* .. Intrinsic Functions ..
131 INTRINSIC abs, int, max, real
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.0e-3
139*
140*
141 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
142 eps = pslamch( desca( ctxt_ ), 'Precision' )
143 safmin = pslamch( 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*nn + 4*n
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.LT. IF( IL0 )
157 $ IL = INT( SLARAN( ISEED )*REAL( N ) ) + 1
158.LT. IF( IU0 )
159 $ IU = INT( SLARAN( ISEED )*REAL( N-IL ) ) + IL
160.EQ. IF( N0 )
161 $ IU = 0
162 ELSE IF( LSAME( RANGE, 'v' ) ) THEN
163.GT. IF( VLVU ) THEN
164 MYIL = INT( SLARAN( ISEED )*REAL( N ) ) + 1
165 MYIU = INT( SLARAN( ISEED )*REAL( 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.LT. IF( WIN( I )VLMIN )
184 $ ILMIN = ILMIN + 1
185.LT. IF( WIN( I )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 = 4*N + MAX( 5*NN, NP0*MQ0 ) +
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.LT. IF( ( WIN( I )-WIN( I-1 ) )ORFAC*2*ANORM ) THEN
211 CLUSTERSIZE = CLUSTERSIZE + 1
212.GT. IF( CLUSTERSIZEMAXCLUSTERSIZE )
213 $ MAXCLUSTERSIZE = CLUSTERSIZE
214 ELSE
215 CLUSTERSIZE = 1
216 END IF
217 20 CONTINUE
218.GT. IF( CLUSTERSIZEMAXCLUSTERSIZE )
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 PCLASIZEHEEVX
230*
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
real function slaran(iseed)
SLARAN
Definition slaran.f:67
integer function iceil(inum, idenom)
Definition iceil.f:2
#define max(a, b)
Definition macros.h:21
subroutine blacs_gridinfo(cntxt, nprow, npcol, myrow, mycol)
Definition mpi.f:754
integer function numroc(n, nb, iproc, isrcproc, nprocs)
Definition mpi.f:786
real function pslamch(ictxt, cmach)
Definition pcblastst.f:7455