LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlarf.f
Go to the documentation of this file.
1*> \brief \b ZLARF applies an elementary reflector to a general rectangular matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLARF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
20*
21* .. Scalar Arguments ..
22* CHARACTER SIDE
23* INTEGER INCV, LDC, M, N
24* COMPLEX*16 TAU
25* ..
26* .. Array Arguments ..
27* COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZLARF applies a complex elementary reflector H to a complex M-by-N
37*> matrix C, from either the left or the right. H is represented in the
38*> form
39*>
40*> H = I - tau * v * v**H
41*>
42*> where tau is a complex scalar and v is a complex vector.
43*>
44*> If tau = 0, then H is taken to be the unit matrix.
45*>
46*> To apply H**H, supply conjg(tau) instead
47*> tau.
48*> \endverbatim
49*
50* Arguments:
51* ==========
52*
53*> \param[in] SIDE
54*> \verbatim
55*> SIDE is CHARACTER*1
56*> = 'L': form H * C
57*> = 'R': form C * H
58*> \endverbatim
59*>
60*> \param[in] M
61*> \verbatim
62*> M is INTEGER
63*> The number of rows of the matrix C.
64*> \endverbatim
65*>
66*> \param[in] N
67*> \verbatim
68*> N is INTEGER
69*> The number of columns of the matrix C.
70*> \endverbatim
71*>
72*> \param[in] V
73*> \verbatim
74*> V is COMPLEX*16 array, dimension
75*> (1 + (M-1)*abs(INCV)) if SIDE = 'L'
76*> or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
77*> The vector v in the representation of H. V is not used if
78*> TAU = 0.
79*> \endverbatim
80*>
81*> \param[in] INCV
82*> \verbatim
83*> INCV is INTEGER
84*> The increment between elements of v. INCV <> 0.
85*> \endverbatim
86*>
87*> \param[in] TAU
88*> \verbatim
89*> TAU is COMPLEX*16
90*> The value tau in the representation of H.
91*> \endverbatim
92*>
93*> \param[in,out] C
94*> \verbatim
95*> C is COMPLEX*16 array, dimension (LDC,N)
96*> On entry, the M-by-N matrix C.
97*> On exit, C is overwritten by the matrix H * C if SIDE = 'L',
98*> or C * H if SIDE = 'R'.
99*> \endverbatim
100*>
101*> \param[in] LDC
102*> \verbatim
103*> LDC is INTEGER
104*> The leading dimension of the array C. LDC >= max(1,M).
105*> \endverbatim
106*>
107*> \param[out] WORK
108*> \verbatim
109*> WORK is COMPLEX*16 array, dimension
110*> (N) if SIDE = 'L'
111*> or (M) if SIDE = 'R'
112*> \endverbatim
113*
114* Authors:
115* ========
116*
117*> \author Univ. of Tennessee
118*> \author Univ. of California Berkeley
119*> \author Univ. of Colorado Denver
120*> \author NAG Ltd.
121*
122*> \ingroup larf
123*
124* =====================================================================
125 SUBROUTINE zlarf( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
126*
127* -- LAPACK auxiliary routine --
128* -- LAPACK is a software package provided by Univ. of Tennessee, --
129* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
130*
131* .. Scalar Arguments ..
132 CHARACTER SIDE
133 INTEGER INCV, LDC, M, N
134 COMPLEX*16 TAU
135* ..
136* .. Array Arguments ..
137 COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 COMPLEX*16 ONE, ZERO
144 parameter( one = ( 1.0d+0, 0.0d+0 ),
145 $ zero = ( 0.0d+0, 0.0d+0 ) )
146* ..
147* .. Local Scalars ..
148 LOGICAL APPLYLEFT
149 INTEGER I, LASTV, LASTC
150* ..
151* .. External Subroutines ..
152 EXTERNAL zgemv, zgerc
153* ..
154* .. External Functions ..
155 LOGICAL LSAME
156 INTEGER ILAZLR, ILAZLC
157 EXTERNAL lsame, ilazlr, ilazlc
158* ..
159* .. Executable Statements ..
160*
161 applyleft = lsame( side, 'L' )
162 lastv = 0
163 lastc = 0
164 IF( tau.NE.zero ) THEN
165* Set up variables for scanning V. LASTV begins pointing to the end
166* of V.
167 IF( applyleft ) THEN
168 lastv = m
169 ELSE
170 lastv = n
171 END IF
172 IF( incv.GT.0 ) THEN
173 i = 1 + (lastv-1) * incv
174 ELSE
175 i = 1
176 END IF
177* Look for the last non-zero row in V.
178 DO WHILE( lastv.GT.0 .AND. v( i ).EQ.zero )
179 lastv = lastv - 1
180 i = i - incv
181 END DO
182 IF( applyleft ) THEN
183* Scan for the last non-zero column in C(1:lastv,:).
184 lastc = ilazlc(lastv, n, c, ldc)
185 ELSE
186* Scan for the last non-zero row in C(:,1:lastv).
187 lastc = ilazlr(m, lastv, c, ldc)
188 END IF
189 END IF
190* Note that lastc.eq.0 renders the BLAS operations null; no special
191* case is needed at this level.
192 IF( applyleft ) THEN
193*
194* Form H * C
195*
196 IF( lastv.GT.0 ) THEN
197*
198* w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1)
199*
200 CALL zgemv( 'Conjugate transpose', lastv, lastc, one,
201 $ c, ldc, v, incv, zero, work, 1 )
202*
203* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H
204*
205 CALL zgerc( lastv, lastc, -tau, v, incv, work, 1, c,
206 $ ldc )
207 END IF
208 ELSE
209*
210* Form C * H
211*
212 IF( lastv.GT.0 ) THEN
213*
214* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
215*
216 CALL zgemv( 'No transpose', lastc, lastv, one, c, ldc,
217 $ v, incv, zero, work, 1 )
218*
219* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H
220*
221 CALL zgerc( lastc, lastv, -tau, work, 1, v, incv, c,
222 $ ldc )
223 END IF
224 END IF
225 RETURN
226*
227* End of ZLARF
228*
229 END
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
subroutine zgerc(m, n, alpha, x, incx, y, incy, a, lda)
ZGERC
Definition zgerc.f:130
subroutine zlarf(side, m, n, v, incv, tau, c, ldc, work)
ZLARF applies an elementary reflector to a general rectangular matrix.
Definition zlarf.f:126