cggqrf.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 236 行 · 第 1/2 页
HTML
236 行
</span><span class="comment">*</span><span class="comment"> RQ factorization of an N-by-P matrix, and NB3 is the optimal
</span><span class="comment">*</span><span class="comment"> blocksize for a call of <a name="CUNMQR.101"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If LWORK = -1, then a workspace query is assumed; the routine
</span><span class="comment">*</span><span class="comment"> only calculates the optimal size of the WORK array, returns
</span><span class="comment">*</span><span class="comment"> this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment"> message related to LWORK is issued by <a name="XERBLA.106"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</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"> The matrix Q is represented as a product of elementary reflectors
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q = H(1) H(2) . . . H(k), where k = min(n,m).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Each H(i) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> H(i) = I - taua * v * v'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where taua is a complex scalar, and v is a complex vector with
</span><span class="comment">*</span><span class="comment"> v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i+1:n,i),
</span><span class="comment">*</span><span class="comment"> and taua in TAUA(i).
</span><span class="comment">*</span><span class="comment"> To form Q explicitly, use LAPACK subroutine <a name="CUNGQR.126"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>.
</span><span class="comment">*</span><span class="comment"> To use Q to update another matrix, use LAPACK subroutine <a name="CUNMQR.127"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The matrix Z is represented as a product of elementary reflectors
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Z = H(1) H(2) . . . H(k), where k = min(n,p).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Each H(i) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> H(i) = I - taub * v * v'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where taub is a complex scalar, and v is a complex vector with
</span><span class="comment">*</span><span class="comment"> v(p-k+i+1:p) = 0 and v(p-k+i) = 1; v(1:p-k+i-1) is stored on exit in
</span><span class="comment">*</span><span class="comment"> B(n-k+i,1:p-k+i-1), and taub in TAUB(i).
</span><span class="comment">*</span><span class="comment"> To form Z explicitly, use LAPACK subroutine <a name="CUNGRQ.140"></a><a href="cungrq.f.html#CUNGRQ.1">CUNGRQ</a>.
</span><span class="comment">*</span><span class="comment"> To use Z to update another matrix, use LAPACK subroutine <a name="CUNMRQ.141"></a><a href="cunmrq.f.html#CUNMRQ.1">CUNMRQ</a>.
</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"> .. Local Scalars ..
</span> LOGICAL LQUERY
INTEGER LOPT, LWKOPT, NB, NB1, NB2, NB3
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="CGEQRF.150"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>, <a name="CGERQF.150"></a><a href="cgerqf.f.html#CGERQF.1">CGERQF</a>, <a name="CUNMQR.150"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>, <a name="XERBLA.150"></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"> .. External Functions ..
</span> INTEGER <a name="ILAENV.153"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="ILAENV.154"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC INT, 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
NB1 = <a name="ILAENV.164"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.164"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, N, M, -1, -1 )
NB2 = <a name="ILAENV.165"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGERQF.165"></a><a href="cgerqf.f.html#CGERQF.1">CGERQF</a>'</span>, <span class="string">' '</span>, N, P, -1, -1 )
NB3 = <a name="ILAENV.166"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMQR.166"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>'</span>, <span class="string">' '</span>, N, M, P, -1 )
NB = MAX( NB1, NB2, NB3 )
LWKOPT = MAX( N, M, P)*NB
WORK( 1 ) = LWKOPT
LQUERY = ( LWORK.EQ.-1 )
IF( N.LT.0 ) THEN
INFO = -1
ELSE IF( M.LT.0 ) THEN
INFO = -2
ELSE IF( P.LT.0 ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -5
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -8
ELSE IF( LWORK.LT.MAX( 1, N, M, P ) .AND. .NOT.LQUERY ) THEN
INFO = -11
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.185"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGGQRF.185"></a><a href="cggqrf.f.html#CGGQRF.1">CGGQRF</a>'</span>, -INFO )
RETURN
ELSE IF( LQUERY ) THEN
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> QR factorization of N-by-M matrix A: A = Q*R
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGEQRF.193"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>( N, M, A, LDA, TAUA, WORK, LWORK, INFO )
LOPT = WORK( 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Update B := Q'*B.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CUNMQR.198"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>( <span class="string">'Left'</span>, <span class="string">'Conjugate Transpose'</span>, N, P, MIN( N, M ), A,
$ LDA, TAUA, B, LDB, WORK, LWORK, INFO )
LOPT = MAX( LOPT, INT( WORK( 1 ) ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RQ factorization of N-by-P matrix B: B = T*Z.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGERQF.204"></a><a href="cgerqf.f.html#CGERQF.1">CGERQF</a>( N, P, B, LDB, TAUB, WORK, LWORK, INFO )
WORK( 1 ) = MAX( LOPT, INT( WORK( 1 ) ) )
<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="CGGQRF.209"></a><a href="cggqrf.f.html#CGGQRF.1">CGGQRF</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?