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

◆ clarf1f()

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

CLARF1F applies an elementary reflector to a general rectangular

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

Purpose:
!>
!> CLARF1F 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 assuming v(1) = 1.
!>
!> 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 125 of file clarf1f.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 TAU
135* ..
136* .. Array Arguments ..
137 COMPLEX C( LDC, * ), V( * ), WORK( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 COMPLEX ONE, ZERO
144 parameter( one = ( 1.0e+0, 0.0e+0 ),
145 $ zero = ( 0.0e+0, 0.0e+0 ) )
146* ..
147* .. Local Scalars ..
148 LOGICAL APPLYLEFT
149 INTEGER I, LASTV, LASTC
150* ..
151* .. External Subroutines ..
152 EXTERNAL cgemv, cger, cscal
153* ..
154* .. Intrinsic Functions ..
155 INTRINSIC conjg
156* ..
157* .. External Functions ..
158 LOGICAL LSAME
159 INTEGER ILACLR, ILACLC
160 EXTERNAL lsame, ilaclr, ilaclc
161* ..
162* .. Executable Statements ..
163*
164 applyleft = lsame( side, 'L' )
165 lastv = 1
166 lastc = 0
167 IF( tau.NE.zero ) THEN
168! Set up variables for scanning V. LASTV begins pointing to the end
169! of V up to V(1).
170 IF( applyleft ) THEN
171 lastv = m
172 ELSE
173 lastv = n
174 END IF
175 IF( incv.GT.0 ) THEN
176 i = 1 + (lastv-1) * incv
177 ELSE
178 i = 1
179 END IF
180! Look for the last non-zero row in V.
181 DO WHILE( lastv.GT.1 .AND. v( i ).EQ.zero )
182 lastv = lastv - 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 = ilaclc(lastv, n, c, ldc)
188 ELSE
189! Scan for the last non-zero row in C(:,1:lastv).
190 lastc = ilaclr(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.1 ) THEN
201*
202* C(1,1:lastc) := ( 1 - tau ) * C(1,1:lastc)
203*
204 CALL cscal( lastc, one - tau, c, ldc )
205 ELSE
206*
207* w(1:lastc,1) := C(2:lastv,1:lastc)**H * v(2:lastv,1)
208*
209 CALL cgemv( 'Conjugate transpose', lastv - 1, lastc, one,
210 $ c( 2, 1 ), ldc, v( 1 + incv ), incv, zero,
211 $ work, 1 )
212*
213* w(1:lastc,1) += v(1,1) * C(1,1:lastc)**H
214*
215 DO i = 1, lastc
216 work( i ) = work( i ) + conjg( c( 1, i ) )
217 END DO
218*
219* C(1, 1:lastc) += - tau * v(1,1) * w(1:lastc,1)**H
220*
221 DO i = 1, lastc
222 c( 1, i ) = c( 1, i ) - tau * conjg( work( i ) )
223 END DO
224*
225* C(2:lastv,1:lastc) += - tau * v(2:lastv,1) * w(1:lastc,1)**H
226*
227 CALL cgerc( lastv - 1, lastc, -tau, v( 1 + incv ), incv,
228 $ work, 1, c( 2, 1 ), ldc )
229 END IF
230 ELSE
231*
232* Form C * H
233*
234 IF( lastv.EQ.1 ) THEN
235*
236* C(1:lastc,1) := ( 1 - tau ) * C(1:lastc,1)
237*
238 CALL cscal( lastc, one - tau, c, 1 )
239 ELSE
240*
241* w(1:lastc,1) := C(1:lastc,2:lastv) * v(2:lastv,1)
242*
243 CALL cgemv( 'No transpose', lastc, lastv - 1, one,
244 $ c( 1, 2 ), ldc, v( 1 + incv ), incv, zero,
245 $ work, 1 )
246*
247* w(1:lastc,1) += v(1,1) * C(1:lastc,1)
248*
249 CALL caxpy( lastc, one, c, 1, work, 1 )
250*
251* C(1:lastc,1) += - tau * v(1,1) * w(1:lastc,1)
252*
253 CALL caxpy( lastc, -tau, work, 1, c, 1 )
254*
255* C(1:lastc,2:lastv) += - tau * w(1:lastc,1) * v(2:lastv)**H
256*
257 CALL cgerc( lastc, lastv - 1, -tau, work, 1,
258 $ v( 1 + incv ), incv, c( 1, 2 ), ldc )
259 END IF
260 END IF
261 RETURN
262*
263* End of CLARF1F
264*
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: