zspcon.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 184 行
HTML
184 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>zspcon.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="ZSPCON.1"></a><a href="zspcon.f.html#ZSPCON.1">ZSPCON</a>( UPLO, N, AP, IPIV, ANORM, RCOND, 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"> Modified to call <a name="ZLACN2.7"></a><a href="zlacn2.f.html#ZLACN2.1">ZLACN2</a> in place of <a name="ZLACON.7"></a><a href="zlacon.f.html#ZLACON.1">ZLACON</a>, 10 Feb 03, SJH.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER UPLO
INTEGER INFO, N
DOUBLE PRECISION ANORM, RCOND
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IPIV( * )
COMPLEX*16 AP( * ), WORK( * )
<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="ZSPCON.22"></a><a href="zspcon.f.html#ZSPCON.1">ZSPCON</a> estimates the reciprocal of the condition number (in the
</span><span class="comment">*</span><span class="comment"> 1-norm) of a complex symmetric packed matrix A using the
</span><span class="comment">*</span><span class="comment"> factorization A = U*D*U**T or A = L*D*L**T computed by <a name="ZSPTRF.24"></a><a href="zsptrf.f.html#ZSPTRF.1">ZSPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> An estimate is obtained for norm(inv(A)), and the reciprocal of the
</span><span class="comment">*</span><span class="comment"> condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
</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"> UPLO (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether the details of the factorization are stored
</span><span class="comment">*</span><span class="comment"> as an upper or lower triangular matrix.
</span><span class="comment">*</span><span class="comment"> = 'U': Upper triangular, form is A = U*D*U**T;
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangular, form is A = L*D*L**T.
</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 A. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AP (input) COMPLEX*16 array, dimension (N*(N+1)/2)
</span><span class="comment">*</span><span class="comment"> The block diagonal matrix D and the multipliers used to
</span><span class="comment">*</span><span class="comment"> obtain the factor U or L as computed by <a name="ZSPTRF.43"></a><a href="zsptrf.f.html#ZSPTRF.1">ZSPTRF</a>, stored as a
</span><span class="comment">*</span><span class="comment"> packed triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IPIV (input) INTEGER array, dimension (N)
</span><span class="comment">*</span><span class="comment"> Details of the interchanges and the block structure of D
</span><span class="comment">*</span><span class="comment"> as determined by <a name="ZSPTRF.48"></a><a href="zsptrf.f.html#ZSPTRF.1">ZSPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ANORM (input) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The 1-norm of the original matrix A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RCOND (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The reciprocal of the condition number of the matrix A,
</span><span class="comment">*</span><span class="comment"> computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
</span><span class="comment">*</span><span class="comment"> estimate of the 1-norm of inv(A) computed in this routine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) COMPLEX*16 array, dimension (2*N)
</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">
</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 ONE, ZERO
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL UPPER
INTEGER I, IP, KASE
DOUBLE PRECISION AINVNM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Arrays ..
</span> INTEGER ISAVE( 3 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.79"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.80"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="XERBLA.83"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZLACN2.83"></a><a href="zlacn2.f.html#ZLACN2.1">ZLACN2</a>, <a name="ZSPTRS.83"></a><a href="zsptrs.f.html#ZSPTRS.1">ZSPTRS</a>
<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
UPPER = <a name="LSAME.90"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.91"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( ANORM.LT.ZERO ) THEN
INFO = -5
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.99"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZSPCON.99"></a><a href="zspcon.f.html#ZSPCON.1">ZSPCON</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> RCOND = ZERO
IF( N.EQ.0 ) THEN
RCOND = ONE
RETURN
ELSE IF( ANORM.LE.ZERO ) THEN
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Check that the diagonal matrix D is nonsingular.
</span><span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Upper triangular storage: examine D from bottom to top
</span><span class="comment">*</span><span class="comment">
</span> IP = N*( N+1 ) / 2
DO 10 I = N, 1, -1
IF( IPIV( I ).GT.0 .AND. AP( IP ).EQ.ZERO )
$ RETURN
IP = IP - I
10 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Lower triangular storage: examine D from top to bottom.
</span><span class="comment">*</span><span class="comment">
</span> IP = 1
DO 20 I = 1, N
IF( IPIV( I ).GT.0 .AND. AP( IP ).EQ.ZERO )
$ RETURN
IP = IP + N - I + 1
20 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Estimate the 1-norm of the inverse.
</span><span class="comment">*</span><span class="comment">
</span> KASE = 0
30 CONTINUE
CALL <a name="ZLACN2.141"></a><a href="zlacn2.f.html#ZLACN2.1">ZLACN2</a>( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
IF( KASE.NE.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Multiply by inv(L*D*L') or inv(U*D*U').
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZSPTRS.146"></a><a href="zsptrs.f.html#ZSPTRS.1">ZSPTRS</a>( UPLO, N, 1, AP, IPIV, WORK, N, INFO )
GO TO 30
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the estimate of the reciprocal condition number.
</span><span class="comment">*</span><span class="comment">
</span> IF( AINVNM.NE.ZERO )
$ RCOND = ( ONE / AINVNM ) / ANORM
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZSPCON.157"></a><a href="zspcon.f.html#ZSPCON.1">ZSPCON</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?