LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 130 of file clarf.f.

130 *
131 * -- LAPACK auxiliary routine (version 3.7.0) --
132 * -- LAPACK is a software package provided by Univ. of Tennessee, --
133 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 * December 2016
135 *
136 * .. Scalar Arguments ..
137  CHARACTER side
138  INTEGER incv, ldc, m, n
139  COMPLEX tau
140 * ..
141 * .. Array Arguments ..
142  COMPLEX c( ldc, * ), v( * ), work( * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  COMPLEX one, zero
149  parameter( one = ( 1.0e+0, 0.0e+0 ),
150  $ zero = ( 0.0e+0, 0.0e+0 ) )
151 * ..
152 * .. Local Scalars ..
153  LOGICAL applyleft
154  INTEGER i, lastv, lastc
155 * ..
156 * .. External Subroutines ..
157  EXTERNAL cgemv, cgerc
158 * ..
159 * .. External Functions ..
160  LOGICAL lsame
161  INTEGER ilaclr, ilaclc
162  EXTERNAL lsame, ilaclr, ilaclc
163 * ..
164 * .. Executable Statements ..
165 *
166  applyleft = lsame( side, 'L' )
167  lastv = 0
168  lastc = 0
169  IF( tau.NE.zero ) THEN
170 ! Set up variables for scanning V. LASTV begins pointing to the end
171 ! of V.
172  IF( applyleft ) THEN
173  lastv = m
174  ELSE
175  lastv = n
176  END IF
177  IF( incv.GT.0 ) THEN
178  i = 1 + (lastv-1) * incv
179  ELSE
180  i = 1
181  END IF
182 ! Look for the last non-zero row in V.
183  DO WHILE( lastv.GT.0 .AND. v( i ).EQ.zero )
184  lastv = lastv - 1
185  i = i - incv
186  END DO
187  IF( applyleft ) THEN
188 ! Scan for the last non-zero column in C(1:lastv,:).
189  lastc = ilaclc(lastv, n, c, ldc)
190  ELSE
191 ! Scan for the last non-zero row in C(:,1:lastv).
192  lastc = ilaclr(m, lastv, c, ldc)
193  END IF
194  END IF
195 ! Note that lastc.eq.0 renders the BLAS operations null; no special
196 ! case is needed at this level.
197  IF( applyleft ) THEN
198 *
199 * Form H * C
200 *
201  IF( lastv.GT.0 ) THEN
202 *
203 * w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1)
204 *
205  CALL cgemv( 'Conjugate transpose', lastv, lastc, one,
206  $ c, ldc, v, incv, zero, work, 1 )
207 *
208 * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H
209 *
210  CALL cgerc( lastv, lastc, -tau, v, incv, work, 1, c, ldc )
211  END IF
212  ELSE
213 *
214 * Form C * H
215 *
216  IF( lastv.GT.0 ) THEN
217 *
218 * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
219 *
220  CALL cgemv( 'No transpose', lastc, lastv, one, c, ldc,
221  $ v, incv, zero, work, 1 )
222 *
223 * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H
224 *
225  CALL cgerc( lastc, lastv, -tau, work, 1, v, incv, c, ldc )
226  END IF
227  END IF
228  RETURN
229 *
230 * End of CLARF
231 *
integer function ilaclr(M, N, A, LDA)
ILACLR scans a matrix for its last non-zero row.
Definition: ilaclr.f:80
subroutine cgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CGEMV
Definition: cgemv.f:160
integer function ilaclc(M, N, A, LDA)
ILACLC scans a matrix for its last non-zero column.
Definition: ilaclc.f:80
subroutine cgerc(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CGERC
Definition: cgerc.f:132
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: