zgtrfs.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 398 行 · 第 1/2 页
HTML
398 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>zgtrfs.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="ZGTRFS.1"></a><a href="zgtrfs.f.html#ZGTRFS.1">ZGTRFS</a>( TRANS, N, NRHS, DL, D, DU, DLF, DF, DUF, DU2,
$ IPIV, B, LDB, X, LDX, FERR, BERR, WORK, RWORK,
$ 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.9"></a><a href="zlacn2.f.html#ZLACN2.1">ZLACN2</a> in place of <a name="ZLACON.9"></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 TRANS
INTEGER INFO, LDB, LDX, N, NRHS
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IPIV( * )
DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
COMPLEX*16 B( LDB, * ), D( * ), DF( * ), DL( * ),
$ DLF( * ), DU( * ), DU2( * ), DUF( * ),
$ WORK( * ), X( LDX, * )
<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="ZGTRFS.26"></a><a href="zgtrfs.f.html#ZGTRFS.1">ZGTRFS</a> improves the computed solution to a system of linear
</span><span class="comment">*</span><span class="comment"> equations when the coefficient matrix is tridiagonal, and provides
</span><span class="comment">*</span><span class="comment"> error bounds and backward error estimates for the solution.
</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"> TRANS (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies the form of the system of equations:
</span><span class="comment">*</span><span class="comment"> = 'N': A * X = B (No transpose)
</span><span class="comment">*</span><span class="comment"> = 'T': A**T * X = B (Transpose)
</span><span class="comment">*</span><span class="comment"> = 'C': A**H * X = B (Conjugate transpose)
</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"> 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"> DL (input) COMPLEX*16 array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The (n-1) subdiagonal elements of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> D (input) COMPLEX*16 array, dimension (N)
</span><span class="comment">*</span><span class="comment"> The diagonal elements of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DU (input) COMPLEX*16 array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The (n-1) superdiagonal elements of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DLF (input) COMPLEX*16 array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The (n-1) multipliers that define the matrix L from the
</span><span class="comment">*</span><span class="comment"> LU factorization of A as computed by <a name="ZGTTRF.57"></a><a href="zgttrf.f.html#ZGTTRF.1">ZGTTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DF (input) COMPLEX*16 array, dimension (N)
</span><span class="comment">*</span><span class="comment"> The n diagonal elements of the upper triangular matrix U from
</span><span class="comment">*</span><span class="comment"> the LU factorization of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DUF (input) COMPLEX*16 array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The (n-1) elements of the first superdiagonal of U.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DU2 (input) COMPLEX*16 array, dimension (N-2)
</span><span class="comment">*</span><span class="comment"> The (n-2) elements of the second superdiagonal of U.
</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"> The pivot indices; for 1 <= i <= n, row i of the matrix was
</span><span class="comment">*</span><span class="comment"> interchanged with row IPIV(i). IPIV(i) will always be either
</span><span class="comment">*</span><span class="comment"> i or i+1; IPIV(i) = i indicates a row interchange was not
</span><span class="comment">*</span><span class="comment"> required.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input) COMPLEX*16 array, dimension (LDB,NRHS)
</span><span class="comment">*</span><span class="comment"> The right hand side matrix B.
</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"> X (input/output) COMPLEX*16 array, dimension (LDX,NRHS)
</span><span class="comment">*</span><span class="comment"> On entry, the solution matrix X, as computed by <a name="ZGTTRS.82"></a><a href="zgttrs.f.html#ZGTTRS.1">ZGTTRS</a>.
</span><span class="comment">*</span><span class="comment"> On exit, the improved solution matrix X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDX (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array X. LDX >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> FERR (output) DOUBLE PRECISION array, dimension (NRHS)
</span><span class="comment">*</span><span class="comment"> The estimated forward error bound for each solution vector
</span><span class="comment">*</span><span class="comment"> X(j) (the j-th column of the solution matrix X).
</span><span class="comment">*</span><span class="comment"> If XTRUE is the true solution corresponding to X(j), FERR(j)
</span><span class="comment">*</span><span class="comment"> is an estimated upper bound for the magnitude of the largest
</span><span class="comment">*</span><span class="comment"> element in (X(j) - XTRUE) divided by the magnitude of the
</span><span class="comment">*</span><span class="comment"> largest element in X(j). The estimate is as reliable as
</span><span class="comment">*</span><span class="comment"> the estimate for RCOND, and is almost always a slight
</span><span class="comment">*</span><span class="comment"> overestimate of the true error.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> BERR (output) DOUBLE PRECISION array, dimension (NRHS)
</span><span class="comment">*</span><span class="comment"> The componentwise relative backward error of each solution
</span><span class="comment">*</span><span class="comment"> vector X(j) (i.e., the smallest relative change in
</span><span class="comment">*</span><span class="comment"> any element of A or B that makes X(j) an exact solution).
</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"> RWORK (workspace) DOUBLE PRECISION array, dimension (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"> Internal Parameters
</span><span class="comment">*</span><span class="comment"> ===================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ITMAX is the maximum number of steps of iterative refinement.
</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> INTEGER ITMAX
PARAMETER ( ITMAX = 5 )
DOUBLE PRECISION ZERO, ONE
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
DOUBLE PRECISION TWO
PARAMETER ( TWO = 2.0D+0 )
DOUBLE PRECISION THREE
PARAMETER ( THREE = 3.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL NOTRAN
CHARACTER TRANSN, TRANST
INTEGER COUNT, I, J, KASE, NZ
DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN
COMPLEX*16 ZDUM
<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 Subroutines ..
</span> EXTERNAL <a name="XERBLA.139"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, ZAXPY, ZCOPY, <a name="ZGTTRS.139"></a><a href="zgttrs.f.html#ZGTTRS.1">ZGTTRS</a>, <a name="ZLACN2.139"></a><a href="zlacn2.f.html#ZLACN2.1">ZLACN2</a>, <a name="ZLAGTM.139"></a><a href="zlagtm.f.html#ZLAGTM.1">ZLAGTM</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, DBLE, DCMPLX, DIMAG, MAX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.145"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
DOUBLE PRECISION <a name="DLAMCH.146"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>
EXTERNAL <a name="LSAME.147"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="DLAMCH.147"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Statement Functions ..
</span> DOUBLE PRECISION CABS1
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Statement Function definitions ..
</span> CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
<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
NOTRAN = <a name="LSAME.160"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'N'</span> )
IF( .NOT.NOTRAN .AND. .NOT.<a name="LSAME.161"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'T'</span> ) .AND. .NOT.
$ <a name="LSAME.162"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'C'</span> ) ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( NRHS.LT.0 ) THEN
INFO = -3
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -13
ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
INFO = -15
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.174"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZGTRFS.174"></a><a href="zgtrfs.f.html#ZGTRFS.1">ZGTRFS</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 .OR. NRHS.EQ.0 ) THEN
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?