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

◆ clarf1l()

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

CLARF1L applies an elementary reflector to a general rectangular

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

Purpose:
!>
!> CLARF1L 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 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
!>          The value tau in the representation of H.
!> 
[in,out]C
!>          C is COMPLEX 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 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 126 of file clarf1l.f.

127*
128* -- LAPACK auxiliary routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 CHARACTER SIDE
134 INTEGER INCV, LDC, M, N
135 COMPLEX TAU
136* ..
137* .. Array Arguments ..
138 COMPLEX C( LDC, * ), V( * ), WORK( * )
139* ..
140*
141* =====================================================================
142*
143* .. Parameters ..
144 COMPLEX ONE, ZERO
145 parameter( one = ( 1.0e+0, 0.0e+0 ),
146 $ zero = ( 0.0e+0, 0.0e+0 ) )
147* ..
148* .. Local Scalars ..
149 LOGICAL APPLYLEFT
150 INTEGER I, J, LASTV, LASTC, FIRSTV
151* ..
152* .. External Subroutines ..
153 EXTERNAL cgemv, cgerc, cscal
154* ..
155* .. Intrinsic Functions ..
156 INTRINSIC conjg
157* ..
158* .. External Functions ..
159 LOGICAL LSAME
160 INTEGER ILACLR, ILACLC
161 EXTERNAL lsame, ilaclr, ilaclc
162* ..
163* .. Executable Statements ..
164*
165 applyleft = lsame( side, 'L' )
166 firstv = 1
167 lastc = 0
168 IF( tau.NE.zero ) THEN
169! Set up variables for scanning V. LASTV begins pointing to the end
170! of V up to V(1).
171 IF( applyleft ) THEN
172 lastv = m
173 ELSE
174 lastv = n
175 END IF
176 i = 1
177! Look for the last non-zero row in V.
178 DO WHILE( lastv.GT.firstv .AND. v( i ).EQ.zero )
179 firstv = firstv + 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 = ilaclc(lastv, n, c, ldc)
185 ELSE
186! Scan for the last non-zero row in C(:,1:lastv).
187 lastc = ilaclr(m, lastv, c, ldc)
188 END IF
189 END IF
190 IF( lastc.EQ.0 ) THEN
191 RETURN
192 END IF
193 IF( applyleft ) THEN
194*
195* Form H * C
196*
197 IF( lastv.EQ.firstv ) THEN
198*
199* C(lastv,1:lastc) := ( 1 - tau ) * C(lastv,1:lastc)
200*
201 CALL cscal( lastc, one - tau, c( lastv, 1 ), ldc )
202 ELSE
203*
204* w(1:lastc,1) := C(firstv:lastv-1,1:lastc)**T * v(firstv:lastv-1,1)
205*
206 CALL cgemv( 'Conjugate transpose', lastv - firstv, lastc,
207 $ one, c( firstv, 1 ), ldc, v( i ), incv, zero,
208 $ work, 1 )
209*
210* w(1:lastc,1) += C(lastv,1:lastc)**H * v(lastv,1)
211*
212 DO j = 1, lastc
213 work( j ) = work( j ) + conjg( c( lastv, j ) )
214 END DO
215*
216* C(lastv,1:lastc) += - tau * v(lastv,1) * w(1:lastc,1)**H
217*
218 DO j = 1, lastc
219 c( lastv, j ) = c( lastv, j )
220 $ - tau * conjg( work( j ) )
221 END DO
222*
223* C(firstv:lastv-1,1:lastc) += - tau * v(firstv:lastv-1,1) * w(1:lastc,1)**H
224*
225 CALL cgerc( lastv - firstv, lastc, -tau, v( i ), incv,
226 $ work, 1, c( firstv, 1 ), ldc)
227 END IF
228 ELSE
229*
230* Form C * H
231*
232 IF( lastv.EQ.firstv ) THEN
233*
234* C(1:lastc,lastv) := ( 1 - tau ) * C(1:lastc,lastv)
235*
236 CALL cscal( lastc, one - tau, c( 1, lastv ), 1 )
237 ELSE
238*
239* w(1:lastc,1) := C(1:lastc,firstv:lastv-1) * v(firstv:lastv-1,1)
240*
241 CALL cgemv( 'No transpose', lastc, lastv - firstv, one,
242 $ c( 1, firstv ), ldc, v( i ), incv, zero,
243 $ work, 1 )
244*
245* w(1:lastc,1) += C(1:lastc,lastv) * v(lastv,1)
246*
247 CALL caxpy( lastc, one, c( 1, lastv ), 1, work, 1 )
248*
249* C(1:lastc,lastv) += - tau * v(lastv,1) * w(1:lastc,1)
250*
251 CALL caxpy( lastc, -tau, work, 1, c( 1, lastv ), 1 )
252*
253* C(1:lastc,firstv:lastv-1) += - tau * w(1:lastc,1) * v(firstv:lastv-1)**H
254*
255 CALL cgerc( lastc, lastv - firstv, -tau, work, 1, v( i ),
256 $ incv, c( 1, firstv ), ldc )
257 END IF
258 END IF
259 RETURN
260*
261* End of CLARF1L
262*
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
Definition caxpy.f:88
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
Definition cgemv.f:160
subroutine cgerc(m, n, alpha, x, incx, y, incy, a, lda)
CGERC
Definition cgerc.f:130
integer function ilaclc(m, n, a, lda)
ILACLC scans a matrix for its last non-zero column.
Definition ilaclc.f:76
integer function ilaclr(m, n, a, lda)
ILACLR scans a matrix for its last non-zero row.
Definition ilaclr.f:76
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine cscal(n, ca, cx, incx)
CSCAL
Definition cscal.f:78
Here is the call graph for this function:
Here is the caller graph for this function: