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

◆ 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 127 of file zlarf.f.

128*
129* -- LAPACK auxiliary routine --
130* -- LAPACK is a software package provided by Univ. of Tennessee, --
131* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132*
133* .. Scalar Arguments ..
134 CHARACTER SIDE
135 INTEGER INCV, LDC, M, N
136 COMPLEX*16 TAU
137* ..
138* .. Array Arguments ..
139 COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 COMPLEX*16 ONE, ZERO
146 parameter( one = ( 1.0d+0, 0.0d+0 ),
147 $ zero = ( 0.0d+0, 0.0d+0 ) )
148* ..
149* .. Local Scalars ..
150 LOGICAL APPLYLEFT
151 INTEGER I, LASTV, LASTC
152* ..
153* .. External Subroutines ..
154 EXTERNAL zgemv, zgerc
155* ..
156* .. External Functions ..
157 LOGICAL LSAME
158 INTEGER ILAZLR, ILAZLC
159 EXTERNAL lsame, ilazlr, ilazlc
160* ..
161* .. Executable Statements ..
162*
163 applyleft = lsame( side, 'L' )
164 lastv = 0
165 lastc = 0
166 IF( tau.NE.zero ) THEN
167* Set up variables for scanning V. LASTV begins pointing to the end
168* of V.
169 IF( applyleft ) THEN
170 lastv = m
171 ELSE
172 lastv = n
173 END IF
174 IF( incv.GT.0 ) THEN
175 i = 1 + (lastv-1) * incv
176 ELSE
177 i = 1
178 END IF
179* Look for the last non-zero row in V.
180 DO WHILE( lastv.GT.0 .AND. v( i ).EQ.zero )
181 lastv = lastv - 1
182 i = i - incv
183 END DO
184 IF( applyleft ) THEN
185* Scan for the last non-zero column in C(1:lastv,:).
186 lastc = ilazlc(lastv, n, c, ldc)
187 ELSE
188* Scan for the last non-zero row in C(:,1:lastv).
189 lastc = ilazlr(m, lastv, c, ldc)
190 END IF
191 END IF
192* Note that lastc.eq.0 renders the BLAS operations null; no special
193* case is needed at this level.
194 IF( applyleft ) THEN
195*
196* Form H * C
197*
198 IF( lastv.GT.0 ) THEN
199*
200* w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1)
201*
202 CALL zgemv( 'Conjugate transpose', lastv, lastc, one,
203 $ c, ldc, v, incv, zero, work, 1 )
204*
205* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H
206*
207 CALL zgerc( lastv, lastc, -tau, v, incv, work, 1, c, ldc )
208 END IF
209 ELSE
210*
211* Form C * H
212*
213 IF( lastv.GT.0 ) THEN
214*
215* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
216*
217 CALL zgemv( 'No transpose', lastc, lastv, one, c, ldc,
218 $ v, incv, zero, work, 1 )
219*
220* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H
221*
222 CALL zgerc( lastc, lastv, -tau, work, 1, v, incv, c, 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:78
integer function ilazlr(m, n, a, lda)
ILAZLR scans a matrix for its last non-zero row.
Definition ilazlr.f:78
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: