slatrz.f.html

来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 152 行

HTML
152
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>slatrz.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="SLATRZ.1"></a><a href="slatrz.f.html#SLATRZ.1">SLATRZ</a>( M, N, L, A, LDA, TAU, WORK )
<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>      INTEGER            L, LDA, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      REAL               A( LDA, * ), TAU( * ), 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="SLATRZ.17"></a><a href="slatrz.f.html#SLATRZ.1">SLATRZ</a> factors the M-by-(M+L) real upper trapezoidal matrix
</span><span class="comment">*</span><span class="comment">  [ A1 A2 ] = [ A(1:M,1:M) A(1:M,N-L+1:N) ] as ( R  0 ) * Z, by means
</span><span class="comment">*</span><span class="comment">  of orthogonal transformations.  Z is an (M+L)-by-(M+L) orthogonal
</span><span class="comment">*</span><span class="comment">  matrix and, R and A1 are M-by-M upper triangular matrices.
</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">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix A.  M &gt;= 0.
</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 columns of the matrix A.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  L       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix A containing the
</span><span class="comment">*</span><span class="comment">          meaningful part of the Householder vectors. N-M &gt;= L &gt;= 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 leading M-by-N upper trapezoidal part of the
</span><span class="comment">*</span><span class="comment">          array A must contain the matrix to be factorized.
</span><span class="comment">*</span><span class="comment">          On exit, the leading M-by-M upper triangular part of A
</span><span class="comment">*</span><span class="comment">          contains the upper triangular matrix R, and elements N-L+1 to
</span><span class="comment">*</span><span class="comment">          N of the first M rows of A, with the array TAU, represent the
</span><span class="comment">*</span><span class="comment">          orthogonal matrix Z as a product of M elementary reflectors.
</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 &gt;= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TAU     (output) REAL array, dimension (M)
</span><span class="comment">*</span><span class="comment">          The scalar factors of the elementary reflectors.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) REAL array, dimension (M)
</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">  Based on contributions by
</span><span class="comment">*</span><span class="comment">    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The factorization is obtained by Householder's method.  The kth
</span><span class="comment">*</span><span class="comment">  transformation matrix, Z( k ), which is used to introduce zeros into
</span><span class="comment">*</span><span class="comment">  the ( m - k + 1 )th row of A, is given in the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Z( k ) = ( I     0   ),
</span><span class="comment">*</span><span class="comment">              ( 0  T( k ) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     T( k ) = I - tau*u( k )*u( k )',   u( k ) = (   1    ),
</span><span class="comment">*</span><span class="comment">                                                 (   0    )
</span><span class="comment">*</span><span class="comment">                                                 ( z( k ) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  tau is a scalar and z( k ) is an l element vector. tau and z( k )
</span><span class="comment">*</span><span class="comment">  are chosen to annihilate the elements of the kth row of A2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The scalar tau is returned in the kth element of TAU and the vector
</span><span class="comment">*</span><span class="comment">  u( k ) in the kth row of A2, such that the elements of z( k ) are
</span><span class="comment">*</span><span class="comment">  in  a( k, l + 1 ), ..., a( k, n ). The elements of R are returned in
</span><span class="comment">*</span><span class="comment">  the upper triangular part of A1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Z is given by
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ).
</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
      PARAMETER          ( ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="SLARFG.92"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>, <a name="SLARZ.92"></a><a href="slarz.f.html#SLARZ.1">SLARZ</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 arguments
</span><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( M.EQ.0 ) THEN
         RETURN
      ELSE IF( M.EQ.N ) THEN
         DO 10 I = 1, N
            TAU( I ) = ZERO
   10    CONTINUE
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      DO 20 I = M, 1, -1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Generate elementary reflector H(i) to annihilate
</span><span class="comment">*</span><span class="comment">        [ A(i,i) A(i,n-l+1:n) ]
</span><span class="comment">*</span><span class="comment">
</span>         CALL <a name="SLARFG.114"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>( L+1, A( I, I ), A( I, N-L+1 ), LDA, TAU( I ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Apply H(i) to A(1:i-1,i:n) from the right
</span><span class="comment">*</span><span class="comment">
</span>         CALL <a name="SLARZ.118"></a><a href="slarz.f.html#SLARZ.1">SLARZ</a>( <span class="string">'Right'</span>, I-1, N-I+1, L, A( I, N-L+1 ), LDA,
     $               TAU( I ), A( 1, I ), LDA, WORK )
<span class="comment">*</span><span class="comment">
</span>   20 CONTINUE
<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="SLATRZ.125"></a><a href="slatrz.f.html#SLATRZ.1">SLATRZ</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?