LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zlarf1l()

subroutine zlarf1l ( 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 )

ZLARF1L applies an elementary reflector to a general rectangular

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

Purpose:
!>
!> ZLARF1L 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 real scalar and v is a real vector assuming v(lastv) = 1,
!> where lastv is the last non-zero element.
!>
!> If tau = 0, then H is taken to be the unit matrix.
!>
!> To apply H**H (the conjugate transpose of 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 129 of file zlarf1l.f.

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*
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
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
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78
Here is the call graph for this function:
Here is the caller graph for this function: