Annotation of rpl/lapack/lapack/zhpev.f, revision 1.8
1.8 ! bertrand 1: *> \brief <b> ZHPEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices</b>
! 2: *
! 3: * =========== DOCUMENTATION ===========
! 4: *
! 5: * Online html documentation available at
! 6: * http://www.netlib.org/lapack/explore-html/
! 7: *
! 8: *> \htmlonly
! 9: *> Download ZHPEV + dependencies
! 10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhpev.f">
! 11: *> [TGZ]</a>
! 12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhpev.f">
! 13: *> [ZIP]</a>
! 14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhpev.f">
! 15: *> [TXT]</a>
! 16: *> \endhtmlonly
! 17: *
! 18: * Definition:
! 19: * ===========
! 20: *
! 21: * SUBROUTINE ZHPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, RWORK,
! 22: * INFO )
! 23: *
! 24: * .. Scalar Arguments ..
! 25: * CHARACTER JOBZ, UPLO
! 26: * INTEGER INFO, LDZ, N
! 27: * ..
! 28: * .. Array Arguments ..
! 29: * DOUBLE PRECISION RWORK( * ), W( * )
! 30: * COMPLEX*16 AP( * ), WORK( * ), Z( LDZ, * )
! 31: * ..
! 32: *
! 33: *
! 34: *> \par Purpose:
! 35: * =============
! 36: *>
! 37: *> \verbatim
! 38: *>
! 39: *> ZHPEV computes all the eigenvalues and, optionally, eigenvectors of a
! 40: *> complex Hermitian matrix in packed storage.
! 41: *> \endverbatim
! 42: *
! 43: * Arguments:
! 44: * ==========
! 45: *
! 46: *> \param[in] JOBZ
! 47: *> \verbatim
! 48: *> JOBZ is CHARACTER*1
! 49: *> = 'N': Compute eigenvalues only;
! 50: *> = 'V': Compute eigenvalues and eigenvectors.
! 51: *> \endverbatim
! 52: *>
! 53: *> \param[in] UPLO
! 54: *> \verbatim
! 55: *> UPLO is CHARACTER*1
! 56: *> = 'U': Upper triangle of A is stored;
! 57: *> = 'L': Lower triangle of A is stored.
! 58: *> \endverbatim
! 59: *>
! 60: *> \param[in] N
! 61: *> \verbatim
! 62: *> N is INTEGER
! 63: *> The order of the matrix A. N >= 0.
! 64: *> \endverbatim
! 65: *>
! 66: *> \param[in,out] AP
! 67: *> \verbatim
! 68: *> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
! 69: *> On entry, the upper or lower triangle of the Hermitian matrix
! 70: *> A, packed columnwise in a linear array. The j-th column of A
! 71: *> is stored in the array AP as follows:
! 72: *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
! 73: *> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
! 74: *>
! 75: *> On exit, AP is overwritten by values generated during the
! 76: *> reduction to tridiagonal form. If UPLO = 'U', the diagonal
! 77: *> and first superdiagonal of the tridiagonal matrix T overwrite
! 78: *> the corresponding elements of A, and if UPLO = 'L', the
! 79: *> diagonal and first subdiagonal of T overwrite the
! 80: *> corresponding elements of A.
! 81: *> \endverbatim
! 82: *>
! 83: *> \param[out] W
! 84: *> \verbatim
! 85: *> W is DOUBLE PRECISION array, dimension (N)
! 86: *> If INFO = 0, the eigenvalues in ascending order.
! 87: *> \endverbatim
! 88: *>
! 89: *> \param[out] Z
! 90: *> \verbatim
! 91: *> Z is COMPLEX*16 array, dimension (LDZ, N)
! 92: *> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
! 93: *> eigenvectors of the matrix A, with the i-th column of Z
! 94: *> holding the eigenvector associated with W(i).
! 95: *> If JOBZ = 'N', then Z is not referenced.
! 96: *> \endverbatim
! 97: *>
! 98: *> \param[in] LDZ
! 99: *> \verbatim
! 100: *> LDZ is INTEGER
! 101: *> The leading dimension of the array Z. LDZ >= 1, and if
! 102: *> JOBZ = 'V', LDZ >= max(1,N).
! 103: *> \endverbatim
! 104: *>
! 105: *> \param[out] WORK
! 106: *> \verbatim
! 107: *> WORK is COMPLEX*16 array, dimension (max(1, 2*N-1))
! 108: *> \endverbatim
! 109: *>
! 110: *> \param[out] RWORK
! 111: *> \verbatim
! 112: *> RWORK is DOUBLE PRECISION array, dimension (max(1, 3*N-2))
! 113: *> \endverbatim
! 114: *>
! 115: *> \param[out] INFO
! 116: *> \verbatim
! 117: *> INFO is INTEGER
! 118: *> = 0: successful exit.
! 119: *> < 0: if INFO = -i, the i-th argument had an illegal value.
! 120: *> > 0: if INFO = i, the algorithm failed to converge; i
! 121: *> off-diagonal elements of an intermediate tridiagonal
! 122: *> form did not converge to zero.
! 123: *> \endverbatim
! 124: *
! 125: * Authors:
! 126: * ========
! 127: *
! 128: *> \author Univ. of Tennessee
! 129: *> \author Univ. of California Berkeley
! 130: *> \author Univ. of Colorado Denver
! 131: *> \author NAG Ltd.
! 132: *
! 133: *> \date November 2011
! 134: *
! 135: *> \ingroup complex16OTHEReigen
! 136: *
! 137: * =====================================================================
1.1 bertrand 138: SUBROUTINE ZHPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, RWORK,
139: $ INFO )
140: *
1.8 ! bertrand 141: * -- LAPACK driver routine (version 3.4.0) --
1.1 bertrand 142: * -- LAPACK is a software package provided by Univ. of Tennessee, --
143: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.8 ! bertrand 144: * November 2011
1.1 bertrand 145: *
146: * .. Scalar Arguments ..
147: CHARACTER JOBZ, UPLO
148: INTEGER INFO, LDZ, N
149: * ..
150: * .. Array Arguments ..
151: DOUBLE PRECISION RWORK( * ), W( * )
152: COMPLEX*16 AP( * ), WORK( * ), Z( LDZ, * )
153: * ..
154: *
155: * =====================================================================
156: *
157: * .. Parameters ..
158: DOUBLE PRECISION ZERO, ONE
159: PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
160: * ..
161: * .. Local Scalars ..
162: LOGICAL WANTZ
163: INTEGER IINFO, IMAX, INDE, INDRWK, INDTAU, INDWRK,
164: $ ISCALE
165: DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
166: $ SMLNUM
167: * ..
168: * .. External Functions ..
169: LOGICAL LSAME
170: DOUBLE PRECISION DLAMCH, ZLANHP
171: EXTERNAL LSAME, DLAMCH, ZLANHP
172: * ..
173: * .. External Subroutines ..
174: EXTERNAL DSCAL, DSTERF, XERBLA, ZDSCAL, ZHPTRD, ZSTEQR,
175: $ ZUPGTR
176: * ..
177: * .. Intrinsic Functions ..
178: INTRINSIC SQRT
179: * ..
180: * .. Executable Statements ..
181: *
182: * Test the input parameters.
183: *
184: WANTZ = LSAME( JOBZ, 'V' )
185: *
186: INFO = 0
187: IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
188: INFO = -1
189: ELSE IF( .NOT.( LSAME( UPLO, 'L' ) .OR. LSAME( UPLO, 'U' ) ) )
190: $ THEN
191: INFO = -2
192: ELSE IF( N.LT.0 ) THEN
193: INFO = -3
194: ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
195: INFO = -7
196: END IF
197: *
198: IF( INFO.NE.0 ) THEN
199: CALL XERBLA( 'ZHPEV ', -INFO )
200: RETURN
201: END IF
202: *
203: * Quick return if possible
204: *
205: IF( N.EQ.0 )
206: $ RETURN
207: *
208: IF( N.EQ.1 ) THEN
209: W( 1 ) = AP( 1 )
210: RWORK( 1 ) = 1
211: IF( WANTZ )
212: $ Z( 1, 1 ) = ONE
213: RETURN
214: END IF
215: *
216: * Get machine constants.
217: *
218: SAFMIN = DLAMCH( 'Safe minimum' )
219: EPS = DLAMCH( 'Precision' )
220: SMLNUM = SAFMIN / EPS
221: BIGNUM = ONE / SMLNUM
222: RMIN = SQRT( SMLNUM )
223: RMAX = SQRT( BIGNUM )
224: *
225: * Scale matrix to allowable range, if necessary.
226: *
227: ANRM = ZLANHP( 'M', UPLO, N, AP, RWORK )
228: ISCALE = 0
229: IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
230: ISCALE = 1
231: SIGMA = RMIN / ANRM
232: ELSE IF( ANRM.GT.RMAX ) THEN
233: ISCALE = 1
234: SIGMA = RMAX / ANRM
235: END IF
236: IF( ISCALE.EQ.1 ) THEN
237: CALL ZDSCAL( ( N*( N+1 ) ) / 2, SIGMA, AP, 1 )
238: END IF
239: *
240: * Call ZHPTRD to reduce Hermitian packed matrix to tridiagonal form.
241: *
242: INDE = 1
243: INDTAU = 1
244: CALL ZHPTRD( UPLO, N, AP, W, RWORK( INDE ), WORK( INDTAU ),
245: $ IINFO )
246: *
247: * For eigenvalues only, call DSTERF. For eigenvectors, first call
248: * ZUPGTR to generate the orthogonal matrix, then call ZSTEQR.
249: *
250: IF( .NOT.WANTZ ) THEN
251: CALL DSTERF( N, W, RWORK( INDE ), INFO )
252: ELSE
253: INDWRK = INDTAU + N
254: CALL ZUPGTR( UPLO, N, AP, WORK( INDTAU ), Z, LDZ,
255: $ WORK( INDWRK ), IINFO )
256: INDRWK = INDE + N
257: CALL ZSTEQR( JOBZ, N, W, RWORK( INDE ), Z, LDZ,
258: $ RWORK( INDRWK ), INFO )
259: END IF
260: *
261: * If matrix was scaled, then rescale eigenvalues appropriately.
262: *
263: IF( ISCALE.EQ.1 ) THEN
264: IF( INFO.EQ.0 ) THEN
265: IMAX = N
266: ELSE
267: IMAX = INFO - 1
268: END IF
269: CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
270: END IF
271: *
272: RETURN
273: *
274: * End of ZHPEV
275: *
276: END
CVSweb interface <joel.bertrand@systella.fr>