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