clarfx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 665 行 · 第 1/3 页
HTML
665 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>clarfx.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="CLARFX.1"></a><a href="clarfx.f.html#CLARFX.1">CLARFX</a>( SIDE, M, N, V, TAU, C, LDC, WORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary 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 SIDE
INTEGER LDC, M, N
COMPLEX TAU
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> COMPLEX C( LDC, * ), V( * ), 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="CLARFX.19"></a><a href="clarfx.f.html#CLARFX.1">CLARFX</a> applies a complex elementary reflector H to a complex m by n
</span><span class="comment">*</span><span class="comment"> matrix C, from either the left or the right. H is represented in the
</span><span class="comment">*</span><span class="comment"> form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> H = I - tau * v * v'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where tau is a complex scalar and v is a complex vector.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If tau = 0, then H is taken to be the unit matrix
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> This version uses inline code if H has order < 11.
</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"> SIDE (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'L': form H * C
</span><span class="comment">*</span><span class="comment"> = 'R': form C * H
</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 C.
</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 C.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> V (input) COMPLEX array, dimension (M) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment"> or (N) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment"> The vector v in the representation of H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> TAU (input) COMPLEX
</span><span class="comment">*</span><span class="comment"> The value tau in the representation of H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C (input/output) COMPLEX array, dimension (LDC,N)
</span><span class="comment">*</span><span class="comment"> On entry, the m by n matrix C.
</span><span class="comment">*</span><span class="comment"> On exit, C is overwritten by the matrix H * C if SIDE = 'L',
</span><span class="comment">*</span><span class="comment"> or C * H if SIDE = 'R'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDC (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array C. LDA >= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) COMPLEX array, dimension (N) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment"> or (M) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment"> WORK is not referenced if H has order < 11.
</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 ZERO, ONE
PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ),
$ ONE = ( 1.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER J
COMPLEX SUM, T1, T10, T2, T3, T4, T5, T6, T7, T8, T9,
$ V1, V10, V2, V3, V4, V5, V6, V7, V8, V9
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.76"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.77"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL CGEMV, CGERC
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC CONJG
<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> IF( TAU.EQ.ZERO )
$ RETURN
IF( <a name="LSAME.89"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'L'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form H * C, where H has order m.
</span><span class="comment">*</span><span class="comment">
</span> GO TO ( 10, 30, 50, 70, 90, 110, 130, 150,
$ 170, 190 )M
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Code for general M
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> w := C'*v
</span><span class="comment">*</span><span class="comment">
</span> CALL CGEMV( <span class="string">'Conjugate transpose'</span>, M, N, ONE, C, LDC, V, 1,
$ ZERO, WORK, 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C := C - tau * v * w'
</span><span class="comment">*</span><span class="comment">
</span> CALL CGERC( M, N, -TAU, V, 1, WORK, 1, C, LDC )
GO TO 410
10 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 1 x 1 Householder
</span><span class="comment">*</span><span class="comment">
</span> T1 = ONE - TAU*V( 1 )*CONJG( V( 1 ) )
DO 20 J = 1, N
C( 1, J ) = T1*C( 1, J )
20 CONTINUE
GO TO 410
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 2 x 2 Householder
</span><span class="comment">*</span><span class="comment">
</span> V1 = CONJG( V( 1 ) )
T1 = TAU*CONJG( V1 )
V2 = CONJG( V( 2 ) )
T2 = TAU*CONJG( V2 )
DO 40 J = 1, N
SUM = V1*C( 1, J ) + V2*C( 2, J )
C( 1, J ) = C( 1, J ) - SUM*T1
C( 2, J ) = C( 2, J ) - SUM*T2
40 CONTINUE
GO TO 410
50 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 3 x 3 Householder
</span><span class="comment">*</span><span class="comment">
</span> V1 = CONJG( V( 1 ) )
T1 = TAU*CONJG( V1 )
V2 = CONJG( V( 2 ) )
T2 = TAU*CONJG( V2 )
V3 = CONJG( V( 3 ) )
T3 = TAU*CONJG( V3 )
DO 60 J = 1, N
SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J )
C( 1, J ) = C( 1, J ) - SUM*T1
C( 2, J ) = C( 2, J ) - SUM*T2
C( 3, J ) = C( 3, J ) - SUM*T3
60 CONTINUE
GO TO 410
70 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 4 x 4 Householder
</span><span class="comment">*</span><span class="comment">
</span> V1 = CONJG( V( 1 ) )
T1 = TAU*CONJG( V1 )
V2 = CONJG( V( 2 ) )
T2 = TAU*CONJG( V2 )
V3 = CONJG( V( 3 ) )
T3 = TAU*CONJG( V3 )
V4 = CONJG( V( 4 ) )
T4 = TAU*CONJG( V4 )
DO 80 J = 1, N
SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
$ V4*C( 4, J )
C( 1, J ) = C( 1, J ) - SUM*T1
C( 2, J ) = C( 2, J ) - SUM*T2
C( 3, J ) = C( 3, J ) - SUM*T3
C( 4, J ) = C( 4, J ) - SUM*T4
80 CONTINUE
GO TO 410
90 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 5 x 5 Householder
</span><span class="comment">*</span><span class="comment">
</span> V1 = CONJG( V( 1 ) )
T1 = TAU*CONJG( V1 )
V2 = CONJG( V( 2 ) )
T2 = TAU*CONJG( V2 )
V3 = CONJG( V( 3 ) )
T3 = TAU*CONJG( V3 )
V4 = CONJG( V( 4 ) )
T4 = TAU*CONJG( V4 )
V5 = CONJG( V( 5 ) )
T5 = TAU*CONJG( V5 )
DO 100 J = 1, N
SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
$ V4*C( 4, J ) + V5*C( 5, J )
C( 1, J ) = C( 1, J ) - SUM*T1
C( 2, J ) = C( 2, J ) - SUM*T2
C( 3, J ) = C( 3, J ) - SUM*T3
C( 4, J ) = C( 4, J ) - SUM*T4
C( 5, J ) = C( 5, J ) - SUM*T5
100 CONTINUE
GO TO 410
110 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Special code for 6 x 6 Householder
</span><span class="comment">*</span><span class="comment">
</span> V1 = CONJG( V( 1 ) )
T1 = TAU*CONJG( V1 )
V2 = CONJG( V( 2 ) )
T2 = TAU*CONJG( V2 )
V3 = CONJG( V( 3 ) )
T3 = TAU*CONJG( V3 )
V4 = CONJG( V( 4 ) )
T4 = TAU*CONJG( V4 )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?