strtri.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 201 行
HTML
201 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>strtri.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="STRTRI.1"></a><a href="strtri.f.html#STRTRI.1">STRTRI</a>( UPLO, DIAG, N, A, LDA, 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 DIAG, UPLO
INTEGER INFO, LDA, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL A( LDA, * )
<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="STRTRI.18"></a><a href="strtri.f.html#STRTRI.1">STRTRI</a> computes the inverse of a real upper or lower triangular
</span><span class="comment">*</span><span class="comment"> matrix A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> This is the Level 3 BLAS version of the algorithm.
</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': A is upper triangular;
</span><span class="comment">*</span><span class="comment"> = 'L': A is lower triangular.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DIAG (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'N': A is non-unit triangular;
</span><span class="comment">*</span><span class="comment"> = 'U': A is unit 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"> A (input/output) REAL array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> On entry, the triangular matrix A. If UPLO = 'U', the
</span><span class="comment">*</span><span class="comment"> leading N-by-N upper triangular part of the array A contains
</span><span class="comment">*</span><span class="comment"> the upper triangular matrix, 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 the array A contains
</span><span class="comment">*</span><span class="comment"> the lower triangular matrix, and the strictly upper
</span><span class="comment">*</span><span class="comment"> triangular part of A is not referenced. If DIAG = 'U', the
</span><span class="comment">*</span><span class="comment"> diagonal elements of A are also not referenced and are
</span><span class="comment">*</span><span class="comment"> assumed to be 1.
</span><span class="comment">*</span><span class="comment"> On exit, the (triangular) inverse of the original matrix, in
</span><span class="comment">*</span><span class="comment"> the same storage format.
</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"> 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, A(i,i) is exactly zero. The triangular
</span><span class="comment">*</span><span class="comment"> matrix is singular and its inverse can not be computed.
</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 ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL NOUNIT, UPPER
INTEGER J, JB, NB, NN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.70"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
INTEGER <a name="ILAENV.71"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="LSAME.72"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.72"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL STRMM, STRSM, <a name="STRTI2.75"></a><a href="strti2.f.html#STRTI2.1">STRTI2</a>, <a name="XERBLA.75"></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"> .. 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
UPPER = <a name="LSAME.85"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
NOUNIT = <a name="LSAME.86"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIAG, <span class="string">'N'</span> )
IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.87"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
INFO = -1
ELSE IF( .NOT.NOUNIT .AND. .NOT.<a name="LSAME.89"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIAG, <span class="string">'U'</span> ) ) THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -5
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.97"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="STRTRI.97"></a><a href="strtri.f.html#STRTRI.1">STRTRI</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"> Check for singularity if non-unit.
</span><span class="comment">*</span><span class="comment">
</span> IF( NOUNIT ) THEN
DO 10 INFO = 1, N
IF( A( INFO, INFO ).EQ.ZERO )
$ RETURN
10 CONTINUE
INFO = 0
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine the block size for this environment.
</span><span class="comment">*</span><span class="comment">
</span> NB = <a name="ILAENV.118"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="STRTRI.118"></a><a href="strtri.f.html#STRTRI.1">STRTRI</a>'</span>, UPLO // DIAG, N, -1, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use unblocked code
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="STRTI2.123"></a><a href="strti2.f.html#STRTI2.1">STRTI2</a>( UPLO, DIAG, N, A, LDA, INFO )
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use blocked code
</span><span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute inverse of upper triangular matrix
</span><span class="comment">*</span><span class="comment">
</span> DO 20 J = 1, N, NB
JB = MIN( NB, N-J+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute rows 1:j-1 of current block column
</span><span class="comment">*</span><span class="comment">
</span> CALL STRMM( <span class="string">'Left'</span>, <span class="string">'Upper'</span>, <span class="string">'No transpose'</span>, DIAG, J-1,
$ JB, ONE, A, LDA, A( 1, J ), LDA )
CALL STRSM( <span class="string">'Right'</span>, <span class="string">'Upper'</span>, <span class="string">'No transpose'</span>, DIAG, J-1,
$ JB, -ONE, A( J, J ), LDA, A( 1, J ), LDA )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute inverse of current diagonal block
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="STRTI2.144"></a><a href="strti2.f.html#STRTI2.1">STRTI2</a>( <span class="string">'Upper'</span>, DIAG, JB, A( J, J ), LDA, INFO )
20 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute inverse of lower triangular matrix
</span><span class="comment">*</span><span class="comment">
</span> NN = ( ( N-1 ) / NB )*NB + 1
DO 30 J = NN, 1, -NB
JB = MIN( NB, N-J+1 )
IF( J+JB.LE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute rows j+jb:n of current block column
</span><span class="comment">*</span><span class="comment">
</span> CALL STRMM( <span class="string">'Left'</span>, <span class="string">'Lower'</span>, <span class="string">'No transpose'</span>, DIAG,
$ N-J-JB+1, JB, ONE, A( J+JB, J+JB ), LDA,
$ A( J+JB, J ), LDA )
CALL STRSM( <span class="string">'Right'</span>, <span class="string">'Lower'</span>, <span class="string">'No transpose'</span>, DIAG,
$ N-J-JB+1, JB, -ONE, A( J, J ), LDA,
$ A( J+JB, J ), LDA )
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute inverse of current diagonal block
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="STRTI2.167"></a><a href="strti2.f.html#STRTI2.1">STRTI2</a>( <span class="string">'Lower'</span>, DIAG, JB, A( J, J ), LDA, INFO )
30 CONTINUE
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="STRTRI.174"></a><a href="strtri.f.html#STRTRI.1">STRTRI</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?