3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DDISNA + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ddisna.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ddisna.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ddisna.f">
21 * SUBROUTINE DDISNA( JOB, M, N, D, SEP, INFO )
23 * .. Scalar Arguments ..
27 * .. Array Arguments ..
28 * DOUBLE PRECISION D( * ), SEP( * )
37 *> DDISNA computes the reciprocal condition numbers for the eigenvectors
38 *> of a real symmetric or complex Hermitian matrix or for the left or
39 *> right singular vectors of a general m-by-n matrix. The reciprocal
40 *> condition number is the 'gap' between the corresponding eigenvalue or
41 *> singular value and the nearest other one.
43 *> The bound on the error, measured by angle in radians, in the I-th
44 *> computed vector is given by
46 *> DLAMCH( 'E' ) * ( ANORM / SEP( I ) )
48 *> where ANORM = 2-norm(A) = max( abs( D(j) ) ). SEP(I) is not allowed
49 *> to be smaller than DLAMCH( 'E' )*ANORM in order to limit the size of
52 *> DDISNA may also be used to compute error bounds for eigenvectors of
53 *> the generalized symmetric definite eigenproblem.
62 *> Specifies for which problem the reciprocal condition numbers
63 *> should be computed:
64 *> = 'E': the eigenvectors of a symmetric/Hermitian matrix;
65 *> = 'L': the left singular vectors of a general matrix;
66 *> = 'R': the right singular vectors of a general matrix.
72 *> The number of rows of the matrix. M >= 0.
78 *> If JOB = 'L' or 'R', the number of columns of the matrix,
79 *> in which case N >= 0. Ignored if JOB = 'E'.
84 *> D is DOUBLE PRECISION array, dimension (M) if JOB = 'E'
85 *> dimension (min(M,N)) if JOB = 'L' or 'R'
86 *> The eigenvalues (if JOB = 'E') or singular values (if JOB =
87 *> 'L' or 'R') of the matrix, in either increasing or decreasing
88 *> order. If singular values, they must be non-negative.
93 *> SEP is DOUBLE PRECISION array, dimension (M) if JOB = 'E'
94 *> dimension (min(M,N)) if JOB = 'L' or 'R'
95 *> The reciprocal condition numbers of the vectors.
101 *> = 0: successful exit.
102 *> < 0: if INFO = -i, the i-th argument had an illegal value.
108 *> \author Univ. of Tennessee
109 *> \author Univ. of California Berkeley
110 *> \author Univ. of Colorado Denver
113 *> \date November 2011
115 *> \ingroup auxOTHERcomputational
117 * =====================================================================
118 SUBROUTINE DDISNA( JOB, M, N, D, SEP, INFO )
120 * -- LAPACK computational routine (version 3.4.0) --
121 * -- LAPACK is a software package provided by Univ. of Tennessee, --
122 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 * .. Scalar Arguments ..
129 * .. Array Arguments ..
130 DOUBLE PRECISION D( * ), SEP( * )
133 * =====================================================================
136 DOUBLE PRECISION ZERO
137 PARAMETER ( ZERO = 0.0D+0 )
139 * .. Local Scalars ..
140 LOGICAL DECR, EIGEN, INCR, LEFT, RIGHT, SING
142 DOUBLE PRECISION ANORM, EPS, NEWGAP, OLDGAP, SAFMIN, THRESH
144 * .. External Functions ..
146 DOUBLE PRECISION DLAMCH
147 EXTERNAL LSAME, DLAMCH
149 * .. Intrinsic Functions ..
150 INTRINSIC ABS, MAX, MIN
152 * .. External Subroutines ..
155 * .. Executable Statements ..
157 * Test the input arguments
160 EIGEN = LSAME( JOB, 'E' )
161 LEFT = LSAME( JOB, 'L' )
162 RIGHT = LSAME( JOB, 'R' )
163 SING = LEFT .OR. RIGHT
169 IF( .NOT.EIGEN .AND. .NOT.SING ) THEN
171 ELSE IF( M.LT.0 ) THEN
173 ELSE IF( K.LT.0 ) THEN
180 $ INCR = INCR .AND. D( I ).LE.D( I+1 )
182 $ DECR = DECR .AND. D( I ).GE.D( I+1 )
184 IF( SING .AND. K.GT.0 ) THEN
186 $ INCR = INCR .AND. ZERO.LE.D( 1 )
188 $ DECR = DECR .AND. D( K ).GE.ZERO
190 IF( .NOT.( INCR .OR. DECR ) )
194 CALL XERBLA( 'DDISNA', -INFO )
198 * Quick return if possible
203 * Compute reciprocal condition numbers
206 SEP( 1 ) = DLAMCH( 'O' )
208 OLDGAP = ABS( D( 2 )-D( 1 ) )
211 NEWGAP = ABS( D( I+1 )-D( I ) )
212 SEP( I ) = MIN( OLDGAP, NEWGAP )
218 IF( ( LEFT .AND. M.GT.N ) .OR. ( RIGHT .AND. M.LT.N ) ) THEN
220 $ SEP( 1 ) = MIN( SEP( 1 ), D( 1 ) )
222 $ SEP( K ) = MIN( SEP( K ), D( K ) )
226 * Ensure that reciprocal condition numbers are not less than
227 * threshold, in order to limit the size of the error bound
230 SAFMIN = DLAMCH( 'S' )
231 ANORM = MAX( ABS( D( 1 ) ), ABS( D( K ) ) )
232 IF( ANORM.EQ.ZERO ) THEN
235 THRESH = MAX( EPS*ANORM, SAFMIN )
238 SEP( I ) = MAX( SEP( I ), THRESH )