1 *> \brief \b ZLARF applies an elementary reflector to a general rectangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZLARF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarf.f">
21 * SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
23 * .. Scalar Arguments ..
25 * INTEGER INCV, LDC, M, N
28 * .. Array Arguments ..
29 * COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
38 *> ZLARF applies a complex elementary reflector H to a complex M-by-N
39 *> matrix C, from either the left or the right. H is represented in the
42 *> H = I - tau * v * v**H
44 *> where tau is a complex scalar and v is a complex vector.
46 *> If tau = 0, then H is taken to be the unit matrix.
48 *> To apply H**H, supply conjg(tau) instead
57 *> SIDE is CHARACTER*1
65 *> The number of rows of the matrix C.
71 *> The number of columns of the matrix C.
76 *> V is COMPLEX*16 array, dimension
77 *> (1 + (M-1)*abs(INCV)) if SIDE = 'L'
78 *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
79 *> The vector v in the representation of H. V is not used if
86 *> The increment between elements of v. INCV <> 0.
92 *> The value tau in the representation of H.
97 *> C is COMPLEX*16 array, dimension (LDC,N)
98 *> On entry, the M-by-N matrix C.
99 *> On exit, C is overwritten by the matrix H * C if SIDE = 'L',
100 *> or C * H if SIDE = 'R'.
106 *> The leading dimension of the array C. LDC >= max(1,M).
111 *> WORK is COMPLEX*16 array, dimension
113 *> or (M) if SIDE = 'R'
119 *> \author Univ. of Tennessee
120 *> \author Univ. of California Berkeley
121 *> \author Univ. of Colorado Denver
124 *> \date September 2012
126 *> \ingroup complex16OTHERauxiliary
128 * =====================================================================
129 SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
131 * -- LAPACK auxiliary routine (version 3.4.2) --
132 * -- LAPACK is a software package provided by Univ. of Tennessee, --
133 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
136 * .. Scalar Arguments ..
138 INTEGER INCV, LDC, M, N
141 * .. Array Arguments ..
142 COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
145 * =====================================================================
149 PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ),
150 $ ZERO = ( 0.0D+0, 0.0D+0 ) )
152 * .. Local Scalars ..
154 INTEGER I, LASTV, LASTC
156 * .. External Subroutines ..
157 EXTERNAL ZGEMV, ZGERC
159 * .. External Functions ..
161 INTEGER ILAZLR, ILAZLC
162 EXTERNAL LSAME, ILAZLR, ILAZLC
164 * .. Executable Statements ..
166 APPLYLEFT = LSAME( SIDE, 'L' )
169 IF( TAU.NE.ZERO ) THEN
170 * Set up variables for scanning V. LASTV begins pointing to the end
178 I = 1 + (LASTV-1) * INCV
182 * Look for the last non-zero row in V.
183 DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO )
188 * Scan for the last non-zero column in C(1:lastv,:).
189 LASTC = ILAZLC(LASTV, N, C, LDC)
191 * Scan for the last non-zero row in C(:,1:lastv).
192 LASTC = ILAZLR(M, LASTV, C, LDC)
195 * Note that lastc.eq.0 renders the BLAS operations null; no special
196 * case is needed at this level.
201 IF( LASTV.GT.0 ) THEN
203 * w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1)
205 CALL ZGEMV( 'Conjugate transpose', LASTV, LASTC, ONE,
206 $ C, LDC, V, INCV, ZERO, WORK, 1 )
208 * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H
210 CALL ZGERC( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC )
216 IF( LASTV.GT.0 ) THEN
218 * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
220 CALL ZGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC,
221 $ V, INCV, ZERO, WORK, 1 )
223 * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H
225 CALL ZGERC( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC )