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

◆ clarf()

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

CLARF applies an elementary reflector to a general rectangular matrix.

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

Purpose:
!>
!> CLARF 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 (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 clarf.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, cgerc
153* ..
154* .. External Functions ..
155 LOGICAL LSAME
156 INTEGER ILACLR, ILACLC
157 EXTERNAL lsame, ilaclr, ilaclc
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 = 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! 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 cgemv( '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 cgerc( 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 cgemv( '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 cgerc( lastc, lastv, -tau, work, 1, v, incv, c,
222 $ ldc )
223 END IF
224 END IF
225 RETURN
226*
227* End of CLARF
228*
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
Here is the call graph for this function:
Here is the caller graph for this function: