dlasyf.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 612 行 · 第 1/3 页
HTML
612 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dlasyf.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="DLASYF.1"></a><a href="dlasyf.f.html#DLASYF.1">DLASYF</a>( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, 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, KB, LDA, LDW, N, NB
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * ), W( LDW, * )
<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="DLASYF.19"></a><a href="dlasyf.f.html#DLASYF.1">DLASYF</a> computes a partial factorization of a real symmetric matrix A
</span><span class="comment">*</span><span class="comment"> using the Bunch-Kaufman diagonal pivoting method. The partial
</span><span class="comment">*</span><span class="comment"> factorization has the form:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A = ( I U12 ) ( A11 0 ) ( I 0 ) if UPLO = 'U', or:
</span><span class="comment">*</span><span class="comment"> ( 0 U22 ) ( 0 D ) ( U12' U22' )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A = ( L11 0 ) ( D 0 ) ( L11' L21' ) if UPLO = 'L'
</span><span class="comment">*</span><span class="comment"> ( L21 I ) ( 0 A22 ) ( 0 I )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where the order of D is at most NB. The actual order is returned in
</span><span class="comment">*</span><span class="comment"> the argument KB, and is either NB or NB-1, or N if N <= NB.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="DLASYF.32"></a><a href="dlasyf.f.html#DLASYF.1">DLASYF</a> is an auxiliary routine called by <a name="DSYTRF.32"></a><a href="dsytrf.f.html#DSYTRF.1">DSYTRF</a>. It uses blocked code
</span><span class="comment">*</span><span class="comment"> (calling Level 3 BLAS) to update the submatrix A11 (if UPLO = 'U') or
</span><span class="comment">*</span><span class="comment"> A22 (if UPLO = 'L').
</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 upper or lower triangular part of the
</span><span class="comment">*</span><span class="comment"> symmetric matrix A is stored:
</span><span class="comment">*</span><span class="comment"> = 'U': Upper triangular
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangular
</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"> NB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The maximum number of columns of the matrix A that should be
</span><span class="comment">*</span><span class="comment"> factored. NB should be at least 2 to allow for 2-by-2 pivot
</span><span class="comment">*</span><span class="comment"> blocks.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> KB (output) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of columns of A that were actually factored.
</span><span class="comment">*</span><span class="comment"> KB is either NB-1 or NB, or N if N <= NB.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> On entry, the symmetric matrix A. If UPLO = 'U', the leading
</span><span class="comment">*</span><span class="comment"> n-by-n upper triangular part of A contains the upper
</span><span class="comment">*</span><span class="comment"> triangular part of the matrix A, and the strictly lower
</span><span class="comment">*</span><span class="comment"> triangular part of A is not referenced. If UPLO = 'L', the
</span><span class="comment">*</span><span class="comment"> leading n-by-n lower triangular part of A contains the lower
</span><span class="comment">*</span><span class="comment"> triangular part of the matrix A, and the strictly upper
</span><span class="comment">*</span><span class="comment"> triangular part of A is not referenced.
</span><span class="comment">*</span><span class="comment"> On exit, A contains details of the partial factorization.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array A. LDA >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IPIV (output) 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"> If UPLO = 'U', only the last KB elements of IPIV are set;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L', only the first KB elements are set.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
</span><span class="comment">*</span><span class="comment"> interchanged and D(k,k) is a 1-by-1 diagonal block.
</span><span class="comment">*</span><span class="comment"> If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and
</span><span class="comment">*</span><span class="comment"> columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
</span><span class="comment">*</span><span class="comment"> is a 2-by-2 diagonal block. If UPLO = 'L' and IPIV(k) =
</span><span class="comment">*</span><span class="comment"> IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were
</span><span class="comment">*</span><span class="comment"> interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> W (workspace) DOUBLE PRECISION array, dimension (LDW,NB)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDW (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array W. LDW >= max(1,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 = k, D(k,k) is exactly zero. The factorization
</span><span class="comment">*</span><span class="comment"> has been completed, but the block diagonal matrix D is
</span><span class="comment">*</span><span class="comment"> exactly singular.
</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
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
DOUBLE PRECISION EIGHT, SEVTEN
PARAMETER ( EIGHT = 8.0D+0, SEVTEN = 17.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER IMAX, J, JB, JJ, JMAX, JP, K, KK, KKW, KP,
$ KSTEP, KW
DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, D11, D21, D22, R1,
$ ROWMAX, T
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.109"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
INTEGER IDAMAX
EXTERNAL <a name="LSAME.111"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, IDAMAX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL DCOPY, DGEMM, DGEMV, DSCAL, DSWAP
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, 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> INFO = 0
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialize ALPHA for use in choosing pivot block size.
</span><span class="comment">*</span><span class="comment">
</span> ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
<span class="comment">*</span><span class="comment">
</span> IF( <a name="LSAME.127"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Factorize the trailing columns of A using the upper triangle
</span><span class="comment">*</span><span class="comment"> of A and working backwards, and compute the matrix W = U12*D
</span><span class="comment">*</span><span class="comment"> for use in updating A11
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K is the main loop index, decreasing from N in steps of 1 or 2
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> KW is the column of W which corresponds to column K of A
</span><span class="comment">*</span><span class="comment">
</span> K = N
10 CONTINUE
KW = NB + K - N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Exit from loop
</span><span class="comment">*</span><span class="comment">
</span> IF( ( K.LE.N-NB+1 .AND. NB.LT.N ) .OR. K.LT.1 )
$ GO TO 30
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Copy column K of A to column KW of W and update it
</span><span class="comment">*</span><span class="comment">
</span> CALL DCOPY( K, A( 1, K ), 1, W( 1, KW ), 1 )
IF( K.LT.N )
$ CALL DGEMV( <span class="string">'No transpose'</span>, K, N-K, -ONE, A( 1, K+1 ), LDA,
$ W( K, KW+1 ), LDW, ONE, W( 1, KW ), 1 )
<span class="comment">*</span><span class="comment">
</span> KSTEP = 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine rows and columns to be interchanged and whether
</span><span class="comment">*</span><span class="comment"> a 1-by-1 or 2-by-2 pivot block will be used
</span><span class="comment">*</span><span class="comment">
</span> ABSAKK = ABS( W( K, KW ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IMAX is the row-index of the largest off-diagonal element in
</span><span class="comment">*</span><span class="comment"> column K, and COLMAX is its absolute value
</span><span class="comment">*</span><span class="comment">
</span> IF( K.GT.1 ) THEN
IMAX = IDAMAX( K-1, W( 1, KW ), 1 )
COLMAX = ABS( W( IMAX, KW ) )
ELSE
COLMAX = ZERO
END IF
<span class="comment">*</span><span class="comment">
</span> IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Column K is zero: set INFO and continue
</span><span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 )
$ INFO = K
KP = K
ELSE
IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> no interchange, use 1-by-1 pivot block
</span><span class="comment">*</span><span class="comment">
</span> KP = K
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Copy column IMAX to column KW-1 of W and update it
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?