cgbtrs.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 239 行 · 第 1/2 页
HTML
239 行
INFO = -2
ELSE IF( KL.LT.0 ) THEN
INFO = -3
ELSE IF( KU.LT.0 ) THEN
INFO = -4
ELSE IF( NRHS.LT.0 ) THEN
INFO = -5
ELSE IF( LDAB.LT.( 2*KL+KU+1 ) ) THEN
INFO = -7
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -10
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.115"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGBTRS.115"></a><a href="cgbtrs.f.html#CGBTRS.1">CGBTRS</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 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span> KD = KU + KL + 1
LNOTI = KL.GT.0
<span class="comment">*</span><span class="comment">
</span> IF( NOTRAN ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve A*X = B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve L*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> L is represented as a product of permutations and unit lower
</span><span class="comment">*</span><span class="comment"> triangular matrices L = P(1) * L(1) * ... * P(n-1) * L(n-1),
</span><span class="comment">*</span><span class="comment"> where each transformation L(i) is a rank-one modification of
</span><span class="comment">*</span><span class="comment"> the identity matrix.
</span><span class="comment">*</span><span class="comment">
</span> IF( LNOTI ) THEN
DO 10 J = 1, N - 1
LM = MIN( KL, N-J )
L = IPIV( J )
IF( L.NE.J )
$ CALL CSWAP( NRHS, B( L, 1 ), LDB, B( J, 1 ), LDB )
CALL CGERU( LM, NRHS, -ONE, AB( KD+1, J ), 1, B( J, 1 ),
$ LDB, B( J+1, 1 ), LDB )
10 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span> DO 20 I = 1, NRHS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve U*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> CALL CTBSV( <span class="string">'Upper'</span>, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, N, KL+KU,
$ AB, LDAB, B( 1, I ), 1 )
20 CONTINUE
<span class="comment">*</span><span class="comment">
</span> ELSE IF( <a name="LSAME.157"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'T'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve A**T * X = B.
</span><span class="comment">*</span><span class="comment">
</span> DO 30 I = 1, NRHS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve U**T * X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> CALL CTBSV( <span class="string">'Upper'</span>, <span class="string">'Transpose'</span>, <span class="string">'Non-unit'</span>, N, KL+KU, AB,
$ LDAB, B( 1, I ), 1 )
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve L**T * X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> IF( LNOTI ) THEN
DO 40 J = N - 1, 1, -1
LM = MIN( KL, N-J )
CALL CGEMV( <span class="string">'Transpose'</span>, LM, NRHS, -ONE, B( J+1, 1 ),
$ LDB, AB( KD+1, J ), 1, ONE, B( J, 1 ), LDB )
L = IPIV( J )
IF( L.NE.J )
$ CALL CSWAP( NRHS, B( L, 1 ), LDB, B( J, 1 ), LDB )
40 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span> ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve A**H * X = B.
</span><span class="comment">*</span><span class="comment">
</span> DO 50 I = 1, NRHS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve U**H * X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> CALL CTBSV( <span class="string">'Upper'</span>, <span class="string">'Conjugate transpose'</span>, <span class="string">'Non-unit'</span>, N,
$ KL+KU, AB, LDAB, B( 1, I ), 1 )
50 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve L**H * X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span> IF( LNOTI ) THEN
DO 60 J = N - 1, 1, -1
LM = MIN( KL, N-J )
CALL <a name="CLACGV.199"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( J, 1 ), LDB )
CALL CGEMV( <span class="string">'Conjugate transpose'</span>, LM, NRHS, -ONE,
$ B( J+1, 1 ), LDB, AB( KD+1, J ), 1, ONE,
$ B( J, 1 ), LDB )
CALL <a name="CLACGV.203"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( J, 1 ), LDB )
L = IPIV( J )
IF( L.NE.J )
$ CALL CSWAP( NRHS, B( L, 1 ), LDB, B( J, 1 ), LDB )
60 CONTINUE
END IF
END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="CGBTRS.212"></a><a href="cgbtrs.f.html#CGBTRS.1">CGBTRS</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?