ssbtrd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 577 行 · 第 1/3 页
HTML
577 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ssbtrd.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="SSBTRD.1"></a><a href="ssbtrd.f.html#SSBTRD.1">SSBTRD</a>( VECT, UPLO, N, KD, AB, LDAB, D, E, Q, LDQ,
$ 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"> .. Scalar Arguments ..
</span> CHARACTER UPLO, VECT
INTEGER INFO, KD, LDAB, LDQ, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL AB( LDAB, * ), D( * ), E( * ), Q( LDQ, * ),
$ 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="SSBTRD.20"></a><a href="ssbtrd.f.html#SSBTRD.1">SSBTRD</a> reduces a real symmetric band matrix A to symmetric
</span><span class="comment">*</span><span class="comment"> tridiagonal form T by an orthogonal similarity transformation:
</span><span class="comment">*</span><span class="comment"> Q**T * A * Q = T.
</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"> VECT (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'N': do not form Q;
</span><span class="comment">*</span><span class="comment"> = 'V': form Q;
</span><span class="comment">*</span><span class="comment"> = 'U': update a matrix X, by forming X*Q.
</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"> 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"> 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"> On exit, the diagonal elements of AB are overwritten by the
</span><span class="comment">*</span><span class="comment"> diagonal elements of the tridiagonal matrix T; if KD > 0, the
</span><span class="comment">*</span><span class="comment"> elements on the first superdiagonal (if UPLO = 'U') or the
</span><span class="comment">*</span><span class="comment"> first subdiagonal (if UPLO = 'L') are overwritten by the
</span><span class="comment">*</span><span class="comment"> off-diagonal elements of T; the rest of AB is overwritten by
</span><span class="comment">*</span><span class="comment"> values generated during the reduction.
</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"> D (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> The diagonal elements of the tridiagonal matrix T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> E (output) REAL array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The off-diagonal elements of the tridiagonal matrix T:
</span><span class="comment">*</span><span class="comment"> E(i) = T(i,i+1) if UPLO = 'U'; E(i) = T(i+1,i) if UPLO = 'L'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q (input/output) REAL array, dimension (LDQ,N)
</span><span class="comment">*</span><span class="comment"> On entry, if VECT = 'U', then Q must contain an N-by-N
</span><span class="comment">*</span><span class="comment"> matrix X; if VECT = 'N' or 'V', then Q need not be set.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On exit:
</span><span class="comment">*</span><span class="comment"> if VECT = 'V', Q contains the N-by-N orthogonal matrix Q;
</span><span class="comment">*</span><span class="comment"> if VECT = 'U', Q contains the product X*Q;
</span><span class="comment">*</span><span class="comment"> if VECT = 'N', the array Q is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDQ (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array Q.
</span><span class="comment">*</span><span class="comment"> LDQ >= 1, and LDQ >= N if VECT = 'V' or 'U'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) REAL 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"> 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"> Modified by Linda Kaufman, Bell Labs.
</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> REAL ZERO, ONE
PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL INITQ, UPPER, WANTQ
INTEGER I, I2, IBL, INCA, INCX, IQAEND, IQB, IQEND, J,
$ J1, J1END, J1INC, J2, JEND, JIN, JINC, K, KD1,
$ KDM1, KDN, L, LAST, LEND, NQ, NR, NRT
REAL TEMP
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="SLAR2V.105"></a><a href="slar2v.f.html#SLAR2V.1">SLAR2V</a>, <a name="SLARGV.105"></a><a href="slargv.f.html#SLARGV.1">SLARGV</a>, <a name="SLARTG.105"></a><a href="slartg.f.html#SLARTG.1">SLARTG</a>, <a name="SLARTV.105"></a><a href="slartv.f.html#SLARTV.1">SLARTV</a>, <a name="SLASET.105"></a><a href="slaset.f.html#SLASET.1">SLASET</a>, SROT,
$ <a name="XERBLA.106"></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, MIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.112"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.113"></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"> .. 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> INITQ = <a name="LSAME.119"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'V'</span> )
WANTQ = INITQ .OR. <a name="LSAME.120"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'U'</span> )
UPPER = <a name="LSAME.121"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
KD1 = KD + 1
KDM1 = KD - 1
INCX = LDAB - 1
IQEND = 1
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( .NOT.WANTQ .AND. .NOT.<a name="LSAME.128"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'N'</span> ) ) THEN
INFO = -1
ELSE IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.130"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( KD.LT.0 ) THEN
INFO = -4
ELSE IF( LDAB.LT.KD1 ) THEN
INFO = -6
ELSE IF( LDQ.LT.MAX( 1, N ) .AND. WANTQ ) THEN
INFO = -10
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.142"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SSBTRD.142"></a><a href="ssbtrd.f.html#SSBTRD.1">SSBTRD</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 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialize Q to the unit matrix, if needed
</span><span class="comment">*</span><span class="comment">
</span> IF( INITQ )
$ CALL <a name="SLASET.154"></a><a href="slaset.f.html#SLASET.1">SLASET</a>( <span class="string">'Full'</span>, N, N, ZERO, ONE, Q, LDQ )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Wherever possible, plane rotations are generated and applied in
</span><span class="comment">*</span><span class="comment"> vector operations of length NR over the index set J1:J2:KD1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The cosines and sines of the plane rotations are stored in the
</span><span class="comment">*</span><span class="comment"> arrays D and WORK.
</span><span class="comment">*</span><span class="comment">
</span> INCA = KD1*LDAB
KDN = MIN( N-1, KD )
IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span> IF( KD.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce to tridiagonal form, working with upper triangle
</span><span class="comment">*</span><span class="comment">
</span> NR = 0
J1 = KDN + 2
J2 = 1
<span class="comment">*</span><span class="comment">
</span> DO 90 I = 1, N - 2
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?