spbsv.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 176 行
HTML
176 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>spbsv.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="SPBSV.1"></a><a href="spbsv.f.html#SPBSV.1">SPBSV</a>( UPLO, N, KD, NRHS, AB, LDAB, B, LDB, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK driver 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, KD, LDAB, LDB, N, NRHS
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL AB( LDAB, * ), B( LDB, * )
<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="SPBSV.18"></a><a href="spbsv.f.html#SPBSV.1">SPBSV</a> computes the solution to a real system of linear equations
</span><span class="comment">*</span><span class="comment"> A * X = B,
</span><span class="comment">*</span><span class="comment"> where A is an N-by-N symmetric positive definite band matrix and X
</span><span class="comment">*</span><span class="comment"> and B are N-by-NRHS matrices.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The Cholesky decomposition is used to factor A as
</span><span class="comment">*</span><span class="comment"> A = U**T * U, if UPLO = 'U', or
</span><span class="comment">*</span><span class="comment"> A = L * L**T, if UPLO = 'L',
</span><span class="comment">*</span><span class="comment"> where U is an upper triangular band matrix, and L is a lower
</span><span class="comment">*</span><span class="comment"> triangular band matrix, with the same number of superdiagonals or
</span><span class="comment">*</span><span class="comment"> subdiagonals as A. The factored form of A is then used to solve the
</span><span class="comment">*</span><span class="comment"> system of equations A * X = B.
</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 number of linear equations, i.e., the order of the
</span><span class="comment">*</span><span class="comment"> matrix A. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> KD (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of superdiagonals of the matrix A if UPLO = 'U',
</span><span class="comment">*</span><span class="comment"> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> NRHS (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of right hand sides, i.e., the number of columns
</span><span class="comment">*</span><span class="comment"> of the matrix B. NRHS >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AB (input/output) REAL array, dimension (LDAB,N)
</span><span class="comment">*</span><span class="comment"> On entry, the upper or lower triangle of the symmetric band
</span><span class="comment">*</span><span class="comment"> matrix A, stored in the first KD+1 rows of the array. The
</span><span class="comment">*</span><span class="comment"> j-th column of A is stored in the j-th column of the array AB
</span><span class="comment">*</span><span class="comment"> as follows:
</span><span class="comment">*</span><span class="comment"> if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(N,j+KD).
</span><span class="comment">*</span><span class="comment"> See below for further details.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, the triangular factor U or L from the
</span><span class="comment">*</span><span class="comment"> Cholesky factorization A = U**T*U or A = L*L**T of the band
</span><span class="comment">*</span><span class="comment"> matrix A, in the same storage format as A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDAB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array AB. LDAB >= KD+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input/output) REAL array, dimension (LDB,NRHS)
</span><span class="comment">*</span><span class="comment"> On entry, the N-by-NRHS right hand side matrix B.
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array B. LDB >= 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 = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment"> > 0: if INFO = i, the leading minor of order i of A is not
</span><span class="comment">*</span><span class="comment"> positive definite, so the factorization could not be
</span><span class="comment">*</span><span class="comment"> completed, and the solution has not been computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The band storage scheme is illustrated by the following example, when
</span><span class="comment">*</span><span class="comment"> N = 6, KD = 2, and UPLO = 'U':
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On entry: On exit:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> * * a13 a24 a35 a46 * * u13 u24 u35 u46
</span><span class="comment">*</span><span class="comment"> * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
</span><span class="comment">*</span><span class="comment"> a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Similarly, if UPLO = 'L' the format of A is as follows:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On entry: On exit:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> a11 a22 a33 a44 a55 a66 l11 l22 l33 l44 l55 l66
</span><span class="comment">*</span><span class="comment"> a21 a32 a43 a54 a65 * l21 l32 l43 l54 l65 *
</span><span class="comment">*</span><span class="comment"> a31 a42 a53 a64 * * l31 l42 l53 l64 * *
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Array elements marked * are not used by the routine.
</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"> .. External Functions ..
</span> LOGICAL <a name="LSAME.105"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.106"></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="SPBTRF.109"></a><a href="spbtrf.f.html#SPBTRF.1">SPBTRF</a>, <a name="SPBTRS.109"></a><a href="spbtrs.f.html#SPBTRS.1">SPBTRS</a>, <a name="XERBLA.109"></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 MAX
<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
IF( .NOT.<a name="LSAME.119"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) .AND. .NOT.<a name="LSAME.119"></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( KD.LT.0 ) THEN
INFO = -3
ELSE IF( NRHS.LT.0 ) THEN
INFO = -4
ELSE IF( LDAB.LT.KD+1 ) THEN
INFO = -6
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.133"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SPBSV.133"></a><a href="spbsv.f.html#SPBSV.1">SPBSV</a> '</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the Cholesky factorization A = U'*U or A = L*L'.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SPBTRF.139"></a><a href="spbtrf.f.html#SPBTRF.1">SPBTRF</a>( UPLO, N, KD, AB, LDAB, INFO )
IF( INFO.EQ.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve the system A*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SPBTRS.144"></a><a href="spbtrs.f.html#SPBTRS.1">SPBTRS</a>( UPLO, N, KD, NRHS, AB, LDAB, B, LDB, INFO )
<span class="comment">*</span><span class="comment">
</span> END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SPBSV.149"></a><a href="spbsv.f.html#SPBSV.1">SPBSV</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?