LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ zlarf()

subroutine zlarf ( character side,
integer m,
integer n,
complex*16, dimension( * ) v,
integer incv,
complex*16 tau,
complex*16, dimension( ldc, * ) c,
integer ldc,
complex*16, dimension( * ) work )

ZLARF applies an elementary reflector to a general rectangular matrix.

Download ZLARF + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!> !> ZLARF applies a complex elementary reflector H to a complex M-by-N !> matrix C, from either the left or the right. H is represented in the !> form !> !> H = I - tau * v * v**H !> !> where tau is a complex scalar and v is a complex vector. !> !> If tau = 0, then H is taken to be the unit matrix. !> !> To apply H**H, supply conjg(tau) instead !> tau. !>
Parameters
[in]SIDE
!> SIDE is CHARACTER*1 !> = 'L': form H * C !> = 'R': form C * H !>
[in]M
!> M is INTEGER !> The number of rows of the matrix C. !>
[in]N
!> N is INTEGER !> The number of columns of the matrix C. !>
[in]V
!> V is COMPLEX*16 array, dimension !> (1 + (M-1)*abs(INCV)) if SIDE = 'L' !> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' !> The vector v in the representation of H. V is not used if !> TAU = 0. !>
[in]INCV
!> INCV is INTEGER !> The increment between elements of v. INCV <> 0. !>
[in]TAU
!> TAU is COMPLEX*16 !> The value tau in the representation of H. !>
[in,out]C
!> C is COMPLEX*16 array, dimension (LDC,N) !> On entry, the M-by-N matrix C. !> On exit, C is overwritten by the matrix H * C if SIDE = 'L', !> or C * H if SIDE = 'R'. !>
[in]LDC
!> LDC is INTEGER !> The leading dimension of the array C. LDC >= max(1,M). !>
[out]WORK
!> WORK is COMPLEX*16 array, dimension !> (N) if SIDE = 'L' !> or (M) if SIDE = 'R' !>
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 125 of file zlarf.f.

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*
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
integer function ilazlc(m, n, a, lda)
ILAZLC scans a matrix for its last non-zero column.
Definition ilazlc.f:76
integer function ilazlr(m, n, a, lda)
ILAZLR scans a matrix for its last non-zero row.
Definition ilazlr.f:76
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: