zungr2.f.html

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

HTML
159
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>zungr2.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="ZUNGR2.1"></a><a href="zungr2.f.html#ZUNGR2.1">ZUNGR2</a>( M, N, K, A, LDA, TAU, 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>      INTEGER            INFO, K, LDA, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX*16         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="ZUNGR2.17"></a><a href="zungr2.f.html#ZUNGR2.1">ZUNGR2</a> generates an m by n complex matrix Q with orthonormal rows,
</span><span class="comment">*</span><span class="comment">  which is defined as the last m rows of a product of k elementary
</span><span class="comment">*</span><span class="comment">  reflectors of order n
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Q  =  H(1)' H(2)' . . . H(k)'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  as returned by <a name="ZGERQF.23"></a><a href="zgerqf.f.html#ZGERQF.1">ZGERQF</a>.
</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 Q. 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 Q. N &gt;= M.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  K       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of elementary reflectors whose product defines the
</span><span class="comment">*</span><span class="comment">          matrix Q. M &gt;= K &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment">          On entry, the (m-k+i)-th row must contain the vector which
</span><span class="comment">*</span><span class="comment">          defines the elementary reflector H(i), for i = 1,2,...,k, as
</span><span class="comment">*</span><span class="comment">          returned by <a name="ZGERQF.41"></a><a href="zgerqf.f.html#ZGERQF.1">ZGERQF</a> in the last k rows of its array argument
</span><span class="comment">*</span><span class="comment">          A.
</span><span class="comment">*</span><span class="comment">          On exit, the m-by-n matrix Q.
</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 first 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     (input) COMPLEX*16 array, dimension (K)
</span><span class="comment">*</span><span class="comment">          TAU(i) must contain the scalar factor of the elementary
</span><span class="comment">*</span><span class="comment">          reflector H(i), as returned by <a name="ZGERQF.50"></a><a href="zgerqf.f.html#ZGERQF.1">ZGERQF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) COMPLEX*16 array, dimension (M)
</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">          &lt; 0: if INFO = -i, the i-th argument has an illegal value
</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>      COMPLEX*16         ONE, ZERO
      PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ),
     $                   ZERO = ( 0.0D+0, 0.0D+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I, II, J, L
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="XERBLA.69"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZLACGV.69"></a><a href="zlacgv.f.html#ZLACGV.1">ZLACGV</a>, <a name="ZLARF.69"></a><a href="zlarf.f.html#ZLARF.1">ZLARF</a>, ZSCAL
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          DCONJG, MAX
<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>      INFO = 0
      IF( M.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.M ) THEN
         INFO = -2
      ELSE IF( K.LT.0 .OR. K.GT.M ) THEN
         INFO = -3
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -5
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.89"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZUNGR2.89"></a><a href="zungr2.f.html#ZUNGR2.1">ZUNGR2</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( M.LE.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      IF( K.LT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Initialise rows 1:m-k to rows of the unit matrix
</span><span class="comment">*</span><span class="comment">
</span>         DO 20 J = 1, N
            DO 10 L = 1, M - K
               A( L, J ) = ZERO
   10       CONTINUE
            IF( J.GT.N-M .AND. J.LE.N-K )
     $         A( M-N+J, J ) = ONE
   20    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      DO 40 I = 1, K
         II = M - K + I
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Apply H(i)' to A(1:m-k+i,1:n-k+i) from the right
</span><span class="comment">*</span><span class="comment">
</span>         CALL <a name="ZLACGV.116"></a><a href="zlacgv.f.html#ZLACGV.1">ZLACGV</a>( N-M+II-1, A( II, 1 ), LDA )
         A( II, N-M+II ) = ONE
         CALL <a name="ZLARF.118"></a><a href="zlarf.f.html#ZLARF.1">ZLARF</a>( <span class="string">'Right'</span>, II-1, N-M+II, A( II, 1 ), LDA,
     $               DCONJG( TAU( I ) ), A, LDA, WORK )
         CALL ZSCAL( N-M+II-1, -TAU( I ), A( II, 1 ), LDA )
         CALL <a name="ZLACGV.121"></a><a href="zlacgv.f.html#ZLACGV.1">ZLACGV</a>( N-M+II-1, A( II, 1 ), LDA )
         A( II, N-M+II ) = ONE - DCONJG( TAU( I ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set A(m-k+i,n-k+i+1:n) to zero
</span><span class="comment">*</span><span class="comment">
</span>         DO 30 L = N - M + II + 1, N
            A( II, L ) = ZERO
   30    CONTINUE
   40 CONTINUE
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="ZUNGR2.132"></a><a href="zungr2.f.html#ZUNGR2.1">ZUNGR2</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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