zppequ.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 194 行
HTML
194 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>zppequ.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="ZPPEQU.1"></a><a href="zppequ.f.html#ZPPEQU.1">ZPPEQU</a>( UPLO, N, AP, S, SCOND, AMAX, 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 UPLO
INTEGER INFO, N
DOUBLE PRECISION AMAX, SCOND
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> DOUBLE PRECISION S( * )
COMPLEX*16 AP( * )
<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="ZPPEQU.20"></a><a href="zppequ.f.html#ZPPEQU.1">ZPPEQU</a> computes row and column scalings intended to equilibrate a
</span><span class="comment">*</span><span class="comment"> Hermitian positive definite matrix A in packed storage and reduce
</span><span class="comment">*</span><span class="comment"> its condition number (with respect to the two-norm). S contains the
</span><span class="comment">*</span><span class="comment"> scale factors, S(i)=1/sqrt(A(i,i)), chosen so that the scaled matrix
</span><span class="comment">*</span><span class="comment"> B with elements B(i,j)=S(i)*A(i,j)*S(j) has ones on the diagonal.
</span><span class="comment">*</span><span class="comment"> This choice of S puts the condition number of B within a factor N of
</span><span class="comment">*</span><span class="comment"> the smallest possible condition number over all possible diagonal
</span><span class="comment">*</span><span class="comment"> scalings.
</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"> = 'U': Upper triangle of A is stored;
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangle of A is stored.
</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 upper or lower triangle of the Hermitian matrix A, packed
</span><span class="comment">*</span><span class="comment"> columnwise in a linear array. The j-th column of A is stored
</span><span class="comment">*</span><span class="comment"> in the array AP as follows:
</span><span class="comment">*</span><span class="comment"> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> S (output) DOUBLE PRECISION array, dimension (N)
</span><span class="comment">*</span><span class="comment"> If INFO = 0, S contains the scale factors for A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SCOND (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> If INFO = 0, S contains the ratio of the smallest S(i) to
</span><span class="comment">*</span><span class="comment"> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
</span><span class="comment">*</span><span class="comment"> large nor too small, it is not worth scaling by S.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AMAX (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> Absolute value of largest matrix element. If AMAX is very
</span><span class="comment">*</span><span class="comment"> close to overflow or very close to underflow, the matrix
</span><span class="comment">*</span><span class="comment"> should be scaled.
</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: if INFO = i, the i-th diagonal element is nonpositive.
</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, JJ
DOUBLE PRECISION SMIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.76"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.77"></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.80"></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 DBLE, MAX, MIN, 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
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
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.97"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZPPEQU.97"></a><a href="zppequ.f.html#ZPPEQU.1">ZPPEQU</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 ) THEN
SCOND = ONE
AMAX = ZERO
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialize SMIN and AMAX.
</span><span class="comment">*</span><span class="comment">
</span> S( 1 ) = DBLE( AP( 1 ) )
SMIN = S( 1 )
AMAX = S( 1 )
<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"> UPLO = 'U': Upper triangle of A is stored.
</span><span class="comment">*</span><span class="comment"> Find the minimum and maximum diagonal elements.
</span><span class="comment">*</span><span class="comment">
</span> JJ = 1
DO 10 I = 2, N
JJ = JJ + I
S( I ) = DBLE( AP( JJ ) )
SMIN = MIN( SMIN, S( I ) )
AMAX = MAX( AMAX, S( I ) )
10 CONTINUE
<span class="comment">*</span><span class="comment">
</span> ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> UPLO = 'L': Lower triangle of A is stored.
</span><span class="comment">*</span><span class="comment"> Find the minimum and maximum diagonal elements.
</span><span class="comment">*</span><span class="comment">
</span> JJ = 1
DO 20 I = 2, N
JJ = JJ + N - I + 2
S( I ) = DBLE( AP( JJ ) )
SMIN = MIN( SMIN, S( I ) )
AMAX = MAX( AMAX, S( I ) )
20 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span> IF( SMIN.LE.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the first non-positive diagonal element and return.
</span><span class="comment">*</span><span class="comment">
</span> DO 30 I = 1, N
IF( S( I ).LE.ZERO ) THEN
INFO = I
RETURN
END IF
30 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Set the scale factors to the reciprocals
</span><span class="comment">*</span><span class="comment"> of the diagonal elements.
</span><span class="comment">*</span><span class="comment">
</span> DO 40 I = 1, N
S( I ) = ONE / SQRT( S( I ) )
40 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute SCOND = min(S(I)) / max(S(I))
</span><span class="comment">*</span><span class="comment">
</span> SCOND = SQRT( SMIN ) / SQRT( AMAX )
END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZPPEQU.167"></a><a href="zppequ.f.html#ZPPEQU.1">ZPPEQU</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?