dsteqr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 525 行 · 第 1/3 页
HTML
525 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dsteqr.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="DSTEQR.1"></a><a href="dsteqr.f.html#DSTEQR.1">DSTEQR</a>( COMPZ, N, D, E, Z, LDZ, WORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER COMPZ
INTEGER INFO, LDZ, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="DSTEQR.18"></a><a href="dsteqr.f.html#DSTEQR.1">DSTEQR</a> computes all eigenvalues and, optionally, eigenvectors of a
</span><span class="comment">*</span><span class="comment"> symmetric tridiagonal matrix using the implicit QL or QR method.
</span><span class="comment">*</span><span class="comment"> The eigenvectors of a full or band symmetric matrix can also be found
</span><span class="comment">*</span><span class="comment"> if <a name="DSYTRD.21"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a> or <a name="DSPTRD.21"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a> or <a name="DSBTRD.21"></a><a href="dsbtrd.f.html#DSBTRD.1">DSBTRD</a> has been used to reduce this matrix to
</span><span class="comment">*</span><span class="comment"> tridiagonal form.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> COMPZ (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'N': Compute eigenvalues only.
</span><span class="comment">*</span><span class="comment"> = 'V': Compute eigenvalues and eigenvectors of the original
</span><span class="comment">*</span><span class="comment"> symmetric matrix. On entry, Z must contain the
</span><span class="comment">*</span><span class="comment"> orthogonal matrix used to reduce the original matrix
</span><span class="comment">*</span><span class="comment"> to tridiagonal form.
</span><span class="comment">*</span><span class="comment"> = 'I': Compute eigenvalues and eigenvectors of the
</span><span class="comment">*</span><span class="comment"> tridiagonal matrix. Z is initialized to the identity
</span><span class="comment">*</span><span class="comment"> matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The order of the matrix. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> D (input/output) DOUBLE PRECISION array, dimension (N)
</span><span class="comment">*</span><span class="comment"> On entry, the diagonal elements of the tridiagonal matrix.
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, the eigenvalues in ascending order.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> E (input/output) DOUBLE PRECISION array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> On entry, the (n-1) subdiagonal elements of the tridiagonal
</span><span class="comment">*</span><span class="comment"> matrix.
</span><span class="comment">*</span><span class="comment"> On exit, E has been destroyed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
</span><span class="comment">*</span><span class="comment"> On entry, if COMPZ = 'V', then Z contains the orthogonal
</span><span class="comment">*</span><span class="comment"> matrix used in the reduction to tridiagonal form.
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, then if COMPZ = 'V', Z contains the
</span><span class="comment">*</span><span class="comment"> orthonormal eigenvectors of the original symmetric matrix,
</span><span class="comment">*</span><span class="comment"> and if COMPZ = 'I', Z contains the orthonormal eigenvectors
</span><span class="comment">*</span><span class="comment"> of the symmetric tridiagonal matrix.
</span><span class="comment">*</span><span class="comment"> If COMPZ = 'N', then Z is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDZ (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array Z. LDZ >= 1, and if
</span><span class="comment">*</span><span class="comment"> eigenvectors are desired, then LDZ >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) DOUBLE PRECISION array, dimension (max(1,2*N-2))
</span><span class="comment">*</span><span class="comment"> If COMPZ = 'N', then WORK is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment"> > 0: the algorithm has failed to find all the eigenvalues in
</span><span class="comment">*</span><span class="comment"> a total of 30*N iterations; if INFO = i, then i
</span><span class="comment">*</span><span class="comment"> elements of E have not converged to zero; on exit, D
</span><span class="comment">*</span><span class="comment"> and E contain the elements of a symmetric tridiagonal
</span><span class="comment">*</span><span class="comment"> matrix which is orthogonally similar to the original
</span><span class="comment">*</span><span class="comment"> matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> DOUBLE PRECISION ZERO, ONE, TWO, THREE
PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
$ THREE = 3.0D0 )
INTEGER MAXIT
PARAMETER ( MAXIT = 30 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
$ LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
$ NM1, NMAXIT
DOUBLE PRECISION ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
$ S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.92"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
DOUBLE PRECISION <a name="DLAMCH.93"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLANST.93"></a><a href="dlanst.f.html#DLANST.1">DLANST</a>, <a name="DLAPY2.93"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>
EXTERNAL <a name="LSAME.94"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="DLAMCH.94"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLANST.94"></a><a href="dlanst.f.html#DLANST.1">DLANST</a>, <a name="DLAPY2.94"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="DLAE2.97"></a><a href="dlae2.f.html#DLAE2.1">DLAE2</a>, <a name="DLAEV2.97"></a><a href="dlaev2.f.html#DLAEV2.1">DLAEV2</a>, <a name="DLARTG.97"></a><a href="dlartg.f.html#DLARTG.1">DLARTG</a>, <a name="DLASCL.97"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>, <a name="DLASET.97"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>, <a name="DLASR.97"></a><a href="dlasr.f.html#DLASR.1">DLASR</a>,
$ <a name="DLASRT.98"></a><a href="dlasrt.f.html#DLASRT.1">DLASRT</a>, DSWAP, <a name="XERBLA.98"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, SIGN, SQRT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
<span class="comment">*</span><span class="comment">
</span> IF( <a name="LSAME.109"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'N'</span> ) ) THEN
ICOMPZ = 0
ELSE IF( <a name="LSAME.111"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'V'</span> ) ) THEN
ICOMPZ = 1
ELSE IF( <a name="LSAME.113"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'I'</span> ) ) THEN
ICOMPZ = 2
ELSE
ICOMPZ = -1
END IF
IF( ICOMPZ.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( ( LDZ.LT.1 ) .OR. ( ICOMPZ.GT.0 .AND. LDZ.LT.MAX( 1,
$ N ) ) ) THEN
INFO = -6
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.127"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DSTEQR.127"></a><a href="dsteqr.f.html#DSTEQR.1">DSTEQR</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( N.EQ.0 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span> IF( N.EQ.1 ) THEN
IF( ICOMPZ.EQ.2 )
$ Z( 1, 1 ) = ONE
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine the unit roundoff and over/underflow thresholds.
</span><span class="comment">*</span><span class="comment">
</span> EPS = <a name="DLAMCH.144"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'E'</span> )
EPS2 = EPS**2
SAFMIN = <a name="DLAMCH.146"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'S'</span> )
SAFMAX = ONE / SAFMIN
SSFMAX = SQRT( SAFMAX ) / THREE
SSFMIN = SQRT( SAFMIN ) / EPS2
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the eigenvalues and eigenvectors of the tridiagonal
</span><span class="comment">*</span><span class="comment"> matrix.
</span><span class="comment">*</span><span class="comment">
</span> IF( ICOMPZ.EQ.2 )
$ CALL <a name="DLASET.155"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>( <span class="string">'Full'</span>, N, N, ZERO, ONE, Z, LDZ )
<span class="comment">*</span><span class="comment">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?