LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sdisna.f
Go to the documentation of this file.
1*> \brief \b SDISNA
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SDISNA + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sdisna.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sdisna.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sdisna.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SDISNA( JOB, M, N, D, SEP, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER JOB
23* INTEGER INFO, M, N
24* ..
25* .. Array Arguments ..
26* REAL D( * ), SEP( * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> SDISNA computes the reciprocal condition numbers for the eigenvectors
36*> of a real symmetric or complex Hermitian matrix or for the left or
37*> right singular vectors of a general m-by-n matrix. The reciprocal
38*> condition number is the 'gap' between the corresponding eigenvalue or
39*> singular value and the nearest other one.
40*>
41*> The bound on the error, measured by angle in radians, in the I-th
42*> computed vector is given by
43*>
44*> SLAMCH( 'E' ) * ( ANORM / SEP( I ) )
45*>
46*> where ANORM = 2-norm(A) = max( abs( D(j) ) ). SEP(I) is not allowed
47*> to be smaller than SLAMCH( 'E' )*ANORM in order to limit the size of
48*> the error bound.
49*>
50*> SDISNA may also be used to compute error bounds for eigenvectors of
51*> the generalized symmetric definite eigenproblem.
52*> \endverbatim
53*
54* Arguments:
55* ==========
56*
57*> \param[in] JOB
58*> \verbatim
59*> JOB is CHARACTER*1
60*> Specifies for which problem the reciprocal condition numbers
61*> should be computed:
62*> = 'E': the eigenvectors of a symmetric/Hermitian matrix;
63*> = 'L': the left singular vectors of a general matrix;
64*> = 'R': the right singular vectors of a general matrix.
65*> \endverbatim
66*>
67*> \param[in] M
68*> \verbatim
69*> M is INTEGER
70*> The number of rows of the matrix. M >= 0.
71*> \endverbatim
72*>
73*> \param[in] N
74*> \verbatim
75*> N is INTEGER
76*> If JOB = 'L' or 'R', the number of columns of the matrix,
77*> in which case N >= 0. Ignored if JOB = 'E'.
78*> \endverbatim
79*>
80*> \param[in] D
81*> \verbatim
82*> D is REAL array, dimension (M) if JOB = 'E'
83*> dimension (min(M,N)) if JOB = 'L' or 'R'
84*> The eigenvalues (if JOB = 'E') or singular values (if JOB =
85*> 'L' or 'R') of the matrix, in either increasing or decreasing
86*> order. If singular values, they must be non-negative.
87*> \endverbatim
88*>
89*> \param[out] SEP
90*> \verbatim
91*> SEP is REAL array, dimension (M) if JOB = 'E'
92*> dimension (min(M,N)) if JOB = 'L' or 'R'
93*> The reciprocal condition numbers of the vectors.
94*> \endverbatim
95*>
96*> \param[out] INFO
97*> \verbatim
98*> INFO is INTEGER
99*> = 0: successful exit.
100*> < 0: if INFO = -i, the i-th argument had an illegal value.
101*> \endverbatim
102*
103* Authors:
104* ========
105*
106*> \author Univ. of Tennessee
107*> \author Univ. of California Berkeley
108*> \author Univ. of Colorado Denver
109*> \author NAG Ltd.
110*
111*> \ingroup disna
112*
113* =====================================================================
114 SUBROUTINE sdisna( JOB, M, N, D, SEP, INFO )
115*
116* -- LAPACK computational routine --
117* -- LAPACK is a software package provided by Univ. of Tennessee, --
118* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119*
120* .. Scalar Arguments ..
121 CHARACTER JOB
122 INTEGER INFO, M, N
123* ..
124* .. Array Arguments ..
125 REAL D( * ), SEP( * )
126* ..
127*
128* =====================================================================
129*
130* .. Parameters ..
131 REAL ZERO
132 parameter( zero = 0.0e+0 )
133* ..
134* .. Local Scalars ..
135 LOGICAL DECR, EIGEN, INCR, LEFT, RIGHT, SING
136 INTEGER I, K
137 REAL ANORM, EPS, NEWGAP, OLDGAP, SAFMIN, THRESH
138* ..
139* .. External Functions ..
140 LOGICAL LSAME
141 REAL SLAMCH
142 EXTERNAL lsame, slamch
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC abs, max, min
146* ..
147* .. External Subroutines ..
148 EXTERNAL xerbla
149* ..
150* .. Executable Statements ..
151*
152* Test the input arguments
153*
154 info = 0
155 eigen = lsame( job, 'E' )
156 left = lsame( job, 'L' )
157 right = lsame( job, 'R' )
158 sing = left .OR. right
159 IF( eigen ) THEN
160 k = m
161 ELSE IF( sing ) THEN
162 k = min( m, n )
163 END IF
164 IF( .NOT.eigen .AND. .NOT.sing ) THEN
165 info = -1
166 ELSE IF( m.LT.0 ) THEN
167 info = -2
168 ELSE IF( k.LT.0 ) THEN
169 info = -3
170 ELSE
171 incr = .true.
172 decr = .true.
173 DO 10 i = 1, k - 1
174 IF( incr )
175 $ incr = incr .AND. d( i ).LE.d( i+1 )
176 IF( decr )
177 $ decr = decr .AND. d( i ).GE.d( i+1 )
178 10 CONTINUE
179 IF( sing .AND. k.GT.0 ) THEN
180 IF( incr )
181 $ incr = incr .AND. zero.LE.d( 1 )
182 IF( decr )
183 $ decr = decr .AND. d( k ).GE.zero
184 END IF
185 IF( .NOT.( incr .OR. decr ) )
186 $ info = -4
187 END IF
188 IF( info.NE.0 ) THEN
189 CALL xerbla( 'SDISNA', -info )
190 RETURN
191 END IF
192*
193* Quick return if possible
194*
195 IF( k.EQ.0 )
196 $ RETURN
197*
198* Compute reciprocal condition numbers
199*
200 IF( k.EQ.1 ) THEN
201 sep( 1 ) = slamch( 'O' )
202 ELSE
203 oldgap = abs( d( 2 )-d( 1 ) )
204 sep( 1 ) = oldgap
205 DO 20 i = 2, k - 1
206 newgap = abs( d( i+1 )-d( i ) )
207 sep( i ) = min( oldgap, newgap )
208 oldgap = newgap
209 20 CONTINUE
210 sep( k ) = oldgap
211 END IF
212 IF( sing ) THEN
213 IF( ( left .AND. m.GT.n ) .OR. ( right .AND. m.LT.n ) ) THEN
214 IF( incr )
215 $ sep( 1 ) = min( sep( 1 ), d( 1 ) )
216 IF( decr )
217 $ sep( k ) = min( sep( k ), d( k ) )
218 END IF
219 END IF
220*
221* Ensure that reciprocal condition numbers are not less than
222* threshold, in order to limit the size of the error bound
223*
224 eps = slamch( 'E' )
225 safmin = slamch( 'S' )
226 anorm = max( abs( d( 1 ) ), abs( d( k ) ) )
227 IF( anorm.EQ.zero ) THEN
228 thresh = eps
229 ELSE
230 thresh = max( eps*anorm, safmin )
231 END IF
232 DO 30 i = 1, k
233 sep( i ) = max( sep( i ), thresh )
234 30 CONTINUE
235*
236 RETURN
237*
238* End of SDISNA
239*
240 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sdisna(job, m, n, d, sep, info)
SDISNA
Definition sdisna.f:115